Doxygen with github
Loading...
Searching...
No Matches
ksComponent.h
1/*
2 * Copyright (c) 2021-2025, Krzysztof Strehlau
3 *
4 * This file is a part of the ksIotFramework library.
5 * All licensing information can be found inside LICENSE.md file.
6 *
7 * https://github.com/cziter15/ksIotFrameworkLib/blob/master/LICENSE
8 */
9
10#pragma once
11
12#include "ksRtti.h"
13
14namespace ksf
15{
16 class ksApplication;
17
18 namespace ksComponentState
19 {
20 enum TYPE
21 {
22 NotInitialized,
23 Initialized,
24 Active,
25 ToRemove
26 };
27 }
28
35 class ksComponent : public ksRtti
36 {
37 KSF_RTTI_DECLARATIONS(ksComponent, ksRtti)
38
39 friend class ksApplication;
40
41 protected:
42 ksComponentState::TYPE componentState { ksComponentState::NotInitialized };
43
44 public:
50 virtual bool init(ksApplication* app);
51
57 virtual bool loop(ksApplication* app);
58
64 virtual bool postInit(ksApplication* app);
65 };
66}
A class that serves as the base for user-defined applications.
Definition ksApplication.h:44
Base component class.
Definition ksComponent.h:36
virtual bool init(ksApplication *app)
Initializes component.
Definition ksComponent.cpp:14
ksComponentState::TYPE componentState
Holds current state of the component.
Definition ksComponent.h:42
virtual bool postInit(ksApplication *app)
Method called after component initialization, used to setup references to other components.
Definition ksComponent.cpp:24
virtual bool loop(ksApplication *app)
Handles component loop logic, called from application loop.
Definition ksComponent.cpp:19
Implements RTTI (run-time type information) for objects.
Definition ksRtti.h:26