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

#include <State.h>

Inheritance diagram for scxml4cpp::State:
scxml4cpp::StateHistory

Public Types

enum  StateType { Atomic = 0 , Compound , Parallel , History }
 

Public Member Functions

 State (const std::string &id, const StateType type)
 
virtual ~State ()
 
std::string getId () const
 
StateType getType () const
 
StategetParent ()
 
StateHistorygetHistory ()
 
ExecutableContentgetEntryActions ()
 
ExecutableContentgetExitActions ()
 
std::list< Transition * > & getInitialTrans ()
 
StategetInitialState ()
 
std::list< State * > & getSubstates ()
 
std::list< Transition * > & getTransitions ()
 
std::list< Activity * > & getActivities ()
 
void setId (const std::string &id)
 
void setType (const StateType type)
 
void setParent (State *parent)
 
void setIsInitial (const bool isInitial)
 
void setIsFinal (const bool isFinal)
 
void setHistory (StateHistory *h)
 
void setInitialState (State *initialState, Action *a)
 
void setFinalState (State *finalState)
 
void setSubstates (std::list< State * > &substates)
 
void setTransitions (std::list< Transition * > &transitions)
 
void setActivities (std::list< Activity * > &activities)
 
bool isInitial ()
 
bool isFinal ()
 
bool isCompound ()
 
bool isParallel ()
 
bool isAtomic ()
 
bool isHistory ()
 
void startActivities (Context *c)
 
void cancelActivities (Context *c)
 
void addEntryAction (Action *a)
 
void addExitAction (Action *a)
 
void addSubstate (State *s)
 
void addTransition (std::list< State * > &targets, const Event &event, Action *condition, Action *action)
 
void addTransition (State *target, const Event &event, Action *condition, Action *action)
 
void addActivity (Activity *activity)
 
void delTransitions ()
 
void delInitialTrans ()
 
void delSubstates ()
 

Detailed Description

This class is the base class for the different types of SCXML states:

Member Enumeration Documentation

◆ StateType

Enumerator
Atomic 
Compound 

A state that has no sub-states.

Parallel 

A state that can have sub-states.

History 

A state that can have active concurrently sub-states.

A pseudo-state that points to state entered in the past.

Constructor & Destructor Documentation

◆ State()

scxml4cpp::State::State ( const std::string & id,
const StateType type )

Constructor for the State object. It allocates memory for:

◆ ~State()

scxml4cpp::State::~State ( )
virtual

Destructor for the State object. It releases the memory for:

  • entry ExecutableContent (entry actions) allocated in the constructor.
  • exit ExecutableContent (exit actions) allocated in the constructor.
  • any added sub-state
  • any added transition
  • any added initial transition

Member Function Documentation

◆ addActivity()

void scxml4cpp::State::addActivity ( Activity * activity)

Add a do-activity to the list of activities to be started when entering this state and stopped when exiting this state.

Parameters
activityActivity to be added.

◆ addEntryAction()

void scxml4cpp::State::addEntryAction ( Action * a)

Add an entry action to what has to be executed (ExecutableContent) when entering this state.

Parameters
aEntry action to be added.

◆ addExitAction()

void scxml4cpp::State::addExitAction ( Action * a)

Add an exit action to what has to be executed (ExecutableContent) when exiting this state.

Parameters
aExit action to be added.

◆ addSubstate()

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

Add a sub-state.

Parameters
sState to be added.

◆ addTransition() [1/2]

void scxml4cpp::State::addTransition ( State * target,
const Event & event,
Action * condition,
Action * action )

Add a transition that has this state as source. This method allocates memory which is released by the destructor/delTransitions() methods.

Parameters
targetsTarget state of the transition. If the pointer is NULL the transition is considered as internal transition (i.e. a transition that does not trigger any change of state).
eventEvent triggering the transition. The event can be a NULL event, in this case the transition it taken immediately after entering the state assuming the condition (guard) is satisfied.
conditionOptional guard to be satisfied for the transition to be taken. By passing NULL, no condition is evaluated.
actionOptional action to be executed when the transition is taken. By passing NULL, no action is evaluated.

◆ addTransition() [2/2]

void scxml4cpp::State::addTransition ( std::list< State * > & targets,
const Event & event,
Action * condition,
Action * action )

Add a transition that has this state as source. This method allocates memory which is released by the destructor/delTransitions() methods.

Parameters
targetsOne or more target state of the transition. If the list is empty the transition is considered as internal transition (i.e. a transition that does not trigger any change of state).
eventEvent triggering the transition. The event can be a NULL event, in this case the transition it taken immediately after entering the state assuming the condition (guard) is satisfied.
conditionOptional guard to be satisfied for the transition to be taken. By passing NULL, no condition is evaluated.
actionOptional action to be executed when the transition is taken. By passing NULL, no action is evaluated.

◆ cancelActivities()

void scxml4cpp::State::cancelActivities ( Context * c)

Terminates the do-activities associated to this state.

Parameters
cContext passed to the do-activities when stopped.

◆ delInitialTrans()

void scxml4cpp::State::delInitialTrans ( )

Deletes all added Initial Transitions.

◆ delSubstates()

void scxml4cpp::State::delSubstates ( )

Deletes all added sub-states.

◆ delTransitions()

void scxml4cpp::State::delTransitions ( )

Deletes all added Transitions.

◆ getActivities()

std::list< Activity * > & scxml4cpp::State::getActivities ( )
Returns
The list of do-activities (invoke) if available.

◆ getEntryActions()

ExecutableContent * scxml4cpp::State::getEntryActions ( )
Returns
The entry actions.

◆ getExitActions()

ExecutableContent * scxml4cpp::State::getExitActions ( )
Returns
The exit actions.

◆ getHistory()

StateHistory * scxml4cpp::State::getHistory ( )
Returns
The history info if available, NULL otherwise.

◆ getId()

std::string scxml4cpp::State::getId ( ) const
Returns
The state identifier.

◆ getInitialState()

State * scxml4cpp::State::getInitialState ( )
Returns
The initial state if available. The initial state may be available only in case of compound states.

◆ getInitialTrans()

std::list< Transition * > & scxml4cpp::State::getInitialTrans ( )
Returns
The initial transitions.

◆ getParent()

State * scxml4cpp::State::getParent ( )
Returns
The parent state or NULL if this state is a top state.

◆ getSubstates()

std::list< State * > & scxml4cpp::State::getSubstates ( )
Returns
The list of sub-states.

◆ getTransitions()

std::list< Transition * > & scxml4cpp::State::getTransitions ( )
Returns
The list of transitions that have this state as source state.

◆ getType()

State::StateType scxml4cpp::State::getType ( ) const
Returns
The type of state.

◆ isAtomic()

bool scxml4cpp::State::isAtomic ( )
Returns
true if this is an Atomic state, false otherwise.

◆ isCompound()

bool scxml4cpp::State::isCompound ( )
Returns
true if this is a Compound state, false otherwise.

◆ isFinal()

bool scxml4cpp::State::isFinal ( )
Returns
true if this is an final state, false otherwise.

◆ isHistory()

bool scxml4cpp::State::isHistory ( )
Returns
true if this is a History state, false otherwise.

◆ isInitial()

bool scxml4cpp::State::isInitial ( )
Returns
true if this is an initial state, false otherwise.

◆ isParallel()

bool scxml4cpp::State::isParallel ( )
Returns
true if this is a Parallel state, false otherwise.

◆ setActivities()

void scxml4cpp::State::setActivities ( std::list< Activity * > & activities)

Set all do-activities for this state.

Parameters
activitiesActivities started/stopped when entering/exiting this state.

◆ setFinalState()

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

Set the final state.

Parameters
finalStateSub-state to enter when this Compound state is entered.

◆ setHistory()

void scxml4cpp::State::setHistory ( StateHistory * h)

Set history information. TODO check whether this pointer needs to be released by the destructor.

Parameters
hHistory information.

◆ setId()

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

Set the state identifier.

Parameters
idState identifier.

◆ setInitialState()

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

Creates an initial transition that is taken when entering this (Compound) state. This method allocates the memory for the initial transition which is released by the destructor/delInitialTrans() methods.

Parameters
initialStateSub-state to enter when this Compound state is entered.
aAction to be executed when transitioning to the initial state.

◆ setIsFinal()

void scxml4cpp::State::setIsFinal ( const bool isFinal)

Set whether the state is final or not.

Parameters
isFinalFlag indicating whether this state is final or not.

◆ setIsInitial()

void scxml4cpp::State::setIsInitial ( const bool isInitial)

Set whether the state is initial or not.

Parameters
isInitialFlag indicating whether this state is initial or not.

◆ setParent()

void scxml4cpp::State::setParent ( State * parent)

Set the parent state.

Parameters
parentParent state of this state.

◆ setSubstates()

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

Set all sub-states of this state.

Parameters
substatesSub-states to be added.

◆ setTransitions()

void scxml4cpp::State::setTransitions ( std::list< Transition * > & transitions)

Set all transitions that have this state as source state.

Parameters
transitionsOutgoing transitions from this state.

◆ setType()

void scxml4cpp::State::setType ( const StateType type)

Set the state type.

This method allows to chnage the type of state. It is used for example by the Merger class when an Atomic state is extended with sub-state(s), see EICSSW-2674.

Parameters
typeState identifier.

◆ startActivities()

void scxml4cpp::State::startActivities ( Context * c)

Starts the do-activities associated to this state.

Parameters
cContext passed to the do-activities when started.

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