Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

PilotTrans.cc

Go to the documentation of this file.
00001 #include "PilotTrans.h"
00002 #include "DualCoding/VRmixin.h"
00003 #include "Shared/MarkScope.h"
00004 
00005 void PilotTrans::postStart() {
00006   Transition::postStart();
00007   for ( std::vector<StateNode*>::const_iterator it = srcs.begin(); it != srcs.end(); it++ )
00008     erouter->addListener(this,EventBase::pilotEGID,(size_t)*it);
00009 }
00010 
00011 void PilotTrans::doEvent() {
00012   switch ( event->getGeneratorID() ) {
00013   case EventBase::pilotEGID: {
00014     const PilotEvent *pilotEvent = dynamic_cast<const PilotEvent*>(event);
00015     if ( pilotEvent != NULL ) {
00016       // If no error value was supplied with the transition, this
00017       // transition is for the default case: start a timer and fire
00018       // if no other transition fires first.
00019       if ( ! valueSupplied ) {
00020   savedEvent = *event;
00021   erouter->addTimer(this, 9999, 1, false);
00022       }
00023       else
00024   // Fire if the supplied type matches the type in the event,
00025   // or the supplied type is someError and the event's error
00026   // type is anything but noError.
00027   if ( pilotEvent->getErrorType() == errorType ||
00028        (errorType == someError && pilotEvent->getErrorType() != noError) )
00029     fire(*event);
00030     }
00031     break;
00032   }
00033   case EventBase::timerEGID:
00034     fire(savedEvent);
00035     break;
00036   default:
00037     std::cout << "PilotTrans received unexpected event type: " << event->getDescription() << std::endl;
00038   }
00039 }
00040 
00041 PilotTrans::PilotTrans(const PilotTrans &src) : 
00042   Transition(src), errorType(src.errorType), valueSupplied(src.valueSupplied), savedEvent(src.savedEvent) {}

Tekkotsu v5.1CVS
Generated Mon May 9 04:58:46 2016 by Doxygen 1.6.3