Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
ReferenceCounter Class Reference#include <ReferenceCounter.h>
Inheritance diagram for ReferenceCounter:
![]() Detailed DescriptionPerforms simple reference counting, will delete the object when removing the last reference.Remember to call SetAutoDelete(false) if you instantiate a subclass on the stack instead of the heap -- don't want to try to free memory on the stack if/when last reference is removed! (The stack limits the allocation of the behavior to the current scope, so reference counting is moot.)
Definition at line 16 of file ReferenceCounter.h.
Constructor & Destructor Documentation
copy constructor - uses autodelete setting of rc, but references will still start at 0
Definition at line 21 of file ReferenceCounter.h.
destructor - will std::cout a warning if still has references
Definition at line 26 of file ReferenceCounter.h.
Member Function Documentation
assignment operator - does nothing because the reference count shouldn't be copied
Definition at line 23 of file ReferenceCounter.h. Referenced by BehaviorBase::operator=().
adds one to references
Definition at line 32 of file ReferenceCounter.h. Referenced by StateNode::addNode(), StateNode::addTransition(), BehaviorSwitchControlBase::BehaviorSwitchControlBase(), BehaviorBase::DoStart(), Transition::fire(), RandomTrans::fire(), BehaviorActivatorControl::init(), MicrophoneServer::MicrophoneServer(), ToggleControl::setRadioGroup(), SpeakerServer::SpeakerServer(), and BehaviorSwitchControl< B, Al >::startmine().
subtracts one from references AND DELETES the object IF ZERO (and RC_autodelete is set)
Definition at line 35 of file ReferenceCounter.h. Referenced by BehaviorSwitchControl< B, Al >::behaviorStopped(), BehaviorSwitchControl< B, Al >::BehaviorSwitchControl(), BehaviorBase::DoStop(), Transition::fire(), RandomTrans::fire(), ToggleControl::setRadioGroup(), BehaviorActivatorControl::~BehaviorActivatorControl(), BehaviorSwitchControl< B, Al >::~BehaviorSwitchControl(), and BehaviorSwitchControlBase::~BehaviorSwitchControlBase().
returns the number of references
Definition at line 48 of file ReferenceCounter.h.
if true, next time a RemoveReference() causes references to hit 0, the object will delete itself
Definition at line 51 of file ReferenceCounter.h. Referenced by BehaviorBase::~BehaviorBase(), and FreeMemReportControl::~FreeMemReportControl().
Member Data Documentation
the current number of references
Definition at line 57 of file ReferenceCounter.h. Referenced by AddReference(), GetReferences(), RemoveReference(), MicrophoneServer::~MicrophoneServer(), ~ReferenceCounter(), and SpeakerServer::~SpeakerServer().
if false, prevents deletion when counter hits 0
Definition at line 60 of file ReferenceCounter.h. Referenced by GetAutoDelete(), RemoveReference(), and SetAutoDelete().
The documentation for this class was generated from the following file: |
Tekkotsu v4.0 |
Generated Thu Nov 22 00:58:38 2007 by Doxygen 1.5.4 |