Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

PilotTrans.cc

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

Tekkotsu v5.1CVS
Generated Fri Mar 16 05:26:46 2012 by Doxygen 1.6.3