Chapter 4.1 : With only functions
There are two main ways to use the Daemon class. Once the backend to use is defined (see part 3) a Daemon can be directly instanciated with :
1 2 3 4 5 |
#include "Daemon.h" #include "DaemonEmptyBackend.h" typedef Daemon<DaemonEmptyBackend> TestDaemon; |
Then, some functions can be define to treat data : ../../TESTS/TEST_DATA_PROCESSING/main.cpp
Here, testShadokProcessing method will be called each time the Daemon receives a Shadok and testIntProcessing method will be called each time the Daemon receives an int.
In this example, the processData method of the Daemon is called manually, but it will be called automatically when the Daemon is running.
Methods can be static or non-static and have their dedicated addCallableMethod method to be registered to the Daemon