25 #ifndef STATEMACHINE_H_
26 #define STATEMACHINE_H_
32 #if defined(STTCL_DEBUG)
50 template<
class StateMachineImpl,
class IState>
56 struct StateMachineFlags
61 unsigned char initialized:1;
65 unsigned char initializing:1;
69 unsigned char finalized:1;
73 unsigned char finalizing:1;
78 inline StateMachineFlags()
130 void finalize(
bool finalizeSubStateMachines =
true)
134 flags.finalizing =
true;
136 flags.finalizing =
false;
155 return flags.initialized;
164 return flags.initializing;
173 return flags.finalized;
182 return flags.finalizing;
204 flags.initializing =
true;
228 flags.initializing =
false;
229 flags.finalized =
false;
230 flags.initialized =
true;
244 if(finalizeSubStateMachines)
251 flags.finalized =
true;
252 flags.initialized =
false;
306 #if defined(STTCL_DEBUG) // && defined(STTCL_HAVE_RTTI)
309 std::cout <<
"WARNING: " <<
typeid(
static_cast<const Context*
>(
this)).name() <<
".getInitialStateImpl() returned NULL" << std::endl;
344 StateMachineFlags flags;
348 template<
class StateMachineImpl,
class IState>
351 if(isInitalizing() || !isFinalized())
355 if(newState != state)
369 template<
class StateMachineImpl,
class IState>
379 template<
class StateMachineImpl,
class IState>