ifw-ccf  3.0.0-pre2
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 
14 namespace ccf::mptk {
15 
19  class Message {
20  public:
21 
22  Message();
23 
24  Message(const Message& source);
25 
27  Message(const std::string& command,
28  const uint8_t priority,
29  const std::string& sender_thread_name,
30  const std::string& receiver_thread_name,
31  const std::string& m_data);
32 
33  ~Message();
34 
36  void Clear();
37 
39  const std::string& GetMsgId() const;
40 
42  const std::string& Command() const;
43 
45  uint8_t Priority() const;
46 
48  const std::string& SenderThreadId() const;
49 
51  const std::string& ReceiverThreadId() const;
52 
54  const std::string& Data() const;
55 
57  void SetReceptionTime(const double timestamp);
58 
60  std::string ToString(const uint16_t truncate = 128,
61  const bool compact = true) const;
62 
63  Message& operator = (const Message& source);
64 
65  protected:
66  std::string m_id;
67  std::string m_command;
68  uint8_t m_priority;
69  std::string m_sender_thread_name;
71  std::string m_data;
74 
75  private:
76  void _Copy(const Message& source);
77  };
78 
79 }
80 
81 #endif // IFW_CCF_MPTK_MESSAGE_HPP_
82 
IFW CTD Multiprocessing Toolkit Message class.
Definition: message.hpp:19
double m_submission_time
Definition: message.hpp:72
const std::string & Data() const
Return data (payload) of message.
Definition: message.cpp:89
double m_reception_time
Definition: message.hpp:73
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
std::string m_receiver_thread_name
Definition: message.hpp:70
uint8_t m_priority
Definition: message.hpp:68
const std::string & ReceiverThreadId() const
Return receiver Thread ID.
Definition: message.cpp:84
std::string m_command
Definition: message.hpp:67
void Clear()
Clear message object.
Definition: message.cpp:123
std::string m_sender_thread_name
Definition: message.hpp:69
Message & operator=(const Message &source)
Definition: message.cpp:46
std::string m_data
Definition: message.hpp:71
const std::string & Command() const
Return name of command in object.
Definition: message.cpp:69
const std::string & SenderThreadId() const
Return sender Thread ID.
Definition: message.cpp:79
Message()
Definition: message.cpp:19
const std::string & GetMsgId() const
Return unique ID assigned to the message.
Definition: message.cpp:64
uint8_t Priority() const
Return priotity of message (message queue priority).
Definition: message.cpp:74
std::string m_id
Definition: message.hpp:66
void SetReceptionTime(const double timestamp)
Set the time of receiving the message from the Message Bus.
Definition: message.cpp:118
~Message()
Definition: message.cpp:42
Definition: manager.hpp:15