Tekkotsu Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
ReferenceCounter Class ReferencePerforms simple reference counting, will delete the object when removing the last reference. More...
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 17 of file ReferenceCounter.h.
Constructor & Destructor Documentation
constructor Definition at line 20 of file ReferenceCounter.h.
copy constructor - uses autodelete setting of rc, but references will still start at 0 Definition at line 22 of file ReferenceCounter.h.
destructor - will std::cout a warning if still has references Definition at line 27 of file ReferenceCounter.h. Member Function Documentation
adds one to references Definition at line 33 of file ReferenceCounter.h. Referenced by StateNode::addNode(), StateNode::addTransition(), BehaviorSwitchControlBase::BehaviorSwitchControlBase(), Transition::doFire(), RandomTrans::fire(), BehaviorActivatorControl::init(), BehaviorSwitchControlBase::setGroup(), ToggleControl::setRadioGroup(), BehaviorBase::start(), and BehaviorSwitchControl< B, Al >::startmine().
returns RC_autodelete Definition at line 54 of file ReferenceCounter.h. Referenced by BehaviorBase::start().
returns the number of references
Definition at line 49 of file ReferenceCounter.h.
assignment operator - does nothing because the reference count shouldn't be copied Definition at line 24 of file ReferenceCounter.h.
subtracts one from references AND DELETES the object IF ZERO (and RC_autodelete is set)
Definition at line 36 of file ReferenceCounter.h. Referenced by BehaviorSwitchControl< B, Al >::behaviorStopped(), BehaviorSwitchControl< B, Al >::BehaviorSwitchControl(), Transition::doFire(), RandomTrans::fire(), BehaviorSwitchControlBase::setGroup(), ToggleControl::setRadioGroup(), BehaviorBase::start(), BehaviorBase::stop(), BehaviorActivatorControl::~BehaviorActivatorControl(), BehaviorSwitchControl< B, Al >::~BehaviorSwitchControl(), and BehaviorSwitchControlBase::~BehaviorSwitchControlBase().
if true, next time a removeReference() causes references to hit 0, the object will delete itself Definition at line 52 of file ReferenceCounter.h. Referenced by FreeMemReportControl::init(), BehaviorBase::start(), XWalkEdit::XWalkEdit(), and BehaviorBase::~BehaviorBase(). Member Data Documentation
if false, prevents deletion when counter hits 0 (needed in case of stack allocation or if the subclass is a direct member variable of another class) Definition at line 61 of file ReferenceCounter.h. Referenced by getAutoDelete(), removeReference(), and setAutoDelete().
the current number of references Definition at line 58 of file ReferenceCounter.h. Referenced by addReference(), getReferences(), removeReference(), and ~ReferenceCounter(). The documentation for this class was generated from the following file: |
Tekkotsu v5.1CVS |
Generated Mon May 9 04:59:15 2016 by Doxygen 1.6.3 |