Homepage Demos Overview Downloads Tutorials Reference
Credits
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members | Related Pages | Search

Transition.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_Transition_h_
00003 #define INCLUDED_Transition_h_
00004 
00005 class StateNode;
00006 
00007 //! Represents a transition between StateNodes.
00008 /*! This is an abstract class - you'll want to subclass it to put
00009  *  conditions on the transitions */
00010 class Transition {
00011 public:
00012   //!constructor, specifies source and destination StateNode's
00013   Transition(StateNode* source, StateNode* destination) : src(source), dst(destination) {}
00014   //!copy constructor, just in case you need it
00015   Transition(const Transition& t) : src(t.src), dst(t.dst) {}
00016   //!destructor
00017   virtual ~Transition() {}
00018 
00019   //!called by StateNode when it becomes active - use this to request events (or whatever you need to do)
00020   virtual void enable()=0;
00021   //!called by StateNode when it becomes inactive - undo whatever you did in Enable()
00022   virtual void disable()=0;
00023 
00024   //!call this when the transition should be made, base class version simply calls StateNode::Leave() on #src and StateNode::Enter() on #dst, but you can override.
00025   virtual void activate();
00026 
00027   //!assignment operator (only does shallow copy)
00028   Transition& operator=(const Transition& t) { src=t.src; dst=t.dst; return *this; }
00029 protected:
00030   StateNode* src; //!< the node being transitioned from
00031   StateNode* dst; //!< the node being transitioned to
00032 };
00033 
00034 /*! @file
00035  * @brief Describes Transition, represents a transition between StateNodes.
00036  * @author ejt (Creator)
00037  *
00038  * $Author: ejt $
00039  * $Name: tekkotsu-1_4_1 $
00040  * $Revision: 1.1 $
00041  * $State: Exp $
00042  * $Date: 2003/03/01 20:53:26 $
00043  */
00044 
00045 #endif

Tekkotsu v1.4
Generated Sat Jul 19 00:06:32 2003 by Doxygen 1.3.2