ApparatusFramework::State Class Reference
[Pattern Services]

#include <PatternServices/current/include/State.h>

List of all members.

Public Member Functions

 State (const unsigned int stateID, const char *pName, const unsigned int parentStateID, StateMachine *pOwner)
virtual ~State ()

Protected Member Functions

virtual void onEntry ()=0
virtual void onEvent (Msg *pMsg)=0
virtual void onExit ()=0
const char * getName () const
StateMachinegetOwner () const
const unsigned int getStateID () const
const unsigned int getParentStateID () const
void nextState (const unsigned int stateID)

Friends

class StateMachine

Detailed Description

The class state implements the basic state for all states used in state machines. The state class can be user defined inherited. Therefore, hierarchical state machines can be realized. The user of the class state has to inherit from it and must implement the methods onEntry, onEvent and onExit.

Definition at line 59 of file State.h.


Constructor & Destructor Documentation

ApparatusFramework::State::State ( const unsigned int  stateID,
const char *  pName,
const unsigned int  parentStateID,
StateMachine pOwner 
)

constructors, destructors Constructs a new state object. stateID The identification of the state. This ID has to be unique and less than the max number of defined states. Note: It is not allowed to use 0 as state ID. pName The name of the state. parentStateID The identification of the parent state. 0 indicates that the state has no parents state. pOwner The state machine, which owns the state.

virtual ApparatusFramework::State::~State (  )  [virtual]

Destroys a state object and releases all the associated resources.


Member Function Documentation

const char* ApparatusFramework::State::getName (  )  const [protected]

This method returns the name of the state.

Returns:
The name of the state.
StateMachine* ApparatusFramework::State::getOwner (  )  const [protected]

This method returns the pointer of the owner (state machine) from the state.

Returns:
Pointer to the owner (state machine).
const unsigned int ApparatusFramework::State::getParentStateID (  )  const [protected]

This method returns the identification of the parent state.

Returns:
The ID of the parent state.
const unsigned int ApparatusFramework::State::getStateID (  )  const [protected]

This method returns the identification of the state.

Returns:
The ID of the state.
void ApparatusFramework::State::nextState ( const unsigned int  stateID  )  [protected]

This method sets the state machine inside the next state.

Parameters:
stateID The ID of the next state.
virtual void ApparatusFramework::State::onEntry (  )  [protected, pure virtual]

modifiers This method is automatically executed when the state machine enters inside the state. Every inherited class of the class state has to implement this method.

virtual void ApparatusFramework::State::onEvent ( Msg pMsg  )  [protected, pure virtual]

This method is automatically executed when the state machine handles the received message. Every inherited class of the class state has to implement this method. pMsg message, which has to be handled

virtual void ApparatusFramework::State::onExit (  )  [protected, pure virtual]

This method is automatically executed if the state machine exits from the state. Every inherited class of the class state has to implement this method.


Friends And Related Function Documentation

friend class StateMachine [friend]

Makes friend with our StateMachine class.

Definition at line 66 of file State.h.

© 2004-2010 bbv Software Services AG / Apparatus Services