25 #ifndef TASKOLIB_MESSAGE_H_
26 #define TASKOLIB_MESSAGE_H_
33 #include <gul14/escape.h>
61 static constexpr std::array<char const*, static_cast<int>(
Type::undefined) + 1>
67 "sequence_stopped_with_error",
70 "step_stopped_with_error",
118 stream << Message::type_description_[static_cast<int>(t)];
123 stream <<
"Message{ ";
125 if (mess.
index_.has_value())
126 stream << *(mess.
index_) <<
": ";
131 << gul14::escape(mess.
text_)
Declaration of the StepIndex type.
A message carrying some text, a timestamp, and a type, to be transported with a message queue between...
Definition: Message.h:45
friend std::ostream & operator<<(std::ostream &stream, Type const &t)
Definition: Message.h:117
TimePoint get_timestamp() const
Return the timestamp.
Definition: Message.h:103
Message()=default
Construct an empty message.
Message & set_text(const std::string &text)
Set the message text.
Definition: Message.h:109
Type
The type of this message.
Definition: Message.h:49
@ undefined
marker for last type
@ sequence_started
a sequence has been started
@ step_stopped
a step inside a sequence has stopped regularly
@ output
a message string that was output by a step via print()
@ step_stopped_with_error
a step inside a sequence has been stopped because of an error
@ step_started
a step inside a sequence has been started
@ sequence_stopped_with_error
a sequence has been stopped because of an error
@ sequence_stopped
a sequence has stopped regularly
OptionalStepIndex index_
Definition: Message.h:143
std::string text_
Definition: Message.h:137
const std::string & get_text() const
Return the message text.
Definition: Message.h:97
TimePoint timestamp_
Definition: Message.h:141
Message & set_type(Type type) noexcept
Set the message type.
Definition: Message.h:115
static constexpr std::array< char const *, static_cast< int >Type::undefined)+1 > type_description_
Definition: Message.h:62
Type type_
Definition: Message.h:142
Message & set_index(OptionalStepIndex index)
Set the associated index.
Definition: Message.h:106
OptionalStepIndex get_index() const
Return the associated optional step index.
Definition: Message.h:89
Message & set_timestamp(TimePoint timestamp)
Set the timestamp.
Definition: Message.h:112
Message(Type type, std::string text, TimePoint timestamp, OptionalStepIndex index)
Construct an initialized message from the given parameters.
Definition: Message.h:80
Type get_type() const noexcept
Return the message type.
Definition: Message.h:100
friend std::ostream & operator<<(std::ostream &stream, Message const &mess)
Definition: Message.h:122
Definition: VariableName.h:154
Namespace task contains all Taskolib functions and classes.
Definition: CommChannel.h:33
std::string to_string(Step::Type type)
Return a lower-case name for a step type ("action", "if", "end").
Definition: Step.cc:287
gul14::optional< StepIndex > OptionalStepIndex
An optional step index (gul14::optional<StepIndex>).
Definition: StepIndex.h:37
std::chrono::time_point< Clock > TimePoint
Definition: time_types.h:34
Declaration of time-related types.