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

#include <StateMachine.h>

Public Member Functions

 StateMachine ()
 
virtual ~StateMachine ()
 
const std::string & getId () const
 
std::list< Transition * > & getInitialTrans ()
 
std::list< State * > & getSubstates ()
 
std::list< State * > & getParallel ()
 
void setId (const std::string &id)
 
void setInitialState (State *initialState, Action *a)
 
void setFinalState (State *finalState)
 
void setSubstates (std::list< State * > &substates)
 
void setParallel (std::list< State * > &parallel)
 
void addSubstate (State *s)
 
void addParallel (State *s)
 
void reset ()
 
bool isEmpty ()
 

Detailed Description

This class represents an in-memory SCXML State Machine document. Its methods allow to add states (of any type) and create initial transitions.

The client is responsible to allocate the memory for the states to be added. The memory is released by the StateMachine destructor or by calling the reset() method.

An SCXML parser can be used to read an SCXML document from file, allocate the states and transition and add them to a StateMachine object. An SCXML interpreter can be used to execute the State Machine object.

Constructor & Destructor Documentation

◆ StateMachine()

scxml4cpp::StateMachine::StateMachine ( )

Default constructor.

◆ ~StateMachine()

scxml4cpp::StateMachine::~StateMachine ( )
virtual

This destructor releases the memory allocated for:

  • the created initial transitions
  • the added/set states including sub-states.

Member Function Documentation

◆ addParallel()

void scxml4cpp::StateMachine::addParallel ( State * s)

Add a root parallel state to this State Machine.

Parameters
sState to be added.

◆ addSubstate()

void scxml4cpp::StateMachine::addSubstate ( State * s)

Add a root substate to this State Machine.

Parameters
sState to be added.

◆ getId()

const std::string & scxml4cpp::StateMachine::getId ( ) const
Returns
the State Machine identifier.

◆ getInitialTrans()

std::list< Transition * > & scxml4cpp::StateMachine::getInitialTrans ( )
Returns
the list of initial transitions from the initial pseudo-state(s) to the starting state(s).

◆ getParallel()

std::list< State * > & scxml4cpp::StateMachine::getParallel ( )
Returns
the list of parallel states for this State Machine.

◆ getSubstates()

std::list< State * > & scxml4cpp::StateMachine::getSubstates ( )
Returns
the list of root states for this State Machine.

◆ isEmpty()

bool scxml4cpp::StateMachine::isEmpty ( )

Check whether a State Machine is empty.

Returns
true The State Machine is empty (no states nor transitions), false otherwise.

◆ reset()

void scxml4cpp::StateMachine::reset ( )

This method releases the memory allocated for:

  • the created initial transitions
  • the added/set states including sub-states. After this method is executed, the State Machine is empty.

◆ setFinalState()

void scxml4cpp::StateMachine::setFinalState ( State * finalState)

Set the state in which the execution of the State Machine is terminated.

Parameters
finalStateState in which the execution is terminated.

◆ setId()

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

Set the State Machine identifier.

Parameters
idState Machine identifier.

◆ setInitialState()

void scxml4cpp::StateMachine::setInitialState ( State * initialState,
Action * a )

This method creates an initial transition which is evaluated when starting the execution of the StateMachine. This method allocates the memory required to create a Transition.

Parameters
initialStateState from which to start the execution.
aAction to be executed before entering the initialState.

◆ setParallel()

void scxml4cpp::StateMachine::setParallel ( std::list< State * > & parallel)

Set the root parallel states of the State Machine.

Parameters
parallelList of root parallel states for this State Machine.

◆ setSubstates()

void scxml4cpp::StateMachine::setSubstates ( std::list< State * > & substates)

Set the root substates of the State Machine.

Parameters
substatesList of root states for this State Machine.

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