StateMachineProcessor Class Reference
[Execution Engine]

#include <rtt/StateMachineProcessor.hpp>

Inheritance diagram for StateMachineProcessor:

RunnableInterface

List of all members.


Detailed Description

This class implements a real-time state machine executor.

Changing the State Machine Processing Policy
The default policy of the StateMachineProcessor is to call StateMachine::execute() of all loaded state machines in each step(). The parent state machines are executed before the children.

If you want to change this policy, subclass the StateMachineProcessor and override the virtual functions, such as step().

Definition at line 68 of file StateMachineProcessor.hpp.


Public Types

typedef
StateMachine::Status 
Status
 The status of a StateMachine.

Public Member Functions

 StateMachineProcessor ()
 Constructs a new StateMachineProcessor.
virtual ~StateMachineProcessor ()
bool loadStateMachine (StateMachinePtr sc)
 Load a new State Machine and all its children.
bool unloadStateMachine (const std::string &name)
 Unload a deactivated State Machine and all its children.
bool deleteStateMachine (const std::string &name)
 Delete a deactivated State Machine and all its children.
void clear ()
 Stop and unload all programs from the StateMachineProcessor.
Status::StateMachineStatus getStateMachineStatus (const std::string &name) const
 Return the status of a StateMachine.
std::string getStateMachineStatusStr (const std::string &name) const
 Return the status of a StateMachine as a human readable string.
virtual bool initialize ()
 The method that will be called before the first periodical execution of step() ( or non periodical execution of loop() ), when the thread is started.
virtual void step ()
 The method that will be periodically executed when this class is run in a periodic thread.
virtual void finalize ()
 The method that will be called after the last periodical execution of step() ( or non periodical execution of loop() ), when the RunnableInterface is stopped.
std::vector
< std::string > 
getStateMachineList () const
 Get a list of all loaded StateMachines and their children.
const StateMachinePtr getStateMachine (const std::string &name) const
 Get a pointer to a loaded StateMachine.
StateMachinePtr getStateMachine (const std::string &name)
 Get a pointer to a loaded StateMachine.
virtual void loop ()
 The method that will be executed once when this class is run in a non periodic thread.
virtual bool breakLoop ()
 This method is called by the framework to break out of the loop() method.
ThreadInterfacegetThread () const
 Get the thread this object is run in.
virtual void setThread (ThreadInterface *t)
 Set the thread this object will be run in.

Protected Types

typedef ListLockFree
< StateMachinePtr
StateMap

Protected Member Functions

void recursiveLoadStateMachine (StateMachinePtr sc)
bool recursiveCheckLoadStateMachine (StateMachinePtr sc)
void recursiveUnloadStateMachine (StateMachinePtr sc)
bool recursiveCheckUnloadStateMachine (StateMachinePtr si)

Protected Attributes

StateMapstates

Member Function Documentation

bool loadStateMachine ( StateMachinePtr  sc  ) 

Load a new State Machine and all its children.

Exceptions:
program_load_exception if a state machine with the same name already exists.

Definition at line 143 of file StateMachineProcessor.cpp.

References ORO_THROW_OR_RETURN, and StateMachineProcessor::recursiveLoadStateMachine().

bool unloadStateMachine ( const std::string &  name  ) 

Unload a deactivated State Machine and all its children.

Exceptions:
program_unload_exception if the state machine or one of its children is still active.

Definition at line 198 of file StateMachineProcessor.cpp.

References ListLockFree::find_if(), StateMachine::getName(), ORO_THROW_OR_RETURN, StateMachineProcessor::recursiveCheckUnloadStateMachine(), StateMachineProcessor::recursiveUnloadStateMachine(), and StateMachineProcessor::states.

Referenced by StateMachineProcessor::clear(), and StateMachineProcessor::deleteStateMachine().

bool deleteStateMachine ( const std::string &  name  ) 

Delete a deactivated State Machine and all its children.

Exceptions:
program_unload_exception if the state machine or one of its children is still active.
Deprecated:
by unloadStateMachine

Definition at line 270 of file StateMachineProcessor.cpp.

References StateMachineProcessor::unloadStateMachine().

void loop (  )  [virtual, inherited]

The method that will be executed once when this class is run in a non periodic thread.

The default implementation calls step() once.

Reimplemented in Timer.

Definition at line 60 of file RunnableInterface.cpp.

References RunnableInterface::step().

Referenced by SlaveActivity::execute(), SingleThread::loop(), and NonPeriodicActivity::loop().

bool breakLoop (  )  [virtual, inherited]

This method is called by the framework to break out of the loop() method.

Reimplement this method to signal loop() to return and return true on success. When this method is not reimplemented by you, it will always return false, denoting that the loop can not be broken. If breakLoop() returns true, the caller will wait until loop() returns.

Returns:
true if the loop could be notified to return.

Reimplemented in EventProcessor, ExecutionEngine, and Timer.

Definition at line 62 of file RunnableInterface.cpp.

Referenced by SingleThread::breakLoop(), NonPeriodicActivity::breakLoop(), and SlaveActivity::stop().

ThreadInterface * getThread (  )  const [inherited]

Get the thread this object is run in.

Returns:
a pointer to the thread or 0 if not run by a thread.

Definition at line 69 of file RunnableInterface.cpp.

Referenced by Timer::initialize().


The documentation for this class was generated from the following files:
Generated on Tue Mar 25 17:41:57 2008 for OrocosReal-TimeToolkit by  doxygen 1.5.3