RTXI  3.0.0
The Real-Time eXperiment Interface Reference Manual
Data Structures | Public Member Functions
Event::Object Class Reference

#include <event.hpp>

Collaboration diagram for Event::Object:
Collaboration graph

Public Member Functions

 Object (Event::Type et)
 
 Object (const Object &obj)
 
Objectoperator= (const Object &obj)=delete
 
 Object (Object &&)=delete
 
Objectoperator= (Object &&)=delete
 
 ~Object ()=default
 
std::string getName ()
 
Event::Type getType () const
 
std::any getParam (const std::string &param_name) const
 
void setParam (const std::string &param_name, const std::any &param_value)
 
void wait ()
 
void done ()
 
bool isdone () const
 
bool paramExists (const std::string &param_name)
 

Detailed Description

Token used to signal event

This object is able to hold metadata information about the event for handlers to use. In order to properly use the token, the caller must wait for event manager to mark the event processed. The caller and event handler must agree on parameter names for successful communication, or else an exception is thrown. These parameters are stored with string values as identifiers, and the types of these parameters must be known ahead of time. Event handlers can potentially give a response through the same event token by storing the result under a new key. It is not the responsibility of the event object class to store failure states.

Definition at line 120 of file event.hpp.

Constructor & Destructor Documentation

◆ Object() [1/3]

Event::Object::Object(Event::Type et)
explicit

Definition at line 154 of file event.cpp.

◆ Object() [2/3]

Event::Object::Object(const Objectobj)

Definition at line 159 of file event.cpp.

◆ Object() [3/3]

Event::Object::Object(Object && )
delete

◆ ~Object()

Event::Object::~Object()
default

Member Function Documentation

◆ done()

void Event::Object::done()

Marks the event object as processed and successfully completed

NOTE: Event::Manager automatically handles calling this and should not be called directly by the user. Doing so will be an error and (hopefully) RTXI crashes. If not then good luck.

See also
Event::Manager::postEvent()

Definition at line 215 of file event.cpp.

◆ getName()

std::string Event::Object::getName()

Obtains the name of the event object that was emitted.

Returns
A string containing the name of event

Definition at line 165 of file event.cpp.

Here is the call graph for this function:

◆ getParam()

std::any Event::Object::getParam(const std::string & param_name)const

Retrieves the parameters values attached to the event

Parameters
NameThe parameter name for which to retrieve the value of event
Returns
The value connected with the input key

Definition at line 170 of file event.cpp.

◆ getType()

Event::Type Event::Object::getType()const

Returns the type of event that was emitted.

Returns
The type of event
See also
Event::Type

Definition at line 228 of file event.cpp.

◆ isdone()

bool Event::Object::isdone()const

Checks whether the event object has been processed already. Events that have true value for processed are also handled.

Returns
true if processed. False otherwise
See also
Event::Manager::postEvent()

Definition at line 223 of file event.cpp.

◆ operator=() [1/2]

Object& Event::Object::operator=(const Objectobj)
delete

◆ operator=() [2/2]

Object& Event::Object::operator=(Object && )
delete

◆ paramExists()

bool Event::Object::paramExists(const std::string & param_name)

Checks whether the given parameter key exists inside event token

Parameters
param_nameThe name of the parameter to search for
Returns
True if it exists, false otherwise.

Definition at line 180 of file event.cpp.

◆ setParam()

void Event::Object::setParam(const std::string & param_name,
const std::any & param_value 
)

Stores a key and value inside event object

Parameters
KeyThe name of the parameter to store inside event object
ValueThe value to store

Definition at line 191 of file event.cpp.

◆ wait()

void Event::Object::wait()

Forces caller to wait for the event to be processed.

This is needed for events that carry metadata information for the handlers. This function will block until the event is handled (marked done by handler) The wait function is automatically called by Event::Manager::postEvent() and any direct call to the wait function will result in blocking forever.

See also
Event::Object::done()
Event::Manager::postEvent()

Definition at line 207 of file event.cpp.


The documentation for this class was generated from the following files: