Doxygen with github
Loading...
Searching...
No Matches
ksComponent.h
1/*
2 * Copyright (c) 2021-2023, 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 "ksConstants.h"
13#include "ksRtti.h"
14
15namespace ksf
16{
17 class ksApplication;
18
19 namespace ksComponentState
20 {
21 enum TYPE
22 {
26 NotInitialized,
30 Initialized,
34 Active,
40 ToRemove
41 };
42 }
43
50 class ksComponent : public ksRtti
51 {
52 KSF_RTTI_DECLARATIONS(ksComponent, ksRtti)
53
54 friend class ksApplication;
55
56 protected:
58 ksComponentState::TYPE componentState { ksComponentState::NotInitialized };
59
60 public:
66 virtual bool init(ksApplication* app);
67
73 virtual bool loop(ksApplication* app);
74
80 virtual bool postInit(ksApplication* app);
81 };
82}
A class that is a base for user-defined application.
Definition ksApplication.h:43
Base component class.
Definition ksComponent.h:51
virtual bool init(ksApplication *app)
Initializes component.
Definition ksComponent.cpp:14
ksComponentState::TYPE componentState
Definition ksComponent.h:58
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