65 #include "rnr/rnrconfig.h" 93 const std::string &strEventName=
"",
94 const std::string &strActionName=
"");
129 int getEventId()
const 134 std::string getEventName()
const 136 return m_strEventName;
139 std::string getActionName()
const 141 return m_strActionName;
146 std::string m_strEventName;
147 std::string m_strActionName;
166 static const int StateIdUndef = 0;
167 static const int StateIdStart = 1;
168 static const int StateIdPrev = 2;
169 static const int StateIdThis = 3;
170 static const int StateIdTerminate = 4;
171 static const int StateIdNumOf = 5;
181 const std::string &strStateName=
"",
182 const std::string &strRefTag=
"")
184 init(nStateId, strStateName, strRefTag);
197 const std::string &strStateName,
198 const std::string &strRefTag,
218 int addStateEvents(
StateEvent *pStateEvent, ...);
237 bool deleteStateEvent(
int nEventId);
249 uint_t usecLast = m_usecTimeOut;
250 m_usecTimeOut = usecTimeOut;
261 return m_usecTimeOut;
274 virtual int receiveEvent();
284 m_nQueuedEventId = nEventId;
285 m_bHasQueuedEvent =
true;
297 virtual int dispatchEvent(
int nPrevStateId,
int nEventId);
349 return m_strStateName;
369 std::string getEventName(
int nEventId);
378 std::string getActionName(
int nEventId);
386 virtual void printState(FILE *fp=stdout,
int indent=0);
406 void init(
int nStateId,
407 const std::string &strStateName=
"",
408 const std::string &strRefTag=
"");
417 virtual std::string getReservedStateName(
int nStateId);
423 #endif // _RNR_STATE_H
virtual int actionDefault(int nPrevStateId, int nEventId)
Execute 'default' action.
virtual void actionEnterState(int nPrevStateId, int nEventId)
Execute 'enter state' action.
osManipIndent indent()
Left indent at current stream indentation level.
uint_t setTimeOut(uint_t usecTimeOut)
Set recieve event time out.
uint_t getTimeOut()
Get recieve event time out.
virtual int execAction(State *pState, int nPrevStateId, int nEventId)
Execute action associated with the event.
int getStateId() const
Get state id.
std::string m_strRefTag
state tag (short id string)
TransTblMap_T m_mapTransTbl
state transition table
virtual bool evalGuardExpr(State *pState, int nPrevStateId, int nEventId)
Evaluate event guard condition.
std::map< int, StateEvent * > TransTblMap_T
transition table type
StateEvent(int nEventId, const std::string &strEventName="", const std::string &strActionName="")
Initialization constructor.
std::string getRefTag() const
Get state reference tag.
virtual void queueNextEvent(int nEventId)
Queue the next event to be "recieved".
State(int nStateId, const std::string &strStateName="", const std::string &strRefTag="")
Initialization constructor.
uint_t m_usecTimeOut
receive event time out (useconds)
int m_nQueuedEventId
queue state event
std::string getStateName() const
Get state name.
bool m_bHasQueuedEvent
[no] queued state event
std::string m_strStateName
state name
virtual void actionExitState(int nNextStateId, int nEventId)
Execute 'exit state' action.