Odyssey::FSM< MixinT, KeyT, KeyArgT > Class Template Reference

A state machine represents an executable finite state machine. More...

#include <StateMachine.h>

List of all members.

Public Types

typedef State< MixinT > ConcreteState
 The type of the state being stored.
typedef boost::shared_ptr<
ConcreteState
StatePtr
 The type of the smart pointer used to hold the state instances.
typedef std::map< KeyT, StatePtrStateMap
 This is the map thay contains the States.
typedef MapContainerIterator<
StateMap
StateIterator
 This is the iterator over the States.
typedef ConstMapContainerIterator<
StateMap
ConstStateIterator
 This is the constant iterator over the States.

Public Member Functions

 FSM ()
 Instantiates a new, empty, state machine.
 ~FSM ()
void setCurrentState (KeyArgT key)
 Set the current state by name.
void setCurrentState ()
 Sets the current state to be NULL.
ConcreteStategetCurrentState () const
 Retrieve the current state of the machine.
void addState (KeyArgT key, StatePtr state)
 Add a state to the machine.
void removeState (KeyArgT key)
 Remove a state from the machine.
void clearStates ()
 Clear the states from the machine.
StateIterator getStateIterator ()
 Get an iterator over the state-name pairs.
ConstStateIterator getStateIterator () const
 Get a costant iterator over the state-name pairs.
ConcreteStateoperator * ()
ConcreteState const & operator * () const
ConcreteStateoperator-> ()
ConcreteState const * operator-> () const


Detailed Description

template<class MixinT, class KeyT = Odyssey::String, class KeyArgT = const KeyT&>
class Odyssey::FSM< MixinT, KeyT, KeyArgT >

A state machine represents an executable finite state machine.

This class represents a generic finite state machine that is intended to execute functionality based on its current state.


Member Typedef Documentation

template<class MixinT, class KeyT = Odyssey::String, class KeyArgT = const KeyT&>
typedef State<MixinT> Odyssey::FSM< MixinT, KeyT, KeyArgT >::ConcreteState
 

The type of the state being stored.

template<class MixinT, class KeyT = Odyssey::String, class KeyArgT = const KeyT&>
typedef ConstMapContainerIterator<StateMap> Odyssey::FSM< MixinT, KeyT, KeyArgT >::ConstStateIterator
 

This is the constant iterator over the States.

template<class MixinT, class KeyT = Odyssey::String, class KeyArgT = const KeyT&>
typedef MapContainerIterator<StateMap> Odyssey::FSM< MixinT, KeyT, KeyArgT >::StateIterator
 

This is the iterator over the States.

template<class MixinT, class KeyT = Odyssey::String, class KeyArgT = const KeyT&>
typedef std::map<KeyT,StatePtr> Odyssey::FSM< MixinT, KeyT, KeyArgT >::StateMap
 

This is the map thay contains the States.

template<class MixinT, class KeyT = Odyssey::String, class KeyArgT = const KeyT&>
typedef boost::shared_ptr<ConcreteState> Odyssey::FSM< MixinT, KeyT, KeyArgT >::StatePtr
 

The type of the smart pointer used to hold the state instances.


Constructor & Destructor Documentation

template<class MixinT, class KeyT = Odyssey::String, class KeyArgT = const KeyT&>
Odyssey::FSM< MixinT, KeyT, KeyArgT >::FSM  )  [inline]
 

Instantiates a new, empty, state machine.

template<class MixinT, class KeyT = Odyssey::String, class KeyArgT = const KeyT&>
Odyssey::FSM< MixinT, KeyT, KeyArgT >::~FSM  )  [inline]
 


Member Function Documentation

template<class MixinT, class KeyT = Odyssey::String, class KeyArgT = const KeyT&>
void Odyssey::FSM< MixinT, KeyT, KeyArgT >::addState KeyArgT  key,
StatePtr  state
[inline]
 

Add a state to the machine.

Add a named state to the machine. States may be shared between different machines, and may have different names in different machines.

Parameters:
key the name of the new state
state the new state to be added

template<class MixinT, class KeyT = Odyssey::String, class KeyArgT = const KeyT&>
void Odyssey::FSM< MixinT, KeyT, KeyArgT >::clearStates  )  [inline]
 

Clear the states from the machine.

template<class MixinT, class KeyT = Odyssey::String, class KeyArgT = const KeyT&>
ConcreteState* Odyssey::FSM< MixinT, KeyT, KeyArgT >::getCurrentState  )  const [inline]
 

Retrieve the current state of the machine.

template<class MixinT, class KeyT = Odyssey::String, class KeyArgT = const KeyT&>
ConstStateIterator Odyssey::FSM< MixinT, KeyT, KeyArgT >::getStateIterator  )  const [inline]
 

Get a costant iterator over the state-name pairs.

template<class MixinT, class KeyT = Odyssey::String, class KeyArgT = const KeyT&>
StateIterator Odyssey::FSM< MixinT, KeyT, KeyArgT >::getStateIterator  )  [inline]
 

Get an iterator over the state-name pairs.

template<class MixinT, class KeyT = Odyssey::String, class KeyArgT = const KeyT&>
ConcreteState const& Odyssey::FSM< MixinT, KeyT, KeyArgT >::operator *  )  const [inline]
 

template<class MixinT, class KeyT = Odyssey::String, class KeyArgT = const KeyT&>
ConcreteState& Odyssey::FSM< MixinT, KeyT, KeyArgT >::operator *  )  [inline]
 

template<class MixinT, class KeyT = Odyssey::String, class KeyArgT = const KeyT&>
ConcreteState const* Odyssey::FSM< MixinT, KeyT, KeyArgT >::operator->  )  const [inline]
 

template<class MixinT, class KeyT = Odyssey::String, class KeyArgT = const KeyT&>
ConcreteState* Odyssey::FSM< MixinT, KeyT, KeyArgT >::operator->  )  [inline]
 

template<class MixinT, class KeyT = Odyssey::String, class KeyArgT = const KeyT&>
void Odyssey::FSM< MixinT, KeyT, KeyArgT >::removeState KeyArgT  key  )  [inline]
 

Remove a state from the machine.

Removes a named state from the machine. If the state cannot be found this method has no effect.

Parameters:
key the name of the state to remove

template<class MixinT, class KeyT = Odyssey::String, class KeyArgT = const KeyT&>
void Odyssey::FSM< MixinT, KeyT, KeyArgT >::setCurrentState  )  [inline]
 

Sets the current state to be NULL.

template<class MixinT, class KeyT = Odyssey::String, class KeyArgT = const KeyT&>
void Odyssey::FSM< MixinT, KeyT, KeyArgT >::setCurrentState KeyArgT  key  )  [inline]
 

Set the current state by name.

This sets the current state using the registered state name. If no state with the given name is found this function has no effect.

Parameters:
name the name of the new current state


The documentation for this class was generated from the following file:
Generated on Sun Jan 7 01:18:53 2007 for Odyssey Meta-Engine by  doxygen 1.4.6-NO