ifw-ccf 5.0.2
Loading...
Searching...
No Matches
message.hpp
Go to the documentation of this file.
1
5#ifndef IFW_CCF_MPTK_MESSAGE_HPP_
6#define IFW_CCF_MPTK_MESSAGE_HPP_
7
8#include <string>
9
10#include <fmt/format.h>
11
12#include <rad/logger.hpp>
13
14namespace ifw::ccf::mptk {
15
16 enum class MsgPrio {
17 LOW,
18 HIGH
19 };
20
24 class Message {
25 public:
26
27 Message();
28
29 Message(const Message& source);
30
32 Message(const std::string& command,
33 const MsgPrio priority,
34 const std::string& sender_thread_name,
35 const std::string& receiver_thread_name,
36 const std::string& m_data);
37
38 ~Message();
39
41 void Clear();
42
44 const std::string& GetMsgId() const;
45
47 const std::string& Command() const;
48
50 MsgPrio Priority() const;
51
53 const std::string& SenderThreadId() const;
54
56 const std::string& ReceiverThreadId() const;
57
59 const std::string& Data() const;
60
62 void SetReceptionTime(const double timestamp);
63
65 std::string ToString(const uint16_t truncate = 128,
66 const bool compact = true) const;
67
68 Message& operator = (const Message& source);
69
70 protected:
71 std::string m_id;
72 std::string m_command;
76 std::string m_data;
79
80 private:
81 void _Copy(const Message& source);
82 };
83
84}
85
86#endif // IFW_CCF_MPTK_MESSAGE_HPP_
87
IFW CTD Multiprocessing Toolkit Message class.
Definition message.hpp:24
const std::string & ReceiverThreadId() const
Return receiver Thread ID.
Definition message.cpp:84
std::string m_receiver_thread_name
Definition message.hpp:75
const std::string & Command() const
Return name of command in object.
Definition message.cpp:69
const std::string & Data() const
Return data (payload) of message.
Definition message.cpp:89
MsgPrio m_priority
Definition message.hpp:73
Message()
Definition message.cpp:19
std::string m_data
Definition message.hpp:76
double m_reception_time
Definition message.hpp:78
std::string m_sender_thread_name
Definition message.hpp:74
double m_submission_time
Definition message.hpp:77
MsgPrio Priority() const
Return priotity of message (message queue priority).
Definition message.cpp:74
std::string m_command
Definition message.hpp:72
Message & operator=(const Message &source)
Definition message.cpp:46
void Clear()
Clear message object.
Definition message.cpp:123
void SetReceptionTime(const double timestamp)
Set the time of receiving the message from the Message Bus.
Definition message.cpp:118
const std::string & SenderThreadId() const
Return sender Thread ID.
Definition message.cpp:79
~Message()
Definition message.cpp:42
std::string m_id
Definition message.hpp:71
std::string ToString(const uint16_t truncate=128, const bool compact=true) const
Generate ASCII output providing a status of the object.
Definition message.cpp:94
const std::string & GetMsgId() const
Return unique ID assigned to the message.
Definition message.cpp:64
Definition manager.hpp:15
MsgPrio
Definition message.hpp:16