rad 6.2.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
scxml4cpp::Event Class Reference

#include <Event.h>

Inheritance diagram for scxml4cpp::Event:
rad::SMEvent

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

Detailed Description

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.

Member Enumeration Documentation

◆ EventStatus

Current status of the event.

Enumerator
TOBEPROCESSED 
PROCESSED 
IGNORED 
REJECTED 
DEFERRED 

◆ EventType

Type of event.

Enumerator
CALL_EVENT 
CHANGE_EVENT 
SIGNAL_EVENT 
TIME_EVENT 
ERROR_EVENT 

Constructor & Destructor Documentation

◆ Event() [1/3]

scxml4cpp::Event::Event ( )

Creates a default event object with

  • empty identifier
  • of type CHANGE_EVENT
  • of status TOBEPROCESSED
  • with NULL payload

◆ Event() [2/3]

scxml4cpp::Event::Event ( const std::string & id,
const EventType type )

Creates an event object using the given parameters.

Parameters
idEvent identifier.
typeEvent type.

Status is initialized to TOBEPROCESSED and the payload to NULL.

◆ Event() [3/3]

scxml4cpp::Event::Event ( const Event & e)

Copy constructor.

◆ ~Event()

scxml4cpp::Event::~Event ( )
virtual

Destroy an event object.

This destructor does not deallocate memory.

Member Function Documentation

◆ getId()

const std::string & scxml4cpp::Event::getId ( ) const
Returns
The event identifier.

◆ getPayload()

void * scxml4cpp::Event::getPayload ( ) const
Returns
A pointer to a payload.

◆ getStatus()

const Event::EventStatus scxml4cpp::Event::getStatus ( ) const
Returns
Whether the event has been processed or not.

◆ getType()

const Event::EventType scxml4cpp::Event::getType ( ) const
Returns
The type of event.

◆ isNull()

bool scxml4cpp::Event::isNull ( ) const

Checks whether an event is NULL. A NULL event is an event with empty identifier.

Returns
true if the event is a NULL event, false otherwise.

◆ operator=()

Event & scxml4cpp::Event::operator= ( const Event & e)

Assignment operator.

◆ setId()

void scxml4cpp::Event::setId ( const std::string & id)

Set the event identifier.

Parameters
idEvent identifier.

◆ setPayload()

void scxml4cpp::Event::setPayload ( void * payload)

Set the pointer to an event payload.

Parameters
payloadPointer to a payload.

◆ setStatus()

void scxml4cpp::Event::setStatus ( const EventStatus status)

Set the event status.

Parameters
statusEvent status: whether the event has been processed or not.

◆ setType()

void scxml4cpp::Event::setType ( const EventType type)

Set the event type.

Parameters
typeEvent type.

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