Event
Event
#include <icy/symple/event.h>class EventDefined in src/symple/include/icy/symple/event.h:29
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).
List of all members
| Name | Kind | Owner |
|---|---|---|
Event | function | Declared here |
Event | function | Declared here |
Event | function | Declared here |
~Event | function | Declared here |
valid | function | Declared here |
name | function | Declared here |
time | function | Declared here |
setName | function | Declared here |
setTime | function | Declared here |
Message | function | Inherited from Message |
Message | function | Inherited from Message |
Message | function | Inherited from Message |
operator= | function | Inherited from Message |
~Message | function | Inherited from Message |
clone | function | Inherited from Message |
valid | function | Inherited from Message |
clear | function | Inherited from Message |
clearData | function | Inherited from Message |
clearNotes | function | Inherited from Message |
type | function | Inherited from Message |
id | function | Inherited from Message |
to | function | Inherited from Message |
from | function | Inherited from Message |
toUser | function | Inherited from Message |
toId | function | Inherited from Message |
fromUser | function | Inherited from Message |
fromId | function | Inherited from Message |
status | function | Inherited from Message |
setType | function | Inherited from Message |
setTo | function | Inherited from Message |
setTo | function | Inherited from Message |
setTo | function | Inherited from Message |
setFrom | function | Inherited from Message |
setFrom | function | Inherited from Message |
setFrom | function | Inherited from Message |
setStatus | function | Inherited from Message |
notes | function | Inherited from Message |
setNote | function | Inherited from Message |
addNote | function | Inherited from Message |
data | function | Inherited from Message |
data | function | Inherited from Message |
setData | function | Inherited from Message |
setData | function | Inherited from Message |
setData | function | Inherited from Message |
setData | function | Inherited from Message |
setData | function | Inherited from Message |
removeData | function | Inherited from Message |
hasData | function | Inherited from Message |
read | function | Inherited from Message |
read | function | Inherited from Message |
write | function | Inherited from Message |
isRequest | function | Inherited from Message |
size | function | Inherited from Message |
print | function | Inherited from Message |
className | function | Inherited from Message |
data | function | Inherited from Message |
hasData | function | Inherited from Message |
operator<< | friend | Inherited from IPacket |
opaque | variable | Inherited from IPacket |
info | variable | Inherited from IPacket |
flags | variable | Inherited from IPacket |
IPacket | function | Inherited from IPacket |
IPacket | function | Inherited from IPacket |
operator= | function | Inherited from IPacket |
clone | function | Inherited from IPacket |
~IPacket | function | Inherited from IPacket |
read | function | Inherited from IPacket |
write | function | Inherited from IPacket |
size | function | Inherited from IPacket |
hasData | function | Inherited from IPacket |
data | function | Inherited from IPacket |
constData | function | Inherited from IPacket |
className | function | Inherited from IPacket |
print | function | Inherited from IPacket |
Inherited from Message
| Kind | Name | Description |
|---|---|---|
function | Message | Constructs a new message with a random ID and type set to "message". |
function | Message | Constructs a message from a JSON value; sets missing id/type fields. |
function | Message | Copy constructor; preserves or generates id/type fields. |
function | operator= | Defaulted assignment operator. |
function | ~Message virtual | |
function | clone virtual const override | Returns a heap-allocated copy of this message. |
function | valid virtual const | Returns true if the message has both type and id fields. |
function | clear virtual | Clears all JSON fields from this message. |
function | clearData virtual | Clears the data sub-object. |
function | clearNotes virtual | Clears the notes array. |
function | type const | Returns the message type string (defaults to "message"). |
function | id const | Returns the message ID string. |
function | to const | Returns the recipient address parsed from the to field. |
function | from const | Returns the sender address parsed from the from field. |
function | toUser const | Returns the user component of the to address without constructing an Address. |
function | toId const | Returns the id component of the to address without constructing an Address. |
function | fromUser const | Returns the user component of the from address without constructing an Address. |
function | fromId const | Returns the id component of the from address without constructing an Address. |
function | status const | Returns the HTTP status code, or -1 if not set. |
function | setType | Sets the message type field. |
function | setTo | Sets the to field from a peer's address. |
function | setTo | Sets the to field from an address object. |
function | setTo | Sets the to field from an address string. |
function | setFrom | Sets the from field from a peer's address. |
function | setFrom | Sets the from field from an address object. |
function | setFrom | Sets the from field from an address string. |
function | setStatus | HTTP status codes are used to describe the message response. Throws std::invalid_argument if code is outside [101, 504]. |
function | notes | Returns a reference to the notes JSON array. |
function | setNote | Replaces all notes with a single note. |
function | addNote | Appends a note to the notes array. |
function | data const | Returns a copy of the named data field. |
function | data | Returns a reference to the named data field (creates it if absent). |
function | setData | Creates or replaces a named data field; returns a reference to it. |
function | setData | Sets a named data field to a C-string value. |
function | setData | Sets a named data field to a string value. |
function | setData | Sets a named data field to a JSON value. |
function | setData | Sets a named data field to an integer value. |
function | removeData | Removes a named field from the data sub-object. |
function | hasData | Returns true if the named field exists in the data sub-object. |
function | read virtual override | Deserialises the message from a raw buffer. |
function | read virtual | Deserialises the message from a JSON string. |
function | write virtual const override | Serialises the message as JSON into a buffer. |
function | isRequest const | Returns true if no status code has been set (i.e. status() == -1). |
function | size virtual const override | Returns the serialised JSON size in bytes. |
function | print virtual const override | Pretty-prints the message JSON to the given stream. |
function | className virtual const inline override | Returns the class name of this packet type for logging and diagnostics. |
function | data virtual const inline | The packet data pointer for buffered packets. |
function | hasData virtual const inline | Returns true if the packet has a non-null data pointer. |
Inherited from IPacket
| Kind | Name | Description |
|---|---|---|
friend | operator<< inline | Stream insertion operator; delegates to print(). |
variable | opaque | Optional type-safe context data. Use std::any_cast to retrieve. Lifetime of the stored value is tied to the packet's lifetime. |
variable | info | Optional extra information about the packet. |
variable | flags | Provides basic information about the packet. |
function | IPacket inline | |
function | IPacket inline | Copy constructor; clones the info object if present. |
function | operator= inline | Copy assignment; clones the info object if present. |
function | clone virtual const | Returns a heap-allocated deep copy of this packet. |
function | ~IPacket virtual | Defaulted destructor. |
function | read virtual | Read/parse to the packet from the given input buffer. The number of bytes read is returned. |
function | write virtual const | Copy/generate to the packet given output buffer. The number of bytes written can be obtained from the buffer. |
function | size virtual const inline | The size of the packet in bytes. |
function | hasData virtual const inline | Returns true if the packet has a non-null data pointer. |
function | data virtual const inline | The packet data pointer for buffered packets. |
function | constData virtual const inline | The const packet data pointer for buffered packets. |
function | className virtual const | Returns the class name of this packet type for logging and diagnostics. |
function | print virtual const inline | Prints a human-readable representation to the given stream. |
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()Defined in src/symple/include/icy/symple/event.h:33
Constructs an event with type "event" and time set to now.
Event
Event(const json::Value & root)Defined in src/symple/include/icy/symple/event.h:37
Constructs an event from a JSON value; sets missing time to now.
Parameters
rootJSON object to initialise from.
Event
Event(const Event & root)Defined in src/symple/include/icy/symple/event.h:41
Copy constructor; preserves or sets missing time to now.
Parameters
rootSource event.
valid
virtual const
virtual bool valid() constDefined in src/symple/include/icy/symple/event.h:46
Returns true if the base message is valid and the name field is set.
Reimplements
name
const
std::string name() constDefined in src/symple/include/icy/symple/event.h:49
Returns the event name string.
time
const
std::time_t time() constDefined in src/symple/include/icy/symple/event.h:53
Returns the event timestamp as a Unix time_t value.
setName
void setName(std::string_view name)Defined in src/symple/include/icy/symple/event.h:57
Sets the event name field.
Parameters
nameEvent name string.
setTime
void setTime(std::time_t time)Defined in src/symple/include/icy/symple/event.h:62
Sets the event timestamp.
Parameters
timeUnix timestamp (seconds since epoch).
