RTXI 3.0.0 The Real-Time eXperiment Interface Reference Manual |
#include <event.hpp>
Public Member Functions | |
Object (Event::Type et) | |
Object (const Object &obj) | |
Object & | operator= (const Object &obj)=delete |
Object (Object &&)=delete | |
Object & | operator= (Object &&)=delete |
~Object ()=default | |
std::string | getName () |
Event::Type | getType () const |
std::any | getParam (const std::string ¶m_name) const |
void | setParam (const std::string ¶m_name, const std::any ¶m_value) |
void | wait () |
void | done () |
bool | isdone () const |
bool | paramExists (const std::string ¶m_name) |
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.
| explicit |
| delete |
| default |
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.
std::string Event::Object::getName | ( | ) |
std::any Event::Object::getParam | ( | const std::string & | param_name | ) | const |
Event::Type Event::Object::getType | ( | ) | const |
bool Event::Object::isdone | ( | ) | const |
Checks whether the event object has been processed already. Events that have true value for processed are also handled.
bool Event::Object::paramExists | ( | const std::string & | param_name | ) |
void Event::Object::setParam | ( | const std::string & | param_name, |
const std::any & | param_value | ||
) |
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.