| Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
BehaviorBase Class Reference#include <BehaviorBase.h>
Inheritance diagram for BehaviorBase: ![]() Detailed DescriptionThe basis from which all other Behaviors should inherit.For complex behaviors, it may be helpful to break aspects of the behaviors into independent 'states', and use a state machine formalism to control them. See StateNode and Transition for more information.
Quick-start boilerplate is included in the distribution: project Tutorials:
REMEMBER: If/when you override DoStart() / DoStop(), make sure that your own implementation calls BehaviorBase's implementation to allow proper reference counting... otherwise you'll get memory leaks and other odd issues. (see boilerplate link above for example usage) Also, if you instantiate a behavior on the stack instead of the heap (this is very rarely done), remember to call SetAutoDelete(false) (provided from the ReferenceCounter base class) -- don't want it to try to free memory on the stack when the behavior is stopped! (The stack limits the allocation of the behavior to the current scope, which overrides the reference counting.)
Definition at line 30 of file BehaviorBase.h.
Member Function Documentation
Gives a short description of what this class of behaviors does... you should override this (but don't have to). If you do override this, also consider overriding getDescription() to return it Reimplemented in Controller, Aibo3DControllerBehavior, CameraStreamBehavior, EchoBehavior, EStopControllerBehavior, HeadPointControllerBehavior, RawCamBehavior, RegionCamBehavior, SegCamBehavior, StewartPlatformBehavior, UPennWalkControllerBehavior, ViewWMVarsBehavior, WalkControllerBehavior, WMMonitorBehavior, WorldStateSerializerBehavior, LedNode, MCNodeBase, MCNode< T, mcName, mcDesc, completes >, WalkToTargetNode, AutoGetupBehavior, BatteryMonitorBehavior, DeadReckoningBehavior< ParticleT >, WorldStateVelDaemon, TextMsgTrans, PitchDetector, BallDetectionGenerator, CDTGenerator, InterleavedYUVGenerator, JPEGGenerator, PNGGenerator, RawCameraGenerator, RegionGenerator, RLEGenerator, SegmentedColorGenerator, MCNode< LedMC >, MCNode< PostureMC, defPostureNodeName, defPostureNodeDesc, true >, MCNode< TailWagMC, defTailWagNodeName, defTailWagNodeDesc, false >, MCNode< W, mcName, mcDesc >, and MCNode< HeadPointerMC, defHeadPointerNodeName, defHeadPointerNodeDesc, true >. Definition at line 77 of file BehaviorBase.h. Referenced by getDescription().
Returns the name of the class of this behavior (aka its type). Note that this isn't static to avoid the problems we found with getDescription/getClassDescription. So instead we wind up wasting some memory in each instance of the class to store the className, but at least it will work the way you expect. Definition at line 73 of file BehaviorBase.h. Referenced by PNGGenerator::calcImage(), JPEGGenerator::calcImage(), StateNode::DoStop(), BehaviorSwitchControlBase::getDescription(), FilterBankGenerator::processEvent(), EventLogger::spider(), and StateNode::~StateNode().
Gives a short description of what this particular instantiation does (in case a more specific description is needed on an individual basis). By default simply returns getName(), because any calls from a BehaviorBase function to getClassDescription() are going to call BehaviorBase::getClassDescription(), not ~YourSubClass~getClassDescription(), because static functions can't be virtual in C++ (doh!) This means that getDescription called on a pointer to a BehaviorBase of unknown subtype would always return an empty string, which is pretty useless. So instead we return the name in this situation. If you want getDescription to return getClassDescription, you'll have to override it in your subclass to do so. Reimplemented in Controller, Aibo3DControllerBehavior, CameraStreamBehavior, EchoBehavior, EStopControllerBehavior, HeadPointControllerBehavior, RawCamBehavior, RegionCamBehavior, SegCamBehavior, StewartPlatformBehavior, UPennWalkControllerBehavior, ViewWMVarsBehavior, WalkControllerBehavior, WMMonitorBehavior, WorldStateSerializerBehavior, LedNode, MCNodeBase, MCNode< T, mcName, mcDesc, completes >, WalkToTargetNode, AutoGetupBehavior, BatteryMonitorBehavior, DeadReckoningBehavior< ParticleT >, WorldStateVelDaemon, TextMsgTrans, PitchDetector, MCNode< LedMC >, MCNode< PostureMC, defPostureNodeName, defPostureNodeDesc, true >, MCNode< TailWagMC, defTailWagNodeName, defTailWagNodeDesc, false >, MCNode< W, mcName, mcDesc >, and MCNode< HeadPointerMC, defHeadPointerNodeName, defHeadPointerNodeDesc, true >. Definition at line 63 of file BehaviorBase.h. Referenced by BehaviorSwitchControl< B, Al >::getDescription(), and BehaviorSwitchControlBase::getDescription().
This read-only set allows us list all the currently instantiated behaviors. Not all of these behaviors are necessarily active, this is everything that has been allocated and not yet deallocated Definition at line 84 of file BehaviorBase.h. Referenced by BehaviorReportControl::activate(), EventLogger::find(), and EventLogger::runCommand().
The documentation for this class was generated from the following files: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Tekkotsu v3.0 |
Generated Fri May 11 20:07:45 2007 by Doxygen 1.4.7 |