ifw-ccf 6.0.0
 
Loading...
Searching...
No Matches
message.hpp
Go to the documentation of this file.
1
6
7#pragma once
8
9#include <string>
10
11#include <fmt/format.h>
12
14
15namespace ifw::ccf::mptk {
16
17 enum class MsgPrio {
20 };
21
25 class Message {
26 public:
27
28 Message();
29
30 Message(const Message& source);
31
33 Message(const std::string& command,
34 const MsgPrio priority,
35 const std::string& sender_thread_name,
36 const std::string& receiver_thread_name,
37 const std::string& m_data);
38
39 ~Message();
40
42 void Clear();
43
45 const std::string& GetMsgId() const;
46
48 const std::string& Command() const;
49
51 MsgPrio Priority() const;
52
54 const std::string& SenderThreadId() const;
55
57 const std::string& ReceiverThreadId() const;
58
60 const std::string& Data() const;
61
63 void SetReceptionTime(const double timestamp);
64
66 std::string ToString(const uint16_t truncate = 128,
67 const bool compact = true) const;
68
69 Message& operator = (const Message& source);
70
71 protected:
72 std::string m_id;
73 std::string m_command;
77 std::string m_data;
80
81 private:
82 void _Copy(const Message& source);
83 };
84
85}
const std::string & ReceiverThreadId() const
Return receiver Thread ID.
Definition message.cpp:85
std::string m_receiver_thread_name
Definition message.hpp:76
const std::string & Command() const
Return name of command in object.
Definition message.cpp:70
const std::string & Data() const
Return data (payload) of message.
Definition message.cpp:90
MsgPrio m_priority
Definition message.hpp:74
Message()
Definition message.cpp:20
std::string m_data
Definition message.hpp:77
double m_reception_time
Definition message.hpp:79
std::string m_sender_thread_name
Definition message.hpp:75
double m_submission_time
Definition message.hpp:78
MsgPrio Priority() const
Return priotity of message (message queue priority).
Definition message.cpp:75
std::string m_command
Definition message.hpp:73
Message & operator=(const Message &source)
Definition message.cpp:47
void Clear()
Clear message object.
Definition message.cpp:124
void SetReceptionTime(const double timestamp)
Set the time of receiving the message from the Message Bus.
Definition message.cpp:119
const std::string & SenderThreadId() const
Return sender Thread ID.
Definition message.cpp:80
~Message()
Definition message.cpp:43
std::string m_id
Definition message.hpp:72
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:95
const std::string & GetMsgId() const
Return unique ID assigned to the message.
Definition message.cpp:65
Definition logger.hpp:13
MsgPrio
Definition message.hpp:17
@ LOW
Definition message.hpp:18
@ HIGH
Definition message.hpp:19