tdaq-develop-2025-02-12
|
Public Member Functions | |
FiniteStateMachine (const std::string &stateMachineName) | |
template<class OBJECT > | |
void | addStateTransition (toolbox::fsm::State from, toolbox::fsm::State to, const std::string &input, const std::string &transitionName, OBJECT *obj, void(OBJECT::*func)(toolbox::Event::Reference)) |
template<class OBJECT > | |
void | addStateTransition (toolbox::fsm::State from, toolbox::fsm::State to, const std::string &input, const std::string &transitionName, const std::string &transitionParameter, OBJECT *obj, void(OBJECT::*func)(toolbox::Event::Reference)) |
toolbox::fsm::State | getProvenanceState (void) |
toolbox::fsm::State | getTransitionFinalState (const std::string &transition) |
std::string | getProvenanceStateName (void) |
std::string | getCurrentStateName (void) |
time_t | getTimeInState (void) const |
std::string | getCurrentTransitionName (const std::string &transition="") |
std::string | getTransitionName (const toolbox::fsm::State from, const std::string &transition) |
std::string | getTransitionParameter (const toolbox::fsm::State from, const std::string &transition) |
std::string | getTransitionFinalStateName (const std::string &transition) |
const std::string & | getErrorMessage (void) const |
const std::string & | getStateMachineName (void) const |
void | setStateMachineName (const std::string &name) |
const xoap::MessageReference & | getCurrentMessage (void) |
bool | execTransition (const std::string &transition) |
bool | execTransition (const std::string &transition, const xoap::MessageReference &message) |
bool | isInTransition (void) |
void | setInitialState (toolbox::fsm::State state) |
void | setErrorMessage (const std::string &errMessage, bool append=true) |
Static Public Attributes | |
static const std::string | FAILED_STATE_NAME = "Failed" |
static const std::string | ERROR_TRANSITION_NAME = "Error" |
static const char | FAILED_STATE = 'F' |
Protected Attributes | |
time_t | stateEntranceTime_ |
volatile bool | inTransition_ |
toolbox::fsm::State | provenanceState_ |
std::string | currentTransition_ |
std::map< toolbox::fsm::State, std::map< std::string, std::string, std::less< std::string > > > | stateTransitionNameTable_ |
std::map< toolbox::fsm::State, std::map< std::string, std::string, std::less< std::string > > > | stateTransitionParameterTable_ |
xoap::MessageReference | theMessage_ |
std::string | theErrorMessage_ |
std::string | stateMachineName_ |
Definition at line 10 of file FiniteStateMachine.h.
bool FiniteStateMachine::execTransition | ( | const std::string & | transition, |
const xoap::MessageReference & | message | ||
) |
execTransition
Returns true if transition is successfully executed else false if this exec did not complete a transition.
Note: For iteration handling, there is iterationIndex_ and iterationWorkFlag_. These are different (higher level) than the members of VStateMachine.
Definition at line 202 of file FiniteStateMachine.cc.
time_t FiniteStateMachine::getTimeInState | ( | void | ) | const |
getTimeInState returns number of seconds elapsed while in current state returns 0 if invalid (i.e. stateEntranceTime_ is not set - stateEntranceTime_ is initialized to 0)
Definition at line 79 of file FiniteStateMachine.cc.
|
protected |
The volatile keyword indicates that a field might be modified by multiple concurrently executing threads. Fields that are declared volatile are not subject to compiler optimizations that assume access by a single thread. This ensures that the most up-to-date value is present in the field at all times. If you don't mark it volatile, the generated code might optimize the value into a registry and your thread will never see the change The atomicity has nothing to do with the visibility between threads... just because an operation is executed in one CPU cycle (atomic) it doesn't mean that the result will be visible to the other threads unless the value is marked volatile
Definition at line 81 of file FiniteStateMachine.h.