Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

BehaviorBase::MonitorMotion Class Reference

An instance is created for each motion activated through addMotion(), listening in case the motion is removed by some other means, thus invalidating the MC_ID. More...

#include <BehaviorBase.h>

Inheritance diagram for BehaviorBase::MonitorMotion:

Detailed Description

An instance is created for each motion activated through addMotion(), listening in case the motion is removed by some other means, thus invalidating the MC_ID.

This specifically addresses the use of prunable motions, which could disappear any time. We don't want BehaviorBase::autoMotions filling up with dead MC_IDs, which would cause trouble when the behavior ends and it tries to re-remove the motions. (Particularly causing trouble if the MC_ID has since been reassigned to someone else!)

Definition at line 195 of file BehaviorBase.h.

List of all members.

Public Member Functions

 MonitorMotion ()
 Constructor, no-op; expects a call to monitor().
 MonitorMotion (const MonitorMotion &m)
 Copy constructor (shallow copy), begins monitoring the same MC_ID, on the assumption the original will be going away.
MonitorMotionoperator= (const MonitorMotion &m)
 Assignment (shallow copy), begins monitoring the same MC_ID, on the assumption the original will be going away.
 ~MonitorMotion ()
 Destructor, if mcid is still valid (not invalid_MC_ID), then it removes it from owner->autoMotions.
void monitor (BehaviorBase &parent, MC_ID mc_id, RCRegion *region)
 Begins listening for a (motmanEGID, mcid, deactivate) event, storing the owner so it can be updated when the motion is removed.

Protected Member Functions

virtual void processEvent (const EventBase &event)
 Assumes the event indicates the motion has been removed, so sets mcid to invalid_MC_ID and removes it from owner->autoMotions.

Protected Attributes

BehaviorBaseowner
 the behavior which created the motion in mcid
MC_ID mcid
 the motion which is being monitored for removal
RCRegionmcregion
 keep a reference to the motion region

Constructor & Destructor Documentation

BehaviorBase::MonitorMotion::MonitorMotion (  ) 

Constructor, no-op; expects a call to monitor().

Definition at line 198 of file BehaviorBase.h.

BehaviorBase::MonitorMotion::MonitorMotion ( const MonitorMotion m  ) 

Copy constructor (shallow copy), begins monitoring the same MC_ID, on the assumption the original will be going away.

Definition at line 200 of file BehaviorBase.h.

BehaviorBase::MonitorMotion::~MonitorMotion (  ) 

Destructor, if mcid is still valid (not invalid_MC_ID), then it removes it from owner->autoMotions.

Definition at line 156 of file BehaviorBase.cc.


Member Function Documentation

void BehaviorBase::MonitorMotion::monitor ( BehaviorBase parent,
MotionManager::MC_ID  mc_id,
RCRegion region 
)

Begins listening for a (motmanEGID, mcid, deactivate) event, storing the owner so it can be updated when the motion is removed.

Definition at line 164 of file BehaviorBase.cc.

Referenced by MonitorMotion(), and operator=().

MonitorMotion& BehaviorBase::MonitorMotion::operator= ( const MonitorMotion m  ) 

Assignment (shallow copy), begins monitoring the same MC_ID, on the assumption the original will be going away.

Definition at line 202 of file BehaviorBase.h.

void BehaviorBase::MonitorMotion::processEvent ( const EventBase event  )  [protected, virtual]

Assumes the event indicates the motion has been removed, so sets mcid to invalid_MC_ID and removes it from owner->autoMotions.

Note that as a result of removing the BehaviorBase::autoMotions entry, this class has also been destructed, so nothing else should happen afterward.

Implements EventListener.

Definition at line 171 of file BehaviorBase.cc.


Member Data Documentation

the motion which is being monitored for removal

Definition at line 213 of file BehaviorBase.h.

Referenced by monitor(), MonitorMotion(), operator=(), processEvent(), and ~MonitorMotion().

keep a reference to the motion region

Definition at line 214 of file BehaviorBase.h.

Referenced by monitor(), MonitorMotion(), operator=(), processEvent(), and ~MonitorMotion().

the behavior which created the motion in mcid

Definition at line 212 of file BehaviorBase.h.

Referenced by monitor(), MonitorMotion(), operator=(), and processEvent().


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