Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

BehaviorSwitchControlBase Class Reference

Holds some utility classes and functions for BehaviorSwitchControl which shouldn't be stored in a templated class. More...

#include <BehaviorSwitchControl.h>

Inheritance diagram for BehaviorSwitchControlBase:

Detailed Description

Holds some utility classes and functions for BehaviorSwitchControl which shouldn't be stored in a templated class.

Definition at line 11 of file BehaviorSwitchControl.h.

List of all members.

Classes

class  BehaviorGroup
 A simple utility class to allow the BehaviorSwitchControl's to be able to deactivate the current behavior when a new one becomes active. More...

Public Member Functions

 BehaviorSwitchControlBase (const std::string &n, BehaviorBase *beh, BehaviorGroup *bg=NULL)
 constructor
 BehaviorSwitchControlBase (BehaviorBase *beh, BehaviorGroup *bg=NULL)
 constructor, behavior must not be NULL
virtual ~BehaviorSwitchControlBase ()
 destructor
virtual BehaviorSwitchControlBasestart ()
 activates the behavior, handy for making start-up behaviors that you can turn off again with the Controller
virtual BehaviorSwitchControlBasestop ()
 stops the behavior
virtual BehaviorSwitchControlBasetoggle ()
 toggles the behavior
virtual ControlBasetakeInput (const std::string &msg)
 called when the user has supplied a text string (may or may not have been prompted by doReadStdIn()! May not even be active yet - the user can direct the same input to a set of hilighted menus)
virtual void setGroup (BehaviorGroup *bg)
 Reassigns the behavior group, pass NULL to remove from group.
virtual ControlBaseactivate (MC_ID display, Socket *gui)
 tells the current behavior (if there is one) to stop then loads its own
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
virtual bool isRunning () const
 Returns true if the associated behavior is running.

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 void notifyGroupMembers ()
 updates other members in the group that the current behavior stopped -- do not call if behgrp is NULL
virtual void behaviorStopped ()
 called by notifyGroupMembers if mybeh was destructed when stopped

Protected Attributes

BehaviorGroupbehgrp
 the behavior group this belongs to. Uses this to track the "current" behavior
BehaviorBasemybeh
 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

 BehaviorSwitchControlBase (const BehaviorSwitchControlBase &)
 shouldn't copy these
BehaviorSwitchControlBase operator= (const BehaviorSwitchControlBase &)
 shouldn't assign these

Constructor & Destructor Documentation

BehaviorSwitchControlBase::BehaviorSwitchControlBase ( const std::string &  n,
BehaviorBase beh,
BehaviorGroup bg = NULL 
)

constructor

Definition at line 33 of file BehaviorSwitchControl.h.

BehaviorSwitchControlBase::BehaviorSwitchControlBase ( BehaviorBase beh,
BehaviorGroup bg = NULL 
)

constructor, behavior must not be NULL

Definition at line 46 of file BehaviorSwitchControl.h.

virtual BehaviorSwitchControlBase::~BehaviorSwitchControlBase (  )  [virtual]

destructor

Definition at line 56 of file BehaviorSwitchControl.h.

BehaviorSwitchControlBase::BehaviorSwitchControlBase ( const BehaviorSwitchControlBase  )  [private]

shouldn't copy these


Member Function Documentation

ControlBase * BehaviorSwitchControlBase::activate ( MC_ID  display,
Socket gui 
) [virtual]

tells the current behavior (if there is one) to stop then loads its own

Returns:
NULL unless there are submenus

Reimplemented from ControlBase.

Definition at line 32 of file BehaviorSwitchControl.cc.

virtual void BehaviorSwitchControlBase::behaviorStopped (  )  [protected, virtual]

called by notifyGroupMembers if mybeh was destructed when stopped

Reimplemented in BehaviorSwitchControl< B, Al >.

Definition at line 104 of file BehaviorSwitchControl.h.

Referenced by stopother().

std::string BehaviorSwitchControlBase::getDescription (  )  const [virtual]

returns a short description of what the control does

Reimplemented from ControlBase.

Reimplemented in BehaviorSwitchControl< B, Al >.

Definition at line 46 of file BehaviorSwitchControl.cc.

std::string BehaviorSwitchControlBase::getName (  )  const [virtual]

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

Reimplemented from ControlBase.

Reimplemented in BehaviorSwitchControl< B, Al >.

Definition at line 40 of file BehaviorSwitchControl.cc.

bool BehaviorSwitchControlBase::isRunning (  )  const [virtual]

Returns true if the associated behavior is running.

Reimplemented in BehaviorSwitchControl< B, Al >.

Definition at line 52 of file BehaviorSwitchControl.cc.

Referenced by Aibo3DControllerBehavior::doStart(), BehaviorSwitchControl< B, Al >::isRunning(), start(), stop(), takeInput(), and toggle().

void BehaviorSwitchControlBase::notifyGroupMembers (  )  [protected, virtual]

updates other members in the group that the current behavior stopped -- do not call if behgrp is NULL

Definition at line 80 of file BehaviorSwitchControl.cc.

Referenced by setGroup(), and stopother().

BehaviorSwitchControlBase BehaviorSwitchControlBase::operator= ( const BehaviorSwitchControlBase  )  [private]

shouldn't assign these

void BehaviorSwitchControlBase::setGroup ( BehaviorGroup bg  )  [virtual]

Reassigns the behavior group, pass NULL to remove from group.

If this behavior is active and the new group already has an active behavior, the new group's active behavior is stopped first.

Definition at line 13 of file BehaviorSwitchControl.cc.

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

virtual BehaviorSwitchControlBase* BehaviorSwitchControlBase::start (  )  [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

Definition at line 67 of file BehaviorSwitchControl.h.

Referenced by Aibo3DControllerBehavior::doStart().

void BehaviorSwitchControlBase::startmine (  )  [protected, virtual]

Starts our behavior.

Reimplemented in BehaviorSwitchControl< B, Al >.

Definition at line 74 of file BehaviorSwitchControl.cc.

Referenced by start(), takeInput(), and toggle().

virtual BehaviorSwitchControlBase* BehaviorSwitchControlBase::stop (  )  [virtual]
void BehaviorSwitchControlBase::stopother (  )  [protected, virtual]

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

Definition at line 59 of file BehaviorSwitchControl.cc.

Referenced by BehaviorSwitchControl< B, Al >::isRunning(), start(), stop(), and toggle().

ControlBase * BehaviorSwitchControlBase::takeInput ( const std::string &  msg  )  [virtual]

called when the user has supplied a text string (may or may not have been prompted by doReadStdIn()! May not even be active yet - the user can direct the same input to a set of hilighted menus)

The value which is returned is then activate()ed and pushed on the Controller's stack

Reimplemented from ControlBase.

Definition at line 4 of file BehaviorSwitchControl.cc.

virtual BehaviorSwitchControlBase* BehaviorSwitchControlBase::toggle (  )  [virtual]

toggles the behavior

Definition at line 73 of file BehaviorSwitchControl.h.

Referenced by activate().


Member Data Documentation

the behavior group this belongs to. Uses this to track the "current" behavior

Definition at line 106 of file BehaviorSwitchControl.h.

Referenced by notifyGroupMembers(), setGroup(), startmine(), and stopother().


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

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:05 2016 by Doxygen 1.6.3