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

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 this behavior... otherwise you'll get memory leaks

Definition at line 12 of file BehaviorBase.h.

Public Member Functions

 BehaviorBase ()
 constructor

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, and deletes if zero
Note:
you should 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 &)
 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).

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 15 of file BehaviorBase.h.

References started.

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

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

Definition at line 17 of file BehaviorBase.h.

References DoStop(), ReferenceCounter::SetAutoDelete(), and started.


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, Aibo3DControllerBehavior, AutoGetupBehavior, BanditMachine, BanditMachine::PressNode, BanditMachine::DecideNode, BanditMachine::WaitNode, BatteryMonitorBehavior, CameraBehavior, ChaseBallBehavior, DriveMeBehavior, DumbWM2Behavior, EStopControllerBehavior, EvtRptBehavior, FollowHeadBehavior, HeadLevelBehavior, HeadPointControllerBehavior, SimpleChaseBallBehavior, SoundTestBehavior, StareAtBallBehavior, ToggleHeadLightBehavior, WalkControllerBehavior, WalkToTargetMachine, WorldModel2Behavior, WorldModel2Behavior::WalkNode, WorldModel2Behavior::GawkNode, WorldModel2Behavior::WaitNode, OutputNode, StateNode, and StartupBehavior.

Definition at line 19 of file BehaviorBase.h.

References ReferenceCounter::AddReference(), and started.

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

By default, subtracts from the reference counter, and deletes if zero

Note:
you should 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, Aibo3DControllerBehavior, AutoGetupBehavior, BanditMachine, BanditMachine::PressNode, BanditMachine::WaitNode, BatteryMonitorBehavior, CameraBehavior, ChaseBallBehavior, DriveMeBehavior, DumbWM2Behavior, EStopControllerBehavior, EvtRptBehavior, FollowHeadBehavior, HeadLevelBehavior, HeadPointControllerBehavior, SimpleChaseBallBehavior, SoundTestBehavior, StareAtBallBehavior, ToggleHeadLightBehavior, WalkControllerBehavior, WalkToTargetMachine, WorldModel2Behavior, WorldModel2Behavior::WalkNode, WorldModel2Behavior::GawkNode, WorldModel2Behavior::WaitNode, StateNode, and StartupBehavior.

Definition at line 21 of file BehaviorBase.h.

References ReferenceCounter::RemoveReference(), and started.

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, Aibo3DControllerBehavior, Aibo3DMonitorBehavior, AutoGetupBehavior, BanditMachine, BatteryMonitorBehavior, CameraBehavior, ChaseBallBehavior, DriveMeBehavior, DumbWM2Behavior, EStopControllerBehavior, EvtRptBehavior, FollowHeadBehavior, HeadLevelBehavior, HeadPointControllerBehavior, SoundTestBehavior, StareAtBallBehavior, ToggleHeadLightBehavior, WalkControllerBehavior, WalkToTargetMachine, WorldModel2Behavior, and StartupBehavior.

Definition at line 30 of file BehaviorBase.h.

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

Reimplemented in StateNode.

Definition at line 33 of file BehaviorBase.h.

References getClassDescription().

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

Identifies the behavior in menus and such.

Implemented in Controller, FreeMemReportControl, Aibo3DControllerBehavior, Aibo3DMonitorBehavior, AutoGetupBehavior, BatteryMonitorBehavior, CameraBehavior, ChaseBallBehavior, DriveMeBehavior, DumbWM2Behavior, EStopControllerBehavior, EvtRptBehavior, FollowHeadBehavior, HeadLevelBehavior, HeadPointControllerBehavior, SimpleChaseBallBehavior, SoundTestBehavior, StareAtBallBehavior, ToggleHeadLightBehavior, WalkControllerBehavior, StateNode, and StartupBehavior.

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

Returns true if the behavior is currently running.

Definition at line 36 of file BehaviorBase.h.

References started.

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

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, AutoGetupBehavior, BanditMachine::WaitNode, BatteryMonitorBehavior, CameraBehavior, ChaseBallBehavior, DriveMeBehavior, DumbWM2Behavior, EStopControllerBehavior, EvtRptBehavior, FollowHeadBehavior, HeadLevelBehavior, HeadPointControllerBehavior, SimpleChaseBallBehavior, SoundTestBehavior, StareAtBallBehavior, WalkControllerBehavior, WalkToTargetMachine, WorldModel2Behavior::WalkNode, WorldModel2Behavior::GawkNode, StateNode, and StartupBehavior.

Definition at line 23 of file BehaviorBase.h.


Member Data Documentation

bool BehaviorBase::started [protected]
 

true when the behavior is active

Definition at line 39 of file BehaviorBase.h.


The documentation for this class was generated from the following file:
Tekkotsu v1.4
Generated Sat Jul 19 00:08:50 2003 by Doxygen 1.3.2