57 #ifndef _RNR_STATE_MACH_H 58 #define _RNR_STATE_MACH_H 66 #include "rnr/rnrconfig.h" 96 StateMach(
int nStateMachId = 0,
const std::string &strStateMachName =
"sm");
111 const std::string &strStateMachName,
113 State *listStates[]);
330 #endif // _RNR_STATE_MACH_H virtual void startRecording(size_t uLimit=NO_LIMIT)
Start recording states ids.
std::string m_strStateMachName
state machine name
int m_nMarkStateId
mark state id of last run cycle
void pushStateId(int nStateid)
Push state id onto stack of state ids.
std::vector< int > m_stackStateIds
stack of previous state ids
osManipIndent indent()
Left indent at current stream indentation level.
bool deleteState(int nStateId)
Delete state from this state machine.
int getCurrStateId() const
Get the current state id.
virtual void resumeRecording()
Resume recording of states ids.
int m_nCurrStateId
current state id
virtual void printStateMach(FILE *fp=stdout, int indent=0)
Print out state machine.
virtual void run()
Run the state machine from the start.
virtual ~StateMach()
Destructor.
int m_nStartStateId
starting state id
bool m_bIsRecording
is [not] recording work flow
void setStartStateId(int nStartStateId)
Set state machine's start state id.
int addStates(State *pState,...)
Add a list of states to this state machine.
static const int StateIdUndef
undefined state
virtual void stopRecording()
Stop recording of states ids.
int getPrevStateId() const
Get the previously recorded state id.
virtual void eraseRecording()
Erase recording of states ids.
std::map< int, State * > StateTblMap_T
state table type
int m_nStateMachId
state machine id
StateMach(int nStateMachId=0, const std::string &strStateMachName="sm")
Default contructor.
State base class interface.
Finite State Machine Class.
StateTblMap_T m_mapStateTbl
state table
int getStateMachId() const
Get state machine id.
void addState(State *pState)
Add state to this state machine.
std::string getStateMachName() const
Get state machine name.
virtual void logTransition(int nCurrStateId, int nEventId, int nNextStateId)
Log state transition.
static const size_t NO_LIMIT
no limit on length of recording
int popStateId()
Pop state id from stack of state ids.
size_t m_uMaxRecording
max recording length