rad 6.2.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.
scxml4cpp::Event::Event | ( | ) |
Creates a default event object with
scxml4cpp::Event::Event | ( | const std::string & | id, |
const EventType | type ) |
scxml4cpp::Event::Event | ( | const Event & | e | ) |
Copy constructor.
|
virtual |
Destroy an event object.
This destructor does not deallocate memory.
const std::string & scxml4cpp::Event::getId | ( | ) | const |
void * scxml4cpp::Event::getPayload | ( | ) | const |
const Event::EventStatus scxml4cpp::Event::getStatus | ( | ) | const |
const Event::EventType scxml4cpp::Event::getType | ( | ) | const |
bool scxml4cpp::Event::isNull | ( | ) | const |
Checks whether an event is NULL. A NULL event is an event with empty identifier.
void scxml4cpp::Event::setId | ( | const std::string & | id | ) |
Set the event identifier.
id | Event identifier. |
void scxml4cpp::Event::setPayload | ( | void * | payload | ) |
Set the pointer to an event payload.
payload | Pointer to a payload. |
void scxml4cpp::Event::setStatus | ( | const EventStatus | status | ) |
Set the event status.
status | Event status: whether the event has been processed or not. |
void scxml4cpp::Event::setType | ( | const EventType | type | ) |
Set the event type.
type | Event type. |