Taskolib
1.3.3
|
A message carrying some text, a timestamp, and a type, to be transported with a message queue between threads.
#include <Message.h>
Public Types | |
enum class | Type { output , sequence_started , sequence_stopped , sequence_stopped_with_error , step_started , step_stopped , step_stopped_with_error , undefined } |
The type of this message. More... | |
Public Member Functions | |
Message ()=default | |
Construct an empty message. More... | |
Message (Type type, std::string text, TimePoint timestamp, OptionalStepIndex index) | |
Construct an initialized message from the given parameters. More... | |
OptionalStepIndex | get_index () const |
Return the associated optional step index. More... | |
const std::string & | get_text () const |
Return the message text. More... | |
Type | get_type () const noexcept |
Return the message type. More... | |
TimePoint | get_timestamp () const |
Return the timestamp. More... | |
Message & | set_index (OptionalStepIndex index) |
Set the associated index. More... | |
Message & | set_text (const std::string &text) |
Set the message text. More... | |
Message & | set_timestamp (TimePoint timestamp) |
Set the timestamp. More... | |
Message & | set_type (Type type) noexcept |
Set the message type. More... | |
Private Attributes | |
std::string | text_ |
TimePoint | timestamp_ {} |
Type | type_ { Type::output } |
OptionalStepIndex | index_ |
Static Private Attributes | |
static constexpr std::array< char const *, static_cast< int >Type::undefined)+1 > | type_description_ |
Friends | |
std::ostream & | operator<< (std::ostream &stream, Type const &t) |
std::ostream & | operator<< (std::ostream &stream, Message const &mess) |
|
strong |
The type of this message.
|
default |
Construct an empty message.
|
inline |
Construct an initialized message from the given parameters.
|
inline |
Return the associated optional step index.
References index_.
Referenced by task::Executor::update().
|
inline |
Return the message text.
This function returns a reference to a member variable. Be aware of the associated lifetime implications!
References text_.
Referenced by task::default_message_callback(), and task::Executor::update().
|
inline |
|
inlinenoexcept |
Return the message type.
References type_.
Referenced by task::default_message_callback(), and task::Executor::update().
|
inline |
Set the associated index.
References index_.
|
inline |
Set the message text.
References text_.
Set the timestamp.
References timestamp_.
Set the message type.
References type_.
|
friend |
|
friend |
|
private |
Referenced by get_index(), and set_index().
|
private |
Referenced by get_text(), and set_text().
|
private |
Referenced by get_timestamp(), and set_timestamp().
|
private |
Referenced by get_type(), and set_type().
|
staticconstexprprivate |