ALib C++ Framework
by
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
main.cpp
1// #################################################################################################
2// ALib C++ Framework
3// Configuration Sample
4//
5// Copyright 2025 A-Worx GmbH, Germany
6// Published under Boost Software License (a free software license, see LICENSE.txt)
7// #################################################################################################
8#include "ALib.App.CLI.H"
9#if !DOXYGEN // otherwise this sample would be seen in the ALib dox
10
11#include "sample.hpp"
12
13
14//------ A minimal pure App (non CLI) used with dox. Should be tested after changes ------
15#if defined(TEST_MINIMAL_APP)
16DOX_MARKER( [DOX_APP_MINIMAL_APP]) // todo: not shown yet
17struct MyApp : public alib::app::App {
18 MyApp() : App(nullptr) {}
19 void onRun() override { cOut->Add("Hello ALib App!"); };
20};
21
22int main( int argc, const char** argv) { return MyApp().Main(argc, argv); }
23DOX_MARKER( [DOX_APP_MINIMAL_APP])
24
25//------- A minimal pure App (non CLI) with custom method. Should be tested after changes --------
26
27#elif defined(TEST_MINIMAL_APP_WITH_CUSTOM_METHOD)
28DOX_MARKER( [DOX_APP_MINIMAL_APP_WITH_CUSTOM_METHOD]) // todo: not shown yet
29struct MyApp : public alib::app::App {
30
31 enum class MyStates { WarmUp = 1 };
32
33 MyApp() : App(nullptr) {
34 // Insert custom step right after built-in RunStart
35 machine.Program.AddAfter( States::RunStart,
36 StateMachine::Command::MakeCustom<MyApp, &MyApp::WarmUpStep>( MyStates::WarmUp )
37 );
38 }
39
40 void WarmUpStep() {
41 cOut->Add("I'm warming up");
42 }
43
44 void onRun() override {
45 cOut->Add("Hello ALib App!");
46 }
47};
48
49int main( int argc, const char** argv) { return MyApp().Main(argc, argv); }
50DOX_MARKER( [DOX_APP_MINIMAL_APP_WITH_CUSTOM_METHOD])
51
52
53///---------------- The real sample ----------------
54#else
55int main( int argc, const char** argv) {
56
57 return Sample().Main(argc, argv);
58}
59
60#endif //TEST_MINIMAL_APP
61
62
63#endif // !DOXYGEN
64
virtual void onRun()=0