ifw-ccf 6.0.0
 
Loading...
Searching...
No Matches
testManagerHelper.cpp
Go to the documentation of this file.
1
6
8
10public:
11 TestThread(const std::string& thread_name,
12 ifw::ccf::mptk::MessageBus& message_bus,
13 const double period = 0.1):
14 ifw::ccf::mptk::Thread(thread_name, message_bus, period) {
15 m_msg_count = 0;
16 };
17
19 // No special clean up to do here -- nothing was allocated etc ...
20 };
21
22 void UserLogic() {
23 std::map<std::string, std::string>
24 receiver_threads = {{"ThreadA", "ThreadB"}, {"ThreadB", "ThreadC"},
25 {"ThreadC", "ThreadD"}, {"ThreadD", "MainThread"}};
26 bool timed_out;
28 if (MsgBus().ReceiveMessage(GetName(), 1, timed_out, message)) {
29 std::string data = fmt::format("{}/{}. Data: {}", GetName().c_str(),
30 ++m_msg_count, message.Data().c_str());
32 receiver_threads[GetName()], data);
33 MsgBus().SendMessage(new_message);
34 }
35 };
36
37private:
38 int16_t m_msg_count;
39};
40
41
TestThread(const std::string &thread_name, ifw::ccf::mptk::MessageBus &message_bus, const double period=0.1)
Definition testManagerHelper.cpp:11
void UserLogic()
User provided business logic. The UserLogic method need not execute an internal loop....
Definition testManagerHelper.cpp:22
~TestThread()
Definition testManagerHelper.cpp:18
IFW CTD Multiprocessing Toolkit Message Bus.
Definition messageBus.hpp:92
void SendMessage(const Message &message)
Send a message on the Message Bus.
Definition messageBus.cpp:83
IFW CTD Multiprocessing Toolkit Message class.
Definition message.hpp:25
const std::string & Data() const
Return data (payload) of message.
Definition message.cpp:90
IFW CTD Multiprocessing Toolkit Thread base class.
Definition thread.hpp:31
MessageBus & MsgBus()
Get acces to the MessageBus associated with this thread object.
Definition thread.cpp:236
std::string GetName() const
Return the thread Name.
Definition thread.cpp:73
Thread(const std::string &thread_name, MessageBus &message_bus, const double period=0.1)
Constructor method, setting up the internal members.
Definition thread.cpp:42
@ HIGH
Definition message.hpp:19
Definition appBase.cpp:10