Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
StateNode Class Reference#include <StateNode.h>
Inheritance diagram for StateNode:
![]() Detailed DescriptionRecursive data structure - both a state machine controller as well as a node within a state machine itself.Override setup() to build your own Transition and StateNode network if you want this node to contain a state machine. Override DoStart() / DoStop() as you would a normal BehaviorBase subclass to have this node add some functionality of its own. You can override setup to create a sub-network, as well as overriding DoStart and DoStop, in the same class. See also the tutorial page on State Machines.
There are two StateNode templates in project
Definition at line 28 of file StateNode.h.
Constructor & Destructor Documentation
destructor, removes references to its outgoing transitions (be careful of incoming ones - they're still around!), and calls RemoveReference() on subnodes
Definition at line 5 of file StateNode.cc.
constructor, pass the class name and instance name to use
Definition at line 78 of file StateNode.h.
don't call this
Member Function Documentation
Adds the specified StateTransition to the transition table.
Definition at line 20 of file StateNode.cc.
Returns the std::vector of transitions so you can modify them yourself if need be.
Definition at line 40 of file StateNode.h.
Returns the const std::vector of transitions so you can read through them if need be.
Definition at line 43 of file StateNode.h.
Adds a StateNode to nodes so it can be automatically dereferenced later, returns what it's passed (for convenience), calls AddReference() on node. Also sets the node's parent to
Definition at line 27 of file StateNode.cc.
Returns the std::vector of sub-nodes so you can modify them yourself if need be.
Definition at line 49 of file StateNode.h. Referenced by EventLogger::spider().
Returns the const std::vector of sub-nodes so you can read through them if need be.
Definition at line 52 of file StateNode.h.
Sets the retain flag - if not retained, will RemoveReference() subnodes upon DoStop() and recreate them on DoStart (by calling setup()) - may be too expensive to be worth saving memory...
Definition at line 55 of file StateNode.h.
Transitions should call this when you are entering the state, so it can enable its transitions.
Reimplemented from BehaviorBase. Reimplemented in GroupNode, MCNodeBase, MotionSequenceNode< SIZE >, OutputNode, PostureNode, SoundNode, WalkEngineNode< W, mcName, mcDesc >, WalkToTargetNode, and WaypointEngineNode< W, mcName, mcDesc >. Definition at line 35 of file StateNode.cc. Referenced by WalkToTargetNode::DoStart(), SoundNode::DoStart(), OutputNode::DoStart(), MotionSequenceNode< SIZE >::DoStart(), MCNodeBase::DoStart(), and GroupNode::DoStart().
This is called by DoStart() when you should setup the network of subnodes (if any).
Definition at line 61 of file StateNode.h. Referenced by DoStart().
Transitions should call this when you are leaving the state, so it can disable its transitions.
Reimplemented from BehaviorBase. Reimplemented in MCNodeBase, MotionSequenceNode< SIZE >, SoundNode, and WalkToTargetNode. Definition at line 52 of file StateNode.cc. Referenced by OutputNode::DoStart(), WalkToTargetNode::DoStop(), SoundNode::DoStop(), MotionSequenceNode< SIZE >::DoStop(), and MCNodeBase::DoStop().
This is called by DoStop() when you should destruct subnodes. Default implementation will take care of the subnodes and their transitions, you only need to worry about any *other* memory which may have been allocated. If none, you may not need implement this function at all. Reimplemented in MotionSequenceNode< SIZE >. Definition at line 73 of file StateNode.cc. Referenced by DoStop(), MotionSequenceNode< SIZE >::teardown(), and ~StateNode().
will throw an activation event through stateMachineEGID, used when DoStart() is called
Definition at line 81 of file StateNode.cc. Referenced by DoStart().
will throw a status event through stateMachineEGID to signal "completion" of the node "completion" is defined by your subclass - will mean different things to different nodes depending on the actions they are performing. So call this yourself if there is a natural ending point for your state.
Definition at line 85 of file StateNode.cc. Referenced by WaypointEngineNode< W, mcName, mcDesc >::processEvent(), SoundNode::processEvent(), MotionSequenceNode< SIZE >::processEvent(), and MCNodeBase::processEvent().
will throw an deactivation event through stateMachineEGID, used when DoStop() is called
Definition at line 89 of file StateNode.cc. Referenced by DoStop().
Member Data Documentation
pointer to the machine that contains this node
Definition at line 96 of file StateNode.h. Referenced by addNode(), DoStart(), and getParent().
a vector of outgoing transitions
Definition at line 98 of file StateNode.h. Referenced by addTransition(), DoStart(), DoStop(), getTransitions(), and ~StateNode().
this is set to true if the network has been setup but not destroyed (i.e. don't need to call setupSubNodes again)
Definition at line 102 of file StateNode.h. Referenced by DoStart(), DoStop(), setup(), teardown(), MotionSequenceNode< SIZE >::~MotionSequenceNode(), and ~StateNode().
this is set to true if the network should be retained between activations. Otherwise it's dereferenced upon DoStop(). (or at least RemoveReference() is called on subnodes)
Definition at line 104 of file StateNode.h. Referenced by DoStop(), and setRetain().
the timestamp of last call to DoStart()
Definition at line 106 of file StateNode.h. Referenced by postCompletionEvent(), and postStopEvent().
vector of StateNodes, just so they can be dereferenced again on DoStop() (unless retained) or ~StateNode()
Definition at line 108 of file StateNode.h. Referenced by addNode(), GroupNode::DoStart(), DoStop(), getNodes(), teardown(), and ~StateNode().
The documentation for this class was generated from the following files: |
Tekkotsu v4.0 |
Generated Thu Nov 22 00:58:43 2007 by Doxygen 1.5.4 |