25 #ifndef ACTIVESTATE_H_
26 #define ACTIVESTATE_H_
39 ,
class StateMachineImpl
41 ,
class StateThreadType
42 ,
class TimeDurationType
43 ,
class EndDoActionSemaphoreType
44 ,
class ActiveStateMutexType
78 ,
class StateMachineImpl
80 ,
class StateThreadType
81 ,
class TimeDurationType
82 ,
class EndDoActionSemaphoreType
83 ,
class ActiveStateMutexType
91 ,EndDoActionSemaphoreType
99 ,EndDoActionSemaphoreType
101 ,ActiveStateMutexType
103 pThis->runDoAction(pThis->currentContext);
128 ,
class StateMachineImpl
131 ,
class TimeDurationType = TimeDuration<STTCL_DEFAULT_TIMEDURATIONIMPL>
132 ,
class EndDoActionSemaphoreType = internal::SttclSemaphore<STTCL_DEFAULT_SEMAPHOREIMPL>
133 ,
class ActiveStateMutexType = internal::SttclMutex<STTCL_DEFAULT_MUTEXIMPL,TimeDurationType>
193 doFrequency = newValue;
202 bool result = endDoActionSemaphore.try_wait(doFrequency);
237 if(!StateThreadType::isSelf(stateThread))
257 endDoActionSemaphore.post();
258 if(!StateThreadType::isSelf(stateThread))
287 currentContext = context;
288 stateThread.run(
this);
295 return doActionRunning;
342 : doAction(argDoAction)
343 , doFrequency(argDoFrequency)
350 , EndDoActionSemaphoreType
352 , ActiveStateMutexType>)
353 , endDoActionSemaphore(0)
354 , doActionRunning(false)
355 , runDoActionOnce(argRunDoActionOnce)
366 endDo(currentContext);
390 virtual void entry(
Context* context)
395 virtual void exit(
Context* context)
400 virtual void startDo(
Context* context)
405 virtual void endDo(
Context* context)
410 void setDoActionRunning(
bool value)
413 doActionRunning = value;
416 void runDoAction(
Context* context)
418 bool initialCall =
true;
419 setDoActionRunning(
true);
420 bool directTransitionTriggered =
false;
426 (
static_cast<Implementation*
>(
this)->*doAction)(context,initialCall);
435 bool finalize =
false;
436 if(static_cast<Implementation*>(
this)->checkDirectTransitionImpl(context,finalize,nextState))
445 directTransitionTriggered =
true;
450 setDoActionRunning(
false);
453 virtual void finalizeSubStateMachines(
bool recursive)
458 virtual void initSubStateMachines(
bool recursive)
464 TimeDurationType doFrequency;
466 StateThreadType stateThread;
467 EndDoActionSemaphoreType endDoActionSemaphore;
468 mutable ActiveStateMutexType activeStateMutex;
469 bool doActionRunning;
470 bool runDoActionOnce;