MADARA
3.1.8
|
This template class provides transparent reference counting of its template parameter T. More...
#include <IteratorImpl.h>
Classes | |
struct | Shim |
A shim class that keeps track of the reference count and a pointer to the type T that's reference counted. More... | |
Public Member Functions | |
Refcounter (void) | |
default Ctor More... | |
Refcounter (T *ptr, bool increase_count=false) | |
Ctor with refcounting functionality. More... | |
Refcounter (const Refcounter &rhs) | |
copy Ctor More... | |
virtual | ~Refcounter (void) |
Dtor will delete pointer if refcount becomes 0. More... | |
T * | get (void) |
get the underlying pointer More... | |
const T * | get (void) const |
get the underlying pointer More... | |
T * | get_ptr (void) |
get the underlying pointer More... | |
const T * | get_ptr (void) const |
get the underlying pointer More... | |
T & | operator* (void) |
dereference operator More... | |
const T & | operator* (void) const |
dereference operator More... | |
T * | operator-> (void) |
mimic pointer dereferencing More... | |
const T * | operator-> (void) const |
mimic pointer dereferencing More... | |
void | operator= (T *ptr) |
assignment operator for times when you don't want the reference increased for incoming ptr More... | |
void | operator= (const Refcounter &rhs) |
assignment operator More... | |
Private Member Functions | |
void | decrement (void) |
implementation of the decrement operation More... | |
void | increment (void) |
implementation of the increment operation More... | |
Private Attributes | |
Shim * | ptr_ |
Pointer to the Shim. More... | |
This template class provides transparent reference counting of its template parameter T.
This differs from ScopedArray in the type of memory it is meant to manage. Refcounter manages single object instances. ScopedArray manages an array of instances,
This class can be used to automate the implementation of the Bridge pattern in C++.
Definition at line 17 of file IteratorImpl.h.
madara::utility::Refcounter< T >::Refcounter | ( | void | ) |
default Ctor
Definition at line 9 of file Refcounter.cpp.
madara::utility::Refcounter< T >::Refcounter | ( | T * | ptr, |
bool | increase_count = false |
||
) |
Ctor with refcounting functionality.
Definition at line 16 of file Refcounter.cpp.
madara::utility::Refcounter< T >::Refcounter | ( | const Refcounter< T > & | rhs | ) |
copy Ctor
Definition at line 25 of file Refcounter.cpp.
|
virtual |
Dtor will delete pointer if refcount becomes 0.
Definition at line 33 of file Refcounter.cpp.
|
inlineprivate |
implementation of the decrement operation
Definition at line 139 of file Refcounter.cpp.
T * madara::utility::Refcounter< T >::get | ( | void | ) |
get the underlying pointer
Definition at line 80 of file Refcounter.cpp.
const T * madara::utility::Refcounter< T >::get | ( | void | ) | const |
get the underlying pointer
Definition at line 88 of file Refcounter.cpp.
T * madara::utility::Refcounter< T >::get_ptr | ( | void | ) |
get the underlying pointer
Definition at line 64 of file Refcounter.cpp.
const T * madara::utility::Refcounter< T >::get_ptr | ( | void | ) | const |
get the underlying pointer
Definition at line 72 of file Refcounter.cpp.
|
inlineprivate |
implementation of the increment operation
Definition at line 130 of file Refcounter.cpp.
|
inline |
dereference operator
Definition at line 97 of file Refcounter.cpp.
|
inline |
dereference operator
Definition at line 106 of file Refcounter.cpp.
|
inline |
mimic pointer dereferencing
Definition at line 114 of file Refcounter.cpp.
|
inline |
mimic pointer dereferencing
Definition at line 122 of file Refcounter.cpp.
void madara::utility::Refcounter< T >::operator= | ( | T * | ptr | ) |
assignment operator for times when you don't want the reference increased for incoming ptr
assignment operator for times when you don't want the reference increased for incoming ptr.
Definition at line 42 of file Refcounter.cpp.
void madara::utility::Refcounter< T >::operator= | ( | const Refcounter< T > & | rhs | ) |
assignment operator
Definition at line 51 of file Refcounter.cpp.
|
private |
Pointer to the Shim.
Definition at line 92 of file Refcounter.h.