sttcl  v0.9c
STTCL C++ template state machine framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sttcl::StateMachine< StateMachineImpl, IState > Class Template Reference

#include <StateMachine.h>

List of all members.

Classes

struct  StateMachineFlags

Public Types

typedef StateMachineImpl Context
typedef IState StateInterface
typedef StateBase
< StateMachineImpl, IState > 
StateBaseClass

Public Member Functions

 ~StateMachine ()
bool initialize (bool force=false)
void finalize (bool finalizeSubStateMachines=true)
bool isReady () const
bool isInitialized () const
bool isInitalizing () const
bool isFinalized () const
bool isFinalizing () const
StateBaseClass * getState () const
bool initializeImpl (bool force)
void finalizeImpl (bool finalizeSubStateMachines)
void subStateMachineCompleted (StateBaseClass *state)
void subStateMachineCompletedImpl (StateBaseClass *state)

Protected Member Functions

 StateMachine ()
void changeState (typename StateMachine< StateMachineImpl, IState >::StateBaseClass *newState)
void setState (StateBaseClass *newState)
StateBaseClass * getInitialState () const
StateBaseClass * getInitialStateImpl () const
bool isReadyImpl () const
void exitCurrentState ()
void enterNewState ()

Friends

class StateBase< StateMachineImpl, IState >

Detailed Description

template<class StateMachineImpl, class IState>
class sttcl::StateMachine< StateMachineImpl, IState >

Represents the base class for a state machine.

Template Parameters:
StateMachineImplSpecifies the class implementing the state machine.
IStateSpecifies the internal interface of state implementations for the state machine.

Member Typedef Documentation

template<class StateMachineImpl, class IState>
typedef StateBase<StateMachineImpl,IState> sttcl::StateMachine< StateMachineImpl, IState >::StateBaseClass

Constructor & Destructor Documentation

template<class StateMachineImpl, class IState>
sttcl::StateMachine< StateMachineImpl, IState >::~StateMachine ( )
inline

Destructor for class StateMachine.

template<class StateMachineImpl, class IState>
sttcl::StateMachine< StateMachineImpl, IState >::StateMachine ( )
inlineprotected

Constructor for class StateMachine.


Member Function Documentation

template<class StateMachineImpl, class IState>
void sttcl::StateMachine< StateMachineImpl, IState >::changeState ( typename StateMachine< StateMachineImpl, IState >::StateBaseClass *  newState)
protected

Changes the state machines current state.

Parameters:
newStateThe new target state.
template<class StateMachineImpl , class IState >
void sttcl::StateMachine< StateMachineImpl, IState >::enterNewState ( )
protected
template<class StateMachineImpl , class IState >
void sttcl::StateMachine< StateMachineImpl, IState >::exitCurrentState ( )
protected
template<class StateMachineImpl, class IState>
void sttcl::StateMachine< StateMachineImpl, IState >::finalize ( bool  finalizeSubStateMachines = true)
inline

Finalizes the state machine.

Parameters:
finalizeSubStateMachinesIndicates to finalize any sub state machines.
template<class StateMachineImpl, class IState>
StateBaseClass* sttcl::StateMachine< StateMachineImpl, IState >::getInitialState ( ) const
inlineprotected

Gets the initial state of the state machine.

Returns:
The initial state of the state machine.
template<class StateMachineImpl, class IState>
StateBaseClass* sttcl::StateMachine< StateMachineImpl, IState >::getInitialStateImpl ( ) const
inlineprotected

Default implementation for getInitialState().

Returns:
The initial state of the state machine.
template<class StateMachineImpl, class IState>
StateBaseClass* sttcl::StateMachine< StateMachineImpl, IState >::getState ( ) const
inline

Gets the current state.

Returns:
The current state.
template<class StateMachineImpl, class IState>
bool sttcl::StateMachine< StateMachineImpl, IState >::initialize ( bool  force = false)
inline

Initializes the state machine.

Parameters:
forceIndicates to finalize the state machine before (re-)initializing.
Returns:
The ready state of the state machine.
template<class StateMachineImpl, class IState>
bool sttcl::StateMachine< StateMachineImpl, IState >::isFinalized ( ) const
inline

Indicates that the state machine is finalized.

Returns:
true if the state machine is finalized, false otherwise.
template<class StateMachineImpl, class IState>
bool sttcl::StateMachine< StateMachineImpl, IState >::isFinalizing ( ) const
inline

Indicates that the state machine is currently finalizing.

Returns:
true if the state machine is currently finalizing, false otherwise.
template<class StateMachineImpl, class IState>
bool sttcl::StateMachine< StateMachineImpl, IState >::isInitalizing ( ) const
inline

Indicates that the state machine is currently initializing.

Returns:
true if the state machine is currently initializing, false otherwise.
template<class StateMachineImpl, class IState>
bool sttcl::StateMachine< StateMachineImpl, IState >::isInitialized ( ) const
inline

Indicates that the state machine is initialized.

Returns:
true if the state machine is initialized, false otherwise.
template<class StateMachineImpl, class IState>
bool sttcl::StateMachine< StateMachineImpl, IState >::isReady ( ) const
inline

Indicates that the state machine is ready to process events.

Returns:
true if the state machine is ready to process events, false otherwise.
template<class StateMachineImpl, class IState>
bool sttcl::StateMachine< StateMachineImpl, IState >::isReadyImpl ( ) const
inlineprotected

Default implementation for isReady().

Returns:
true if the state machine is ready to process events, false otherwise.
template<class StateMachineImpl, class IState>
void sttcl::StateMachine< StateMachineImpl, IState >::setState ( StateBaseClass *  newState)
inlineprotected

Sets the state machines current state without calling any state operations.

Parameters:
newState
template<class StateMachineImpl, class IState>
void sttcl::StateMachine< StateMachineImpl, IState >::subStateMachineCompleted ( StateBaseClass *  state)
inline

Called by a contained (composite) state when its sub state machine is completed (finalized).

Parameters:
stateA pointer to the contained (composite) state.
template<class StateMachineImpl, class IState>
void sttcl::StateMachine< StateMachineImpl, IState >::subStateMachineCompletedImpl ( StateBaseClass *  state)
inline

The default implementation of the subStateMachineCompleted method.

Parameters:
stateA pointer to the contained (composite) state.

Friends And Related Function Documentation

template<class StateMachineImpl, class IState>
friend class StateBase< StateMachineImpl, IState >
friend

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