Symple module
Event
Symple event message carrying a named occurrence with a timestamp.
Event
#include <icy/symple/event.h>Inherits:
Message
Symple event message carrying a named occurrence with a timestamp.
The name field identifies the event. The time field is stored as a Unix timestamp (seconds since epoch).
Public Methods
| Return | Name | Description |
|---|---|---|
Event | Constructs an event with type "event" and time set to now. | |
Event | Constructs an event from a JSON value; sets missing time to now. | |
Event | Copy constructor; preserves or sets missing time to now. | |
bool | valid virtual const | Returns true if the base message is valid and the name field is set. |
std::string | name const | Returns the event name string. |
std::time_t | time const | Returns the event timestamp as a Unix time_t value. |
void | setName | Sets the event name field. |
void | setTime | Sets the event timestamp. |
Event
Event()Constructs an event with type "event" and time set to now.
Event
Event(const json::Value & root)Constructs an event from a JSON value; sets missing time to now.
Parameters
rootJSON object to initialise from.
Event
Event(const Event & root)Copy constructor; preserves or sets missing time to now.
Parameters
rootSource event.
valid
virtual const
virtual bool valid() constReturns true if the base message is valid and the name field is set.
name
const
std::string name() constReturns the event name string.
time
const
std::time_t time() constReturns the event timestamp as a Unix time_t value.
setName
void setName(std::string_view name)Sets the event name field.
Parameters
nameEvent name string.
setTime
void setTime(std::time_t time)Sets the event timestamp.
Parameters
timeUnix timestamp (seconds since epoch).
