Homepage | Demos | Overview | Downloads | Tutorials | Reference | Credits |
#include <Transition.h>
Inheritance diagram for Transition:
This is an abstract class - you'll want to subclass it to put conditions on the transitions. Transitions are "smart" - they are behaviors in and of themselves and can listen for events and use the standard DoStart/DoStop interface. Based on the events they receive, they can activate() themselves and cause a state transition.
DoStart() will be called when this transition is 'active' - it should listen/monitor for the transition it represents until DoStop() is called.
If the conditions are satisified for a transition, you should call activate() to do the appropriate notifications.
Also note that a transition can have multiple sources and destinations. See activate().
When setting up, the flow of additions follows the flow of control. In other words, you add a transition to a source, and you add a destination to a transition. This makes the code simpler because it doesn't have to worry about recursive looping depending whether the source was added to the transition or the transition was added to the source. Confusing? Exactly.
Definition at line 35 of file Transition.h.
Public Member Functions | |
Transition () | |
constructor | |
Transition (StateNode *destination) | |
constructor, specify destination StateNode (ignores NULL) | |
Transition (const Transition &t) | |
copy constructor, just in case you need it | |
Transition & | operator= (const Transition &t) |
assignment operator (only does shallow copy) | |
virtual | ~Transition () |
destructor | |
virtual void | activate () |
call this when the transition should be made, base class version simply calls StateNode::DoStop() on each active of srcs and StateNode::DoStart() on each inactive of dsts, but you can override. | |
virtual std::vector< StateNode * > & | getSources () |
returns a user-modifiable reference to the current source list | |
virtual const std::vector< StateNode * > & | getSources () const |
returns a const reference to the current source list | |
virtual void | addDestination (StateNode *destination) |
if destination is non-null, add it to the destination list | |
virtual std::vector< StateNode * > & | getDestinations () |
returns a user-modifiable reference to the current destination list | |
virtual const std::vector< StateNode * > & | getDestinations () const |
returns a const reference to the current destination list | |
virtual void | setSound (const std::string &snd) |
set a sound file to be played upon activation; you might want to preload this in the parent node; empty string to turn off | |
virtual std::string | getSound () |
returns the current sound file | |
Protected Member Functions | |
virtual void | addSource (StateNode *source) |
if source is non-null, add it to the source list | |
Protected Attributes | |
std::vector< StateNode * > | srcs |
the node being transitioned from | |
std::vector< StateNode * > | dsts |
the node being transitioned to | |
std::string | sound |
sound to play on transitioning | |
Friends | |
class | StateNode |
|
constructor
Definition at line 39 of file Transition.h. |
|
constructor, specify destination StateNode (ignores NULL)
Definition at line 41 of file Transition.h. |
|
copy constructor, just in case you need it
Definition at line 45 of file Transition.h. |
|
destructor
Definition at line 51 of file Transition.h. |
|
call this when the transition should be made, base class version simply calls StateNode::DoStop() on each active of srcs and StateNode::DoStart() on each inactive of dsts, but you can override.
Definition at line 6 of file Transition.cc. Referenced by VisualTargetTrans::processEvent(), VisualTargetCloseTrans::processEvent(), TimeOutTrans::processEvent(), and CompareTrans< T >::processEvent(). |
|
if destination is non-null, add it to the destination list
Definition at line 59 of file Transition.h. Referenced by Transition(). |
|
if source is non-null, add it to the source list Only StateNodes should be calling this - you add a transition to a source, not a source to a transition.
Definition at line 70 of file Transition.h. Referenced by StateNode::addTransition(). |
|
returns a const reference to the current destination list
Definition at line 61 of file Transition.h. |
|
returns a user-modifiable reference to the current destination list
Definition at line 60 of file Transition.h. |
|
returns the current sound file
Definition at line 64 of file Transition.h. |
|
returns a const reference to the current source list
Definition at line 57 of file Transition.h. |
|
returns a user-modifiable reference to the current source list
Definition at line 56 of file Transition.h. |
|
assignment operator (only does shallow copy)
Definition at line 48 of file Transition.h. |
|
set a sound file to be played upon activation; you might want to preload this in the parent node; empty string to turn off
Definition at line 63 of file Transition.h. Referenced by PaceTargetsMachine::setup(). |
|
Definition at line 36 of file Transition.h. |
|
the node being transitioned to
Definition at line 73 of file Transition.h. Referenced by activate(), addDestination(), getDestinations(), operator=(), and Transition(). |
|
sound to play on transitioning
Definition at line 74 of file Transition.h. Referenced by activate(), getSound(), operator=(), setSound(), and Transition(). |
|
the node being transitioned from
Definition at line 72 of file Transition.h. Referenced by activate(), addSource(), getSources(), operator=(), and Transition(). |
Tekkotsu v2.0 |
Generated Wed Jan 21 03:23:31 2004 by Doxygen 1.3.4 |