[IGSTK-Developers] adding a method into state machine

Hee-su Kim hkim at isis.imac.georgetown.edu
Tue Sep 20 02:41:07 EDT 2005


Hi, guys,

I'm trying to modify SerialCommunication::Write & Read to return values as David suggested.

Write & Read methods return values such as SUCCESS, FAILURE, TIMEOUT.

Because there are 3 result values, it can't be handled with PushInputBoolean().

So, I'm considering to add the following method. 

It maps an integer value to an Input.

How do you think about this?


template<class TClass>
void
StateMachine< TClass >
::PushInputMap( int condition, const map<int, const InputType> &conditionInputMap,
                    const InputType & inputDefault )
{
  const InputType *input = & inputDefault;

  if ( conditionInputMap.find(condition) != conditionInputMap.end() )
    {
    input = & conditionInputMap[condition];
    }

  m_QueuedInputs.push( input->GetIdentifier() );
}

Hee-Su
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/igstk-developers/attachments/20050920/04b45125/attachment-0002.html>


More information about the IGSTK-Developers mailing list