Home
Symple module

Event

Symple event message carrying a named occurrence with a timestamp.

Event

#include <icy/symple/event.h>
class Event

Defined 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

NameKindOwner
EventfunctionDeclared here
EventfunctionDeclared here
EventfunctionDeclared here
~EventfunctionDeclared here
validfunctionDeclared here
namefunctionDeclared here
timefunctionDeclared here
setNamefunctionDeclared here
setTimefunctionDeclared here
MessagefunctionInherited from Message
MessagefunctionInherited from Message
MessagefunctionInherited from Message
operator=functionInherited from Message
~MessagefunctionInherited from Message
clonefunctionInherited from Message
validfunctionInherited from Message
clearfunctionInherited from Message
clearDatafunctionInherited from Message
clearNotesfunctionInherited from Message
typefunctionInherited from Message
idfunctionInherited from Message
tofunctionInherited from Message
fromfunctionInherited from Message
toUserfunctionInherited from Message
toIdfunctionInherited from Message
fromUserfunctionInherited from Message
fromIdfunctionInherited from Message
statusfunctionInherited from Message
setTypefunctionInherited from Message
setTofunctionInherited from Message
setTofunctionInherited from Message
setTofunctionInherited from Message
setFromfunctionInherited from Message
setFromfunctionInherited from Message
setFromfunctionInherited from Message
setStatusfunctionInherited from Message
notesfunctionInherited from Message
setNotefunctionInherited from Message
addNotefunctionInherited from Message
datafunctionInherited from Message
datafunctionInherited from Message
setDatafunctionInherited from Message
setDatafunctionInherited from Message
setDatafunctionInherited from Message
setDatafunctionInherited from Message
setDatafunctionInherited from Message
removeDatafunctionInherited from Message
hasDatafunctionInherited from Message
readfunctionInherited from Message
readfunctionInherited from Message
writefunctionInherited from Message
isRequestfunctionInherited from Message
sizefunctionInherited from Message
printfunctionInherited from Message
classNamefunctionInherited from Message
datafunctionInherited from Message
hasDatafunctionInherited from Message
operator<<friendInherited from IPacket
opaquevariableInherited from IPacket
infovariableInherited from IPacket
flagsvariableInherited from IPacket
IPacketfunctionInherited from IPacket
IPacketfunctionInherited from IPacket
operator=functionInherited from IPacket
clonefunctionInherited from IPacket
~IPacketfunctionInherited from IPacket
readfunctionInherited from IPacket
writefunctionInherited from IPacket
sizefunctionInherited from IPacket
hasDatafunctionInherited from IPacket
datafunctionInherited from IPacket
constDatafunctionInherited from IPacket
classNamefunctionInherited from IPacket
printfunctionInherited from IPacket

Inherited from Message

KindNameDescription
functionMessageConstructs a new message with a random ID and type set to "message".
functionMessageConstructs a message from a JSON value; sets missing id/type fields.
functionMessageCopy constructor; preserves or generates id/type fields.
functionoperator=Defaulted assignment operator.
function~Message virtual
functionclone virtual const overrideReturns a heap-allocated copy of this message.
functionvalid virtual constReturns true if the message has both type and id fields.
functionclear virtualClears all JSON fields from this message.
functionclearData virtualClears the data sub-object.
functionclearNotes virtualClears the notes array.
functiontype constReturns the message type string (defaults to "message").
functionid constReturns the message ID string.
functionto constReturns the recipient address parsed from the to field.
functionfrom constReturns the sender address parsed from the from field.
functiontoUser constReturns the user component of the to address without constructing an Address.
functiontoId constReturns the id component of the to address without constructing an Address.
functionfromUser constReturns the user component of the from address without constructing an Address.
functionfromId constReturns the id component of the from address without constructing an Address.
functionstatus constReturns the HTTP status code, or -1 if not set.
functionsetTypeSets the message type field.
functionsetToSets the to field from a peer's address.
functionsetToSets the to field from an address object.
functionsetToSets the to field from an address string.
functionsetFromSets the from field from a peer's address.
functionsetFromSets the from field from an address object.
functionsetFromSets the from field from an address string.
functionsetStatusHTTP status codes are used to describe the message response. Throws std::invalid_argument if code is outside [101, 504].
functionnotesReturns a reference to the notes JSON array.
functionsetNoteReplaces all notes with a single note.
functionaddNoteAppends a note to the notes array.
functiondata constReturns a copy of the named data field.
functiondataReturns a reference to the named data field (creates it if absent).
functionsetDataCreates or replaces a named data field; returns a reference to it.
functionsetDataSets a named data field to a C-string value.
functionsetDataSets a named data field to a string value.
functionsetDataSets a named data field to a JSON value.
functionsetDataSets a named data field to an integer value.
functionremoveDataRemoves a named field from the data sub-object.
functionhasDataReturns true if the named field exists in the data sub-object.
functionread virtual overrideDeserialises the message from a raw buffer.
functionread virtualDeserialises the message from a JSON string.
functionwrite virtual const overrideSerialises the message as JSON into a buffer.
functionisRequest constReturns true if no status code has been set (i.e. status() == -1).
functionsize virtual const overrideReturns the serialised JSON size in bytes.
functionprint virtual const overridePretty-prints the message JSON to the given stream.
functionclassName virtual const inline overrideReturns the class name of this packet type for logging and diagnostics.
functiondata virtual const inlineThe packet data pointer for buffered packets.
functionhasData virtual const inlineReturns true if the packet has a non-null data pointer.

Inherited from IPacket

KindNameDescription
friendoperator<< inlineStream insertion operator; delegates to print().
variableopaqueOptional type-safe context data. Use std::any_cast to retrieve. Lifetime of the stored value is tied to the packet's lifetime.
variableinfoOptional extra information about the packet.
variableflagsProvides basic information about the packet.
functionIPacket inline
functionIPacket inlineCopy constructor; clones the info object if present.
functionoperator= inlineCopy assignment; clones the info object if present.
functionclone virtual constReturns a heap-allocated deep copy of this packet.
function~IPacket virtualDefaulted destructor.
functionread virtualRead/parse to the packet from the given input buffer. The number of bytes read is returned.
functionwrite virtual constCopy/generate to the packet given output buffer. The number of bytes written can be obtained from the buffer.
functionsize virtual const inlineThe size of the packet in bytes.
functionhasData virtual const inlineReturns true if the packet has a non-null data pointer.
functiondata virtual const inlineThe packet data pointer for buffered packets.
functionconstData virtual const inlineThe const packet data pointer for buffered packets.
functionclassName virtual constReturns the class name of this packet type for logging and diagnostics.
functionprint virtual const inlinePrints a human-readable representation to the given stream.

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()

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

  • root JSON 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

  • root Source event.

valid

virtual const

virtual bool valid() const

Defined 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() const

Defined in src/symple/include/icy/symple/event.h:49

Returns the event name string.


time

const

std::time_t time() const

Defined 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

  • name Event name string.

setTime

void setTime(std::time_t time)

Defined in src/symple/include/icy/symple/event.h:62

Sets the event timestamp.

Parameters

  • time Unix timestamp (seconds since epoch).