Manages Reference::To references to the instance. More...

#include <ReferenceAble.h>

Inheritance diagram for Reference::Able:
Reference::HeapTracked Registry::List< A > Alias Callback< Type > CommandLine::Item CommandLine::Menu Configuration::Parameter< T > FTransform::Agent FTransform::Bench FTransform::Plan FTransform::Plan2 FunctorBase Interpolation JenetAnderson98 JenetAnderson98::EquationA5 JenetAnderson98::Probability LogFile Mount OwnStream PolynomialFit Pulsar::Generator Pulsar::Parameters Pulsar::Parameters::Lookup Pulsar::Predictor Pulsar::Site Registry::Entry< Parent > Registry::List< Parent > RobustEstimateZapper SplineFit TemporaryFile TextEditor< T > TextIndex TextInterface::Name TextInterface::Parser TextInterface::Value TextLoop

Classes

class  Handle

Public Member Functions

 Able ()
 Default constructor.
 Able (const Able &)
 Copy constructor.
Ableoperator= (const Able &)
 Assignment operator.
virtual ~Able ()
 Destructor.
unsigned get_reference_count () const
 Returns the number of references there are to this.
Public Member Functions inherited from Reference::HeapTracked
 HeapTracked ()
 Default constructor.
 HeapTracked (const HeapTracked &)
 Copy constructor.
HeapTrackedoperator= (const HeapTracked &)
 Assignment operator.
virtual ~HeapTracked ()
 Destructor.
bool __is_on_heap () const
 Return true if this instance is found in heap addresses.

Static Public Member Functions

static size_t get_instance_count ()
 Returns the current number instances in existence.
Static Public Member Functions inherited from Reference::HeapTracked
static void * operator new (size_t size, void *ptr=0)
 Records the addresses of new instances allocated on the heap.
static void operator delete (void *location, void *ptr)
 Placement delete overload to match the placement new overload.
static void operator delete (void *location)
 Regular delete overload.
static size_t get_heap_queue_size ()
 Return the number of heap addresses awaiting processing.

Protected Member Functions

Handle__reference (bool active) const
 Add the address of a reference to this object.
void __dereference (bool auto_delete=true) const
 Remove the address of a reference to this object.

Friends

template<class Type, bool active>
class To

Detailed Description

Manages Reference::To references to the instance.

Combined with the Reference::To template class, this class may be used to eliminate both memory leaks and dangling references. Simply inherit this class as follows:

class myKlass : public Reference::Able { ... };

myKlass can now be managed using a Reference::To<myKlass>.

Member Function Documentation

◆ __dereference()

void Reference::Able::__dereference ( bool auto_delete = true) const
protected

Remove the address of a reference to this object.

Declared const in order to enable Reference::To<const Klass>

References Reference::HeapTracked::__is_on_heap().

◆ __reference()

Reference::Able::Handle * Reference::Able::__reference ( bool active) const
protected

Add the address of a reference to this object.

Declared const in order to enable Reference::To<const T>

References Reference::HeapTracked::__is_on_heap(), Able(), and Reference::Able::Handle::pointer.

Referenced by Reference::Able::Handle::copy().


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

Generated using doxygen 1.14.0