Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

CompletionTrans.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_CompletionTrans_h_
00003 #define INCLUDED_CompletionTrans_h_
00004 
00005 #include "Behaviors/StateNode.h"
00006 #include "Behaviors/Transition.h"
00007 #include "Events/EventRouter.h"
00008 
00009 //! causes a transition when at least @e n sources have signalled completion;  @e n = 0 means "all" (default)
00010 class CompletionTrans : public Transition {
00011 protected:
00012   int minsrcs; //!< the minimum number of sources which must signal completion before this transition will fire
00013   bool *completions;  //!< pointer to array for recording completion events for all sources
00014   EventBase savedEvent; //!< Copy of current event to be used after timer expires
00015   
00016 public:
00017   //! constructor, pass @a destination and the minimum number of sources which must signal completion before this transition will fire
00018   CompletionTrans(StateNode* destination, int n=0) :
00019     Transition(destination), minsrcs(n), completions(NULL), savedEvent() {};
00020   
00021   //! constructor, pass @a name, @a destination and the minimum number of times the source must signal completion beyond the first (@a n)
00022   CompletionTrans(const std::string& name, StateNode* destination, int n=0) :
00023     Transition(name,destination), minsrcs(n), completions(NULL), savedEvent() {};
00024   
00025   //! starts listening
00026   virtual void postStart();
00027   
00028   //! stops listening
00029   virtual void stop();
00030   
00031   //! record completions, and fire the transition if enough sources have completed
00032   virtual void doEvent();
00033   
00034 protected:
00035   //!@name Dummy functions to satisfy the compiler
00036   CompletionTrans(const CompletionTrans&);  //!< don't call this
00037   CompletionTrans& operator=(const CompletionTrans&);  //!< don't call this
00038   //@}
00039   
00040 };
00041 
00042 /*! @file
00043  * @brief Defines Completiontrans, which causes a transition if all sources have signalled completion
00044  * @author dst (Creator)
00045  */
00046 
00047 #endif

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