[IGSTK-Developers] A question for the state machine

Luis Ibanez luis.ibanez at kitware.com
Thu Jan 26 17:48:37 EST 2006


Hi Patrick,

Good catch !

I agree with you that we should check the InitialState condition
before going into the "ready to run" state.

We should also prevent a user from calling SelectInitialState()
more than once, and in particular after the SetReadyToRun() method
has been invoked.

It seems to that we need a Clone method in the StateMachine, so that
a StateMachine<T> can initialize another StateMachine<T> to a duplicate
of its internal state. That method could then be invoked from the
T class that owns the StateMachine instantiation.

I'll look into implementing this method in the StateMachine and
adding some security for the SelectInitialState problem.


  Thanks for pointing this out and logging the bug for it.


     Luis



-------------------
Patrick Cheng wrote:
> Hi Luis,
> 
> I think we should check m_ReadyToRun first before executing the code in 
> SelectInitialState() method.
> 
> It seems that, after the construction of the state machine, and 
> SetReadyToRun() being called, at run time, we can still do 
> SelectInitialState to arbitrarily change the current state, which is not 
> 'safe' enough.
> 
> This could also be a problem for deep copy of igstk object.
> 
> 1. Some how we need a way to change the state of the new object after 
> it's being contructed, to make it the same as the object being copied.
> 
> 2. Even if we keep the SelectInitialState() as the way it is, we can not 
> use it. The change of current state, should use the state 'descriptor' 
> not 'token'. SelectInitialState() is passing the state 'token'
> 
> 3. Or we just simply don't provide this copy() method.
> 
> Please refer to BUG:2689
> 
> Patrick
> _______________________________________________
> IGSTK-Developers mailing list
> IGSTK-Developers at public.kitware.com
> http://public.kitware.com/cgi-bin/mailman/listinfo/igstk-developers
> 
> 




More information about the IGSTK-Developers mailing list