rad
5.1.0
|
#include <Event.h>
Public Types | |
enum | EventType { CALL_EVENT = 0 , CHANGE_EVENT , SIGNAL_EVENT , TIME_EVENT , ERROR_EVENT } |
enum | EventStatus { TOBEPROCESSED = 0 , PROCESSED , IGNORED , REJECTED , DEFERRED } |
Public Member Functions | |
Event () | |
Event (const std::string &id, const EventType type) | |
Event (const Event &e) | |
Event & | operator= (const Event &e) |
virtual | ~Event () |
const std::string & | getId () const |
const EventType | getType () const |
const EventStatus | getStatus () const |
void * | getPayload () const |
void | setId (const std::string &id) |
void | setType (const EventType type) |
void | setStatus (const EventStatus status) |
void | setPayload (void *payload) |
bool | isNull () const |
This class represents an event processed by the State Machine interpreter.
Events can trigger transitions and therefore change of state.
This implementation leaves the possibility to define an event type which is borrowed from UML (Call, Change, Signal, Time, Error).
The type (mType) is used, together with the identifier (mId) to match an event in a transition (e.g. if the event identifier is identical but the type is different, it is considered a different event).
The class provides also the possibility to define whether the event has been processed, ignored, rejected, deferred, or still to be handled via the status attribute.
TODO payload should have type shared_ptr.
Event::Event | ( | ) |
Creates a default event object with
Event::Event | ( | const std::string & | id, |
const EventType | type | ||
) |
Event::Event | ( | const Event & | e | ) |
Copy constructor.
|
virtual |
Destroy an event object.
This destructor does not deallocate memory.
const std::string & Event::getId | ( | ) | const |
void * Event::getPayload | ( | ) | const |
const Event::EventStatus Event::getStatus | ( | ) | const |
const Event::EventType Event::getType | ( | ) | const |
bool Event::isNull | ( | ) | const |
Checks whether an event is NULL. A NULL event is an event with empty identifier.
void Event::setId | ( | const std::string & | id | ) |
Set the event identifier.
id | Event identifier. |
void Event::setPayload | ( | void * | payload | ) |
Set the pointer to an event payload.
payload | Pointer to a payload. |
void Event::setStatus | ( | const EventStatus | status | ) |
Set the event status.
status | Event status: whether the event has been processed or not. |