Robot Devastation
Public Member Functions | Protected Attributes | List of all members
rd::StateDirector Class Referenceabstract

A base class for controlling flow of States of a Finite State Machine.

#include <StateDirector.hpp>

Inheritance diagram for rd::StateDirector:
rd::YarpStateDirector

Public Member Functions

 StateDirector (State *state)
 Creates a StateDirector attached to a State.
 
std::string getStateId () const
 Allows access to the id of the attached State.
 
virtual bool Start ()=0
 Function that starts the attached State. More...
 
virtual bool Stop ()=0
 Function to stop the attached State. More...
 
virtual bool addTransition (StateDirector *nextState, int condition)
 Adds a transition to a given state depending on a given condition. More...
 
virtual bool isActive () const
 Returns the current state of the State.
 

Protected Attributes

Statestate
 
bool active
 
std::map< int, StateDirector * > nextStates
 

Member Function Documentation

◆ addTransition()

bool rd::StateDirector::addTransition ( StateDirector nextState,
int  condition 
)
virtual
Parameters
nextStateState that will be reached if the condition is fulfilled
conditionCondition that triggers the transition

◆ Start()

virtual bool rd::StateDirector::Start ( )
pure virtual

Calls the State.setup() function once, and then runs a thread for the State.loop() function.

Implemented in rd::YarpStateDirector.

◆ Stop()

virtual bool rd::StateDirector::Stop ( )
pure virtual

This should stop thread running the State.loop() function and call the State.cleanup() function.

Implemented in rd::YarpStateDirector.


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