OpenJAUS SAE SDK  6.0.0
Classes | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
openjaus::model::StateMachine Class Reference

#include <StateMachine.h>

Classes

struct  TransitionData
 

Public Member Functions

 StateMachine ()
 
virtual ~StateMachine ()
 
std::string getName () const
 
bool setName (const std::string &name)
 
StategetParentState () const
 
bool setParentState (State *parentState)
 
StategetActiveChildState () const
 
void setActiveChildState (State *state)
 
StategetStartingState () const
 
bool setStartingState (State *startingState)
 
StategetCurrentState () const
 
StategetCurrentState (const std::string &serviceName) const
 
void setStateStack (std::list< State *> *stateStack)
 
bool processTrigger (Trigger *trigger)
 
int addState (State &state)
 
int addDefaultStateTransition (Transition &transition)
 
int removeDefaultStateTransition (Transition &transition)
 
MessagegetResponse (Trigger *trigger)
 
bool executeTransition (Transition *transition)
 
void enter (bool executeEntryActions, bool initializeStartState)
 
void exit (bool executeExitActions)
 
std::string getQualifedName ()
 
virtual std::string toString () const
 
template<class MessageType , class CallbackClass >
void addMessageCallback (bool(CallbackClass::*callback)(MessageType &messageRef), CallbackClass *object)
 
template<class CallbackClass >
void addMessageCallback (bool(CallbackClass::*callback)(Trigger *trigger), CallbackClass *object)
 
template<class MessageType >
void addMessageCallback (bool(*callback)(MessageType &messageRef))
 

Private Member Functions

void getLeafStates (std::vector< State *> &leafStates) const
 
StategetCurrentState (const std::string &serviceName, State *currentMatch) const
 
bool executeSimpleTransition (State *endState)
 
bool executePushTransition (State *endState)
 
bool executePopTransition ()
 
void executeTransition (State *startState, State *endState, bool executeExitActions, bool executeEntryActions)
 
StateMachinefindCommonRootStateMachine (State *startState, State *endState)
 
std::list< StateMachine * > getPathToRoot (State *state)
 
StateMachinefindLowestCommonRoot (std::list< StateMachine *> path1, std::list< StateMachine *> path2)
 
std::list< State * > getIntermediateStates (State *state, StateMachine *sm)
 
void executeTransition (struct TransitionData &data)
 
bool hasState (State *state)
 

Private Attributes

std::string name
 
std::vector< State * > childStates
 
StateparentState
 
StateactiveChildState
 
StatestartingState
 
std::vector< Transition * > defaultStateTransitions
 
std::list< State * > * stateStack
 
std::vector< MessageCallback * > callbacks
 
system::Mutex mutex
 

Friends

OPENJAUS_EXPORT friend std::ostream & operator<< (std::ostream &output, const StateMachine &object)
 
OPENJAUS_EXPORT friend std::ostream & operator<< (std::ostream &output, const StateMachine *object)
 

Constructor & Destructor Documentation

◆ StateMachine()

openjaus::model::StateMachine::StateMachine ( )

◆ ~StateMachine()

openjaus::model::StateMachine::~StateMachine ( )
virtual

Member Function Documentation

◆ addDefaultStateTransition()

int openjaus::model::StateMachine::addDefaultStateTransition ( Transition transition)

◆ addMessageCallback() [1/3]

template<class MessageType , class CallbackClass >
void openjaus::model::StateMachine::addMessageCallback ( bool(CallbackClass::*)(MessageType &messageRef)  callback,
CallbackClass *  object 
)
inline

◆ addMessageCallback() [2/3]

template<class CallbackClass >
void openjaus::model::StateMachine::addMessageCallback ( bool(CallbackClass::*)(Trigger *trigger)  callback,
CallbackClass *  object 
)
inline

◆ addMessageCallback() [3/3]

template<class MessageType >
void openjaus::model::StateMachine::addMessageCallback ( bool(*)(MessageType &messageRef)  callback)
inline

◆ addState()

int openjaus::model::StateMachine::addState ( State state)

◆ enter()

void openjaus::model::StateMachine::enter ( bool  executeEntryActions,
bool  initializeStartState 
)

◆ executePopTransition()

bool openjaus::model::StateMachine::executePopTransition ( )
private

◆ executePushTransition()

bool openjaus::model::StateMachine::executePushTransition ( State endState)
private

◆ executeSimpleTransition()

bool openjaus::model::StateMachine::executeSimpleTransition ( State endState)
private

◆ executeTransition() [1/3]

bool openjaus::model::StateMachine::executeTransition ( Transition transition)

◆ executeTransition() [2/3]

void openjaus::model::StateMachine::executeTransition ( State startState,
State endState,
bool  executeExitActions,
bool  executeEntryActions 
)
private

◆ executeTransition() [3/3]

void openjaus::model::StateMachine::executeTransition ( struct TransitionData data)
private

◆ exit()

void openjaus::model::StateMachine::exit ( bool  executeExitActions)

◆ findCommonRootStateMachine()

StateMachine * openjaus::model::StateMachine::findCommonRootStateMachine ( State startState,
State endState 
)
private

◆ findLowestCommonRoot()

StateMachine * openjaus::model::StateMachine::findLowestCommonRoot ( std::list< StateMachine *>  path1,
std::list< StateMachine *>  path2 
)
private

◆ getActiveChildState()

State * openjaus::model::StateMachine::getActiveChildState ( ) const

◆ getCurrentState() [1/3]

State * openjaus::model::StateMachine::getCurrentState ( ) const

◆ getCurrentState() [2/3]

State * openjaus::model::StateMachine::getCurrentState ( const std::string &  serviceName) const

◆ getCurrentState() [3/3]

State * openjaus::model::StateMachine::getCurrentState ( const std::string &  serviceName,
State currentMatch 
) const
private

◆ getIntermediateStates()

std::list< State * > openjaus::model::StateMachine::getIntermediateStates ( State state,
StateMachine sm 
)
private

◆ getLeafStates()

void openjaus::model::StateMachine::getLeafStates ( std::vector< State *> &  leafStates) const
private

◆ getName()

std::string openjaus::model::StateMachine::getName ( ) const

◆ getParentState()

State * openjaus::model::StateMachine::getParentState ( ) const

◆ getPathToRoot()

std::list< StateMachine * > openjaus::model::StateMachine::getPathToRoot ( State state)
private

◆ getQualifedName()

std::string openjaus::model::StateMachine::getQualifedName ( )

◆ getResponse()

Message * openjaus::model::StateMachine::getResponse ( Trigger trigger)

◆ getStartingState()

State * openjaus::model::StateMachine::getStartingState ( ) const

◆ hasState()

bool openjaus::model::StateMachine::hasState ( State state)
private

◆ processTrigger()

bool openjaus::model::StateMachine::processTrigger ( Trigger trigger)

◆ removeDefaultStateTransition()

int openjaus::model::StateMachine::removeDefaultStateTransition ( Transition transition)

◆ setActiveChildState()

void openjaus::model::StateMachine::setActiveChildState ( State state)

◆ setName()

bool openjaus::model::StateMachine::setName ( const std::string &  name)

◆ setParentState()

bool openjaus::model::StateMachine::setParentState ( State parentState)

◆ setStartingState()

bool openjaus::model::StateMachine::setStartingState ( State startingState)

◆ setStateStack()

void openjaus::model::StateMachine::setStateStack ( std::list< State *> *  stateStack)

◆ toString()

std::string openjaus::model::StateMachine::toString ( ) const
virtual

Friends And Related Function Documentation

◆ operator<< [1/2]

OPENJAUS_EXPORT friend std::ostream& operator<< ( std::ostream &  output,
const StateMachine object 
)
friend

◆ operator<< [2/2]

OPENJAUS_EXPORT friend std::ostream& operator<< ( std::ostream &  output,
const StateMachine object 
)
friend

Member Data Documentation

◆ activeChildState

State* openjaus::model::StateMachine::activeChildState
private

◆ callbacks

std::vector<MessageCallback*> openjaus::model::StateMachine::callbacks
private

◆ childStates

std::vector<State*> openjaus::model::StateMachine::childStates
private

◆ defaultStateTransitions

std::vector<Transition*> openjaus::model::StateMachine::defaultStateTransitions
private

◆ mutex

system::Mutex openjaus::model::StateMachine::mutex
private

◆ name

std::string openjaus::model::StateMachine::name
private

◆ parentState

State* openjaus::model::StateMachine::parentState
private

◆ startingState

State* openjaus::model::StateMachine::startingState
private

◆ stateStack

std::list<State*>* openjaus::model::StateMachine::stateStack
private

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