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

ReturnNameDescription
EventConstructs an event with type "event" and time set to now.
EventConstructs an event from a JSON value; sets missing time to now.
EventCopy constructor; preserves or sets missing time to now.
boolvalid virtual constReturns true if the base message is valid and the name field is set.
std::stringname constReturns the event name string.
std::time_ttime constReturns the event timestamp as a Unix time_t value.
voidsetNameSets the event name field.
voidsetTimeSets 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

  • root JSON object to initialise from.

Event

Event(const Event & root)

Copy constructor; preserves or sets missing time to now.

Parameters

  • root Source event.

valid

virtual const

virtual bool valid() const

Returns true if the base message is valid and the name field is set.


name

const

std::string name() const

Returns the event name string.


time

const

std::time_t time() const

Returns the event timestamp as a Unix time_t value.


setName

void setName(std::string_view name)

Sets the event name field.

Parameters

  • name Event name string.

setTime

void setTime(std::time_t time)

Sets the event timestamp.

Parameters

  • time Unix timestamp (seconds since epoch).