Homepage Demos Overview Downloads Tutorials Reference
Credits

BehaviorBase Class Reference

#include <BehaviorBase.h>

Inheritance diagram for BehaviorBase:

Inheritance graph
[legend]
List of all members.

Detailed Description

The basis from which all other Behaviors should inherit.

Makes use of ReferenceCounter so that behaviors can automatically delete themselves if wanted.

Make sure your own DoStart and DoStop call BehaviorBase::DoStart (or Stop) to allow the auto-deletion from reference counting... otherwise you'll get memory leaks if you rely on the reference counting.

For an empty behavior boilerplate file to help you get started quickly, try Tekkotsu/docs/behavior_header.h:

But it would probably still be a good idea to go through the "First Behavior" tutorial to get a better idea of what's going on.

Definition at line 24 of file BehaviorBase.h.

Public Member Functions

 BehaviorBase ()
 constructor
 BehaviorBase (const BehaviorBase &b)
 copy constructor; assumes subclass handles copying approriately - i.e. if b is active, the copy will be as well, even though DoStart was never called..
BehaviorBaseoperator= (const BehaviorBase &b)
 assignment operator; assumes subclass handles assignment appropriately - i.e. if b is active, the copy will be as well, even though DoStart was never called..
virtual ~BehaviorBase ()
 destructor - if is active when deleted, will call DoStop() first
virtual void DoStart ()
 By default, merely adds to the reference counter (through AddReference()); Note you should still call this from your overriding methods.
virtual void DoStop ()
 By default, subtracts from the reference counter (RemoveReference()), and thus may deletex if zero; Don't forget to still call this when you override this; Warning: call this at the end of your DoStop(), not beginning (it might delete this ).
virtual void processEvent (const EventBase &)
 By defining here, allows you to get away with not supplying a processEvent() function for the EventListener interface. By default, does nothing.
virtual std::string getName () const =0
 Identifies the behavior in menus and such.
virtual std::string getDescription () const
 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 getClassDescription().
virtual bool isActive () const
 Returns true if the behavior is currently running.

Static Public Member Functions

std::string getClassDescription ()
 Gives a short description of what this class of behaviors does... you should override this (but don't have to).

Protected Attributes

bool started
 true when the behavior is active


Constructor & Destructor Documentation

BehaviorBase::BehaviorBase  )  [inline]
 

constructor

Definition at line 27 of file BehaviorBase.h.

BehaviorBase::BehaviorBase const BehaviorBase b  )  [inline]
 

copy constructor; assumes subclass handles copying approriately - i.e. if b is active, the copy will be as well, even though DoStart was never called..

Definition at line 29 of file BehaviorBase.h.

virtual BehaviorBase::~BehaviorBase  )  [inline, virtual]
 

destructor - if is active when deleted, will call DoStop() first

Definition at line 34 of file BehaviorBase.h.


Member Function Documentation

virtual void BehaviorBase::DoStart  )  [inline, virtual]
 

By default, merely adds to the reference counter (through AddReference()); Note you should still call this from your overriding methods.

Reimplemented in Controller, FreeMemReportControl, AlanBehavior, ASCIIVisionBehavior, AutoGetupBehavior, BanditMachine, BanditMachine::PressNode, BanditMachine::DecideNode, BanditMachine::WaitNode, BatteryMonitorBehavior, CameraBehavior, ChaseBallBehavior, CrashTestBehavior, DriveMeBehavior, ExploreMachine, FollowHeadBehavior, FreezeTestBehavior, GroundPlaneBehavior, HeadLevelBehavior, HelloWorldBehavior, KinematicSampleBehavior, KinematicSampleBehavior2, LookForSoundBehavior, MCRepeater, MotionStressTestBehavior, PaceTargetsMachine, RelaxBehavior, SimpleChaseBallBehavior, SoundTestBehavior, StareAtBallBehavior, StareAtPawBehavior, StareAtPawBehavior2, ToggleHeadLightBehavior, WalkToTargetMachine, WorldStateVelDaemon, Aibo3DControllerBehavior, EStopControllerBehavior, HeadPointControllerBehavior, RawCamBehavior, SegCamBehavior, ViewWMVarsBehavior, WalkControllerBehavior, WMMonitorBehavior, WorldStateSerializerBehavior, GroupNode, HeadPointerNode, OutputNode, PlayMotionSequenceNode< SIZE >, SoundNode, WalkNode, StateNode, CompareTrans< T >, CompletionTrans, EventTrans, NullTrans, SmoothCompareTrans< T >, TimeOutTrans, VisualTargetCloseTrans, VisualTargetTrans, and EventGeneratorBase.

Definition at line 42 of file BehaviorBase.h.

Referenced by BehaviorActivatorControl::activate(), BehaviorSwitchControl< B, Al >::BehaviorSwitchControl(), WorldStateVelDaemon::DoStart(), WorldStateSerializerBehavior::DoStart(), WMMonitorBehavior::DoStart(), WalkControllerBehavior::DoStart(), VisualTargetTrans::DoStart(), VisualTargetCloseTrans::DoStart(), ViewWMVarsBehavior::DoStart(), ToggleHeadLightBehavior::DoStart(), TimeOutTrans::DoStart(), StateNode::DoStart(), StareAtPawBehavior2::DoStart(), StareAtPawBehavior::DoStart(), StareAtBallBehavior::DoStart(), SoundTestBehavior::DoStart(), SimpleChaseBallBehavior::DoStart(), SegCamBehavior::DoStart(), RelaxBehavior::DoStart(), RawCamBehavior::DoStart(), NullTrans::DoStart(), MotionStressTestBehavior::DoStart(), MCRepeater::DoStart(), LookForSoundBehavior::DoStart(), KinematicSampleBehavior2::DoStart(), KinematicSampleBehavior::DoStart(), HelloWorldBehavior::DoStart(), HeadPointControllerBehavior::DoStart(), HeadLevelBehavior::DoStart(), GroundPlaneBehavior::DoStart(), FreezeTestBehavior::DoStart(), FreeMemReportControl::DoStart(), FollowHeadBehavior::DoStart(), EventTrans::DoStart(), EventGeneratorBase::DoStart(), EStopControllerBehavior::DoStart(), DriveMeBehavior::DoStart(), CrashTestBehavior::DoStart(), Controller::DoStart(), CompletionTrans::DoStart(), CompareTrans< T >::DoStart(), ChaseBallBehavior::DoStart(), CameraBehavior::DoStart(), BatteryMonitorBehavior::DoStart(), AutoGetupBehavior::DoStart(), ASCIIVisionBehavior::DoStart(), AlanBehavior::DoStart(), Aibo3DControllerBehavior::DoStart(), BehaviorSwitchControl< B, Al >::startmine(), and BehaviorSwitchControlBase::startmine().

virtual void BehaviorBase::DoStop  )  [inline, virtual]
 

By default, subtracts from the reference counter (RemoveReference()), and thus may deletex if zero; Don't forget to still call this when you override this; Warning: call this at the end of your DoStop(), not beginning (it might delete this ).

Reimplemented in Controller, FreeMemReportControl, AlanBehavior, ASCIIVisionBehavior, AutoGetupBehavior, BanditMachine, BanditMachine::PressNode, BanditMachine::WaitNode, BatteryMonitorBehavior, CameraBehavior, ChaseBallBehavior, DriveMeBehavior, ExploreMachine, FollowHeadBehavior, GroundPlaneBehavior, HeadLevelBehavior, KinematicSampleBehavior, KinematicSampleBehavior2, LookForSoundBehavior, MCRepeater, MotionStressTestBehavior, RelaxBehavior, SimpleChaseBallBehavior, SoundTestBehavior, StareAtBallBehavior, StareAtPawBehavior, StareAtPawBehavior2, ToggleHeadLightBehavior, WalkToTargetMachine, WorldStateVelDaemon, Aibo3DControllerBehavior, EStopControllerBehavior, HeadPointControllerBehavior, RawCamBehavior, SegCamBehavior, ViewWMVarsBehavior, WalkControllerBehavior, WMMonitorBehavior, WorldStateSerializerBehavior, HeadPointerNode, PlayMotionSequenceNode< SIZE >, SoundNode, WalkNode, StateNode, CompareTrans< T >, CompletionTrans, EventTrans, NullTrans, TimeOutTrans, VisualTargetCloseTrans, VisualTargetTrans, and EventGeneratorBase.

Definition at line 51 of file BehaviorBase.h.

Referenced by BehaviorActivatorControl::activate(), BehaviorSwitchControl< B, Al >::BehaviorSwitchControl(), HelloWorldBehavior::DoStart(), WorldStateVelDaemon::DoStop(), WorldStateSerializerBehavior::DoStop(), WMMonitorBehavior::DoStop(), WalkControllerBehavior::DoStop(), VisualTargetTrans::DoStop(), VisualTargetCloseTrans::DoStop(), ViewWMVarsBehavior::DoStop(), TimeOutTrans::DoStop(), StateNode::DoStop(), StareAtPawBehavior2::DoStop(), StareAtPawBehavior::DoStop(), StareAtBallBehavior::DoStop(), SoundTestBehavior::DoStop(), SimpleChaseBallBehavior::DoStop(), SegCamBehavior::DoStop(), RelaxBehavior::DoStop(), RawCamBehavior::DoStop(), NullTrans::DoStop(), MotionStressTestBehavior::DoStop(), MCRepeater::DoStop(), LookForSoundBehavior::DoStop(), KinematicSampleBehavior2::DoStop(), KinematicSampleBehavior::DoStop(), HeadPointControllerBehavior::DoStop(), HeadLevelBehavior::DoStop(), GroundPlaneBehavior::DoStop(), FreeMemReportControl::DoStop(), FollowHeadBehavior::DoStop(), EventTrans::DoStop(), EventGeneratorBase::DoStop(), EStopControllerBehavior::DoStop(), DriveMeBehavior::DoStop(), Controller::DoStop(), CompletionTrans::DoStop(), CompareTrans< T >::DoStop(), ChaseBallBehavior::DoStop(), CameraBehavior::DoStop(), BatteryMonitorBehavior::DoStop(), AutoGetupBehavior::DoStop(), ASCIIVisionBehavior::DoStop(), AlanBehavior::DoStop(), Aibo3DControllerBehavior::DoStop(), BehaviorSwitchControl< B, Al >::stopother(), BehaviorSwitchControlBase::stopother(), ~BehaviorBase(), and BehaviorSwitchControlBase::BehaviorGroup::~BehaviorGroup().

std::string BehaviorBase::getClassDescription  )  [inline, static]
 

Gives a short description of what this class of behaviors does... you should override this (but don't have to).

Reimplemented in Controller, AlanBehavior, ASCIIVisionBehavior, AutoGetupBehavior, BanditMachine, BatteryMonitorBehavior, CameraBehavior, ChaseBallBehavior, CrashTestBehavior, DriveMeBehavior, FollowHeadBehavior, FreezeTestBehavior, GroundPlaneBehavior, HeadLevelBehavior, HelloWorldBehavior, KinematicSampleBehavior, KinematicSampleBehavior2, LookForSoundBehavior, MCRepeater, MotionStressTestBehavior, SoundTestBehavior, StareAtBallBehavior, StareAtPawBehavior, StareAtPawBehavior2, ToggleHeadLightBehavior, WalkToTargetMachine, WorldStateVelDaemon, Aibo3DControllerBehavior, EStopControllerBehavior, HeadPointControllerBehavior, RawCamBehavior, SegCamBehavior, ViewWMVarsBehavior, WalkControllerBehavior, WMMonitorBehavior, WorldStateSerializerBehavior, BallDetectionGenerator, CDTGenerator, InterleavedYUVGenerator, JPEGGenerator, RawCameraGenerator, RegionGenerator, RLEGenerator, and SegmentedColorGenerator.

Definition at line 77 of file BehaviorBase.h.

Referenced by getDescription().

virtual std::string BehaviorBase::getDescription  )  const [inline, virtual]
 

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 getClassDescription().

Reimplemented in StateNode.

Definition at line 80 of file BehaviorBase.h.

Referenced by BehaviorSwitchControl< B, Al >::getDescription(), and BehaviorSwitchControlBase::getDescription().

virtual std::string BehaviorBase::getName  )  const [pure virtual]
 

Identifies the behavior in menus and such.

Implemented in Controller, FreeMemReportControl, AlanBehavior, ASCIIVisionBehavior, AutoGetupBehavior, BatteryMonitorBehavior, CameraBehavior, ChaseBallBehavior, CrashTestBehavior, DriveMeBehavior, FollowHeadBehavior, FreezeTestBehavior, GroundPlaneBehavior, HeadLevelBehavior, HelloWorldBehavior, KinematicSampleBehavior, KinematicSampleBehavior2, LookForSoundBehavior, MCRepeater, MotionStressTestBehavior, RelaxBehavior, SimpleChaseBallBehavior, SoundTestBehavior, StareAtBallBehavior, StareAtPawBehavior, StareAtPawBehavior2, ToggleHeadLightBehavior, WorldStateVelDaemon, Aibo3DControllerBehavior, EStopControllerBehavior, HeadPointControllerBehavior, RawCamBehavior, SegCamBehavior, ViewWMVarsBehavior, WalkControllerBehavior, WMMonitorBehavior, WorldStateSerializerBehavior, StateNode, CompareTrans< T >, CompletionTrans, EventTrans, NullTrans, SmoothCompareTrans< T >, TimeOutTrans, VisualTargetCloseTrans, VisualTargetTrans, and EventGeneratorBase.

Referenced by BehaviorSwitchControlBase::getName().

virtual bool BehaviorBase::isActive  )  const [inline, virtual]
 

Returns true if the behavior is currently running.

Definition at line 83 of file BehaviorBase.h.

Referenced by BehaviorActivatorControl::activate(), BehaviorSwitchControl< B, Al >::BehaviorSwitchControl(), FreeMemReportControl::getName(), BehaviorSwitchControlBase::getName(), BehaviorSwitchControlBase::isRunning(), PlayMotionSequenceNode< SIZE >::setFile(), BehaviorSwitchControl< B, Al >::startmine(), BehaviorSwitchControl< B, Al >::stopother(), BehaviorSwitchControlBase::stopother(), FollowHeadBehavior::~FollowHeadBehavior(), and StateNode::~StateNode().

BehaviorBase& BehaviorBase::operator= const BehaviorBase b  )  [inline]
 

assignment operator; assumes subclass handles assignment appropriately - i.e. if b is active, the copy will be as well, even though DoStart was never called..

Definition at line 31 of file BehaviorBase.h.

Referenced by Transition::operator=().

virtual void BehaviorBase::processEvent const EventBase  )  [inline, virtual]
 

By defining here, allows you to get away with not supplying a processEvent() function for the EventListener interface. By default, does nothing.

Implements EventListener.

Reimplemented in Controller, FreeMemReportControl, AlanBehavior, ASCIIVisionBehavior, AutoGetupBehavior, BanditMachine::WaitNode, BatteryMonitorBehavior, CameraBehavior, ChaseBallBehavior, DriveMeBehavior, ExploreMachine, FollowHeadBehavior, GroundPlaneBehavior, HeadLevelBehavior, KinematicSampleBehavior, KinematicSampleBehavior2, LookForSoundBehavior, MCRepeater, MotionStressTestBehavior, SimpleChaseBallBehavior, SoundTestBehavior, StareAtBallBehavior, StareAtPawBehavior, StareAtPawBehavior2, WalkToTargetMachine, WorldStateVelDaemon, EStopControllerBehavior, HeadPointControllerBehavior, RawCamBehavior, SegCamBehavior, WalkControllerBehavior, WMMonitorBehavior, WorldStateSerializerBehavior, HeadPointerNode, PlayMotionSequenceNode< SIZE >, SoundNode, CompareTrans< T >, CompletionTrans, EventTrans, NullTrans, SmoothCompareTrans< T >, TimeOutTrans, VisualTargetCloseTrans, VisualTargetTrans, BallDetectionGenerator, CDTGenerator, FilterBankGenerator, InterleavedYUVGenerator, JPEGGenerator, RawCameraGenerator, RegionGenerator, RLEGenerator, and SegmentedColorGenerator.

Definition at line 60 of file BehaviorBase.h.


Member Data Documentation

bool BehaviorBase::started [protected]
 

true when the behavior is active

Definition at line 86 of file BehaviorBase.h.

Referenced by BehaviorBase(), DoStart(), DoStop(), and operator=().


The documentation for this class was generated from the following file:

Tekkotsu v2.2
Generated Tue Oct 19 14:20:15 2004 by Doxygen 1.3.9.1