[IGSTK-Developers] Re: Further enhancements re: StateMachine::PushInput()

David Gobbi dgobbi at atamai.com
Fri Jun 17 10:22:24 EDT 2005


Hi Luis,

Taking this PushInput stuff up another notch, we also
need a way to push events.

When a Tracker-derived class generates an event, we
don't want the observer to be called until after the state
machine has finished its processing.

This will require an EventQueue class, and this class
probably belongs in ITK rather than IGSTK.

EventQueue::PushEvent(const itk::EventObject &);
EventQueue::ProcessEvents(itk::Object &);

Another possiblity is to queue the observers instead of
the events, but that would have to be built into itk::Object,
and would require the PushEvent() and ProcessEvents()
methods to be itk::Object methods.

 - David

P.S. I'll add PushInputBoolean() to the state machine,
and next week Hee-su will modify the IGSTK code
to use it. Once it is done, Tracker coverage will
finally reach 100%.

Luis Ibanez wrote:

>
> Hi David
>
> That's a great idea,
>
> It certainly will help to clean up the code.
>
> Please feel free to make the modifications in
> the State Machine, or if you prefer we can make
> the changes on the State Machine from here.
>
>
>    Just let us know,
>
>
>        Thanks
>
>
>           Luis
>
>
>
>
> ------------------------
> David Gobbi wrote:
>
>> Hi Luis,
>>
>> Since the PushInput() method was added, we've added a lot of ugly 
>> code like this to the tracker:
>>
>>  if (result == SUCCESS )
>>    {
>>    m_StateMachine.PushInput( m_CloseTrackingSuccessInput );
>>    }
>>  else if( result == FAILURE )
>>    {
>>    m_StateMachine.PushInput( m_CloseTrackingFailureInput );
>>    }
>>
>> I have a very simple fix for this, which either me or Hee-su can 
>> implement:
>>
>>
>> m_StateMachine.PushInputBoolean(result, m_CloseTrackingSuccessInput, 
>> m_CloseTrackingFailureInput);
>>
>>
>> By adding a "PushInputBoolean" method to the state machine, the nasty 
>> if/else blocks that we recently added to igstkTracker can be removed.
>>
>> Does this sound reasonable?
>>
>> - David
>>
>>
>>
>
>
>
>




More information about the IGSTK-Developers mailing list