StateMachineProcessor Class Reference
[Execution Engine]

#include </home/sspr/src/www/orocos-1.0/export/build/orocos-rtt-1.2.2/build/rtt/StateMachineProcessor.hpp>

Inheritance diagram for StateMachineProcessor:

RunnableInterface 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().


Public Types

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

Public Member Functions

 StateMachineProcessor ()
 Constructs a new 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.
ActivityInterfacegetActivity () const
 Query for the task this interface is run in.
virtual void setActivity (ActivityInterface *task)
 Set the task this interface is run in.
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.
ThreadInterface * getThread () 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.

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.

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

ActivityInterface * getActivity (  )  const [inline, inherited]

Query for the task this interface is run in.

Zero denotes that no task is present to run it, and hence no detailed information is available.

Returns:
The Activity which runs this RunnableInterface.

virtual void setActivity ( ActivityInterface task  )  [virtual, inherited]

Set the task this interface is run in.

A Zero means no task is running it.

Parameters:
task The ActivityInterface running this interface.

Reimplemented in ExecutionEngine.

virtual 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.

virtual 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, and ExecutionEngine.

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.


The documentation for this class was generated from the following file:
Generated on Fri Oct 19 16:27:25 2007 for Orocos by  doxygen 1.5.1