25 #ifndef CONCURRENTCOMPOSITESTATE_H_
26 #define CONCURRENTCOMPOSITESTATE_H_
37 <
class CompositeStateImpl
63 <
class CompositeStateImpl
64 ,
class StateMachineImpl
66 ,
unsigned int NumOfRegions
71 :
public StateBaseImpl
125 bool allRegionsFinalized =
true;
126 for(
unsigned int i = 0; i < NumOfRegions; ++i)
128 if(!
regions[i]->isRegionFinalized())
130 allRegionsFinalized =
false;
131 regions[i]->handleBroadcastedEvent(static_cast<CompositeStateImpl*>(
this),eventHandler,eventArgs);
135 if(
regions[i]->isRegionThreadRunning())
137 regions[i]->endDoRegion(static_cast<CompositeStateImpl*>(
this));
138 regions[i]->joinRegionThread();
142 if(allRegionsFinalized)
144 context->subStateMachineCompleted(
this);
153 <
class CompositeStateImpl
154 ,
class StateMachineImpl
156 ,
unsigned int NumOfRegions
157 ,
class StateBaseImpl
160 :
public StateBaseImpl
213 bool allRegionsFinalized =
true;
214 for(
unsigned int i = 0; i < NumOfRegions; ++i)
216 if(!
regions[i]->isRegionFinalized())
218 allRegionsFinalized =
false;
219 regions[i]->handleBroadcastedEvent(static_cast<CompositeStateImpl*>(
this),eventHandler);
223 if(
regions[i]->isRegionThreadRunning())
225 regions[i]->endDoRegion(static_cast<CompositeStateImpl*>(
this));
226 regions[i]->joinRegionThread();
230 if(allRegionsFinalized)
232 context->subStateMachineCompleted(
this);
246 <
class CompositeStateImpl
247 ,
class StateMachineImpl
249 ,
unsigned int NumOfRegions
251 ,
class StateBaseImpl
266 <
class CompositeStateImpl
267 ,
class StateMachineImpl
269 ,
unsigned int NumOfRegions
270 ,
class StateBaseImpl
291 <
class CompositeStateImpl
292 ,
class StateMachineImpl
294 ,
unsigned int NumOfRegions
296 ,
class StateBaseImpl
371 , contextStateMachine_(argContextStateMachine)
390 for(
unsigned int i = 0; i < NumOfRegions; ++i)
406 for(
unsigned int i = 0; i < NumOfRegions; ++i)
422 static_cast<CompositeStateImpl*
>(
this)->
finalizeImpl(recursive);
431 static_cast<CompositeStateImpl*
>(
this)->
initializeImpl(recursive);
442 for(
unsigned int i = 0; i < NumOfRegions; ++i)
463 for(
unsigned int i = 0; i < NumOfRegions; ++i)
479 for(
unsigned int i = 0; i < NumOfRegions; ++i)
492 for(
unsigned int i = 0; i < NumOfRegions; ++i)
507 bool allRegionsCompleted =
true;
508 for(
unsigned int i = 0; i < NumOfRegions; ++i)
512 allRegionsCompleted =
false;
515 if(allRegionsCompleted)
517 context()->subStateMachineCompleted(
this);
545 <
class CompositeStateImpl
546 ,
class StateMachineImpl
548 ,
unsigned int NumOfRegions = 1
549 ,
class EventArgs = void
550 ,
class StateBaseImpl = State<CompositeStateImpl,StateMachineImpl,typename StateMachineImpl::StateInterface>
606 static_cast<CompositeStateImpl*
>(
this)->changeStateImpl(context,newState);