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

BehaviorSwitchControl< B, Al > Class Template Reference

#include <BehaviorSwitchControl.h>

Inheritance diagram for BehaviorSwitchControl< B, Al >:

Inheritance graph
[legend]
List of all members.

Detailed Description

template<class B, class Al = Factory< B >>
class BehaviorSwitchControl< B, Al >

Allows proper switching between major behaviors, calling DoStart and DoStop.

Definition at line 75 of file BehaviorSwitchControl.h.

Public Member Functions

 BehaviorSwitchControl (const std::string &n, bool retain=false)
 constructor, can use this to toggle a single behavior on and off

 BehaviorSwitchControl (const std::string &n, B *beh, BehaviorGroup *bg=NULL)
 constructor, if you want to use an already constructed behavior, can pass NULL for behavior group

 BehaviorSwitchControl (const std::string &n, BehaviorGroup *bg, bool retain=false)
 constructor, needs to know what group its in and whether to retain its behavior

virtual ~BehaviorSwitchControl ()
 destructor

virtual BehaviorSwitchControl<
B, Al > * 
start ()
 activates the behavior, handy for making start-up behaviors that you can turn off again with the Controller

virtual BehaviorSwitchControl<
B, Al > * 
stop ()
 stops the behavior

virtual BehaviorSwitchControl<
B, Al > * 
toggle ()
 toggles the behavior

virtual std::string getName () const
 adds a status to the name: - if in memory, # if running

virtual std::string getDescription () const
 returns a short description of what the control does


Protected Member Functions

virtual void stopother ()
 Stops the "other" guy's behavior - if ::behgrp is NULL, stops ourselves.

virtual void startmine ()
 Starts our behavior.

virtual bool isRunning () const
 Returns true if the associated behavior is running.

virtual bool isValid () const
 Returns true if mybeh is pointing to a valid object.


Protected Attributes

B * mybeh
 used to store the behavior. If retained and non-NULL, will be valid. However, if not retained, only valid if equals behgrp->curBehavior


Private Member Functions

 BehaviorSwitchControl (const BehaviorSwitchControl &)
 shouldn't call this

BehaviorSwitchControl operator= (const BehaviorSwitchControl &)
 shouldn't call this


Constructor & Destructor Documentation

template<class B, class Al = Factory< B >>
BehaviorSwitchControl< B, Al >::BehaviorSwitchControl const std::string &  n,
bool  retain = false
[inline]
 

constructor, can use this to toggle a single behavior on and off

Definition at line 78 of file BehaviorSwitchControl.h.

References BehaviorSwitchControl< B, Al >::mybeh.

template<class B, class Al = Factory< B >>
BehaviorSwitchControl< B, Al >::BehaviorSwitchControl const std::string &  n,
B *  beh,
BehaviorGroup *  bg = NULL
[inline]
 

constructor, if you want to use an already constructed behavior, can pass NULL for behavior group

Definition at line 81 of file BehaviorSwitchControl.h.

References BehaviorSwitchControl< B, Al >::mybeh, and BehaviorSwitchControlBase::retained.

template<class B, class Al = Factory< B >>
BehaviorSwitchControl< B, Al >::BehaviorSwitchControl const std::string &  n,
BehaviorGroup *  bg,
bool  retain = false
[inline]
 

constructor, needs to know what group its in and whether to retain its behavior

Definition at line 88 of file BehaviorSwitchControl.h.

References BehaviorSwitchControl< B, Al >::mybeh.

template<class B, class Al = Factory< B >>
virtual BehaviorSwitchControl< B, Al >::~BehaviorSwitchControl  )  [inline, virtual]
 

destructor

Definition at line 92 of file BehaviorSwitchControl.h.

References BehaviorSwitchControl< B, Al >::mybeh, BehaviorSwitchControlBase::retained, and BehaviorSwitchControl< B, Al >::stop().

template<class B, class Al = Factory< B >>
BehaviorSwitchControl< B, Al >::BehaviorSwitchControl const BehaviorSwitchControl< B, Al > &   )  [private]
 

shouldn't call this


Member Function Documentation

template<class B, class Al = Factory< B >>
virtual std::string BehaviorSwitchControl< B, Al >::getDescription  )  const [inline, virtual]
 

returns a short description of what the control does

Reimplemented from ControlBase.

Definition at line 111 of file BehaviorSwitchControl.h.

References BehaviorSwitchControl< B, Al >::isValid(), and BehaviorSwitchControl< B, Al >::mybeh.

template<class B, class Al = Factory< B >>
virtual std::string BehaviorSwitchControl< B, Al >::getName  )  const [inline, virtual]
 

adds a status to the name: - if in memory, # if running

Reimplemented from ControlBase.

Definition at line 105 of file BehaviorSwitchControl.h.

References ControlBase::getName(), BehaviorSwitchControl< B, Al >::isValid(), and BehaviorSwitchControl< B, Al >::mybeh.

template<class B, class Al = Factory< B >>
virtual bool BehaviorSwitchControl< B, Al >::isRunning  )  const [inline, protected, virtual]
 

Returns true if the associated behavior is running.

Definition at line 156 of file BehaviorSwitchControl.h.

References BehaviorSwitchControlBase::behgrp, and BehaviorSwitchControl< B, Al >::mybeh.

template<class B, class Al = Factory< B >>
virtual bool BehaviorSwitchControl< B, Al >::isValid  )  const [inline, protected, virtual]
 

Returns true if mybeh is pointing to a valid object.

Definition at line 167 of file BehaviorSwitchControl.h.

References BehaviorSwitchControl< B, Al >::isRunning(), and BehaviorSwitchControlBase::retained.

template<class B, class Al = Factory< B >>
BehaviorSwitchControl BehaviorSwitchControl< B, Al >::operator= const BehaviorSwitchControl< B, Al > &   )  [private]
 

shouldn't call this

template<class B, class Al = Factory< B >>
virtual BehaviorSwitchControl<B,Al>* BehaviorSwitchControl< B, Al >::start  )  [inline, virtual]
 

activates the behavior, handy for making start-up behaviors that you can turn off again with the Controller

If you start twice without stopping (ie it's already running), shouldn't do anything

Implements BehaviorSwitchControlBase.

Definition at line 98 of file BehaviorSwitchControl.h.

References BehaviorSwitchControl< B, Al >::isRunning(), BehaviorSwitchControl< B, Al >::startmine(), and BehaviorSwitchControl< B, Al >::stopother().

template<class B, class Al = Factory< B >>
virtual void BehaviorSwitchControl< B, Al >::startmine  )  [inline, protected, virtual]
 

Starts our behavior.

Definition at line 139 of file BehaviorSwitchControl.h.

References BehaviorSwitchControlBase::behgrp, BehaviorSwitchControl< B, Al >::mybeh, and BehaviorSwitchControlBase::retained.

template<class B, class Al = Factory< B >>
virtual BehaviorSwitchControl<B,Al>* BehaviorSwitchControl< B, Al >::stop  )  [inline, virtual]
 

stops the behavior

Implements BehaviorSwitchControlBase.

Definition at line 100 of file BehaviorSwitchControl.h.

References BehaviorSwitchControl< B, Al >::isRunning(), and BehaviorSwitchControl< B, Al >::stopother().

template<class B, class Al = Factory< B >>
virtual void BehaviorSwitchControl< B, Al >::stopother  )  [inline, protected, virtual]
 

Stops the "other" guy's behavior - if ::behgrp is NULL, stops ourselves.

Definition at line 122 of file BehaviorSwitchControl.h.

References ASSERT, BehaviorSwitchControlBase::behgrp, BehaviorSwitchControl< B, Al >::mybeh, and BehaviorSwitchControlBase::retained.

template<class B, class Al = Factory< B >>
virtual BehaviorSwitchControl<B,Al>* BehaviorSwitchControl< B, Al >::toggle  )  [inline, virtual]
 

toggles the behavior

Implements BehaviorSwitchControlBase.

Definition at line 102 of file BehaviorSwitchControl.h.

References BehaviorSwitchControl< B, Al >::isRunning(), BehaviorSwitchControl< B, Al >::startmine(), and BehaviorSwitchControl< B, Al >::stopother().


Member Data Documentation

template<class B, class Al = Factory< B >>
B* BehaviorSwitchControl< B, Al >::mybeh [protected]
 

used to store the behavior. If retained and non-NULL, will be valid. However, if not retained, only valid if equals behgrp->curBehavior

Definition at line 173 of file BehaviorSwitchControl.h.


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