public |
Inheritance Graph
graph BT
ReferenceCounter
click ReferenceCounter "classUtil_1_1ReferenceCounter"
Description
Base class for reference-counted classes.
Base class that can be used to create reference-counted classes. Let a class inherit ReferenceCounter to make that class reference-counted. It is non-virtual to be usable from subclasses that are non-virtual as well.
Parameters
- Obj_t
- The inheriting class
- ObjReleaseHandler_t
- A class with a function
static void release(Obj_t *)
Protected Types
typedef ReferenceCounter < Obj_t, ObjReleaseHandler_t > | ReferenceCounter_t Type definition for this class. It can be used to call a parent’s constructor from the inheriting class. |
Public Types
typedef Reference < Obj_t > | ref_t Type definition for a reference to an object of the inheriting class. |
Public Functions
ReferenceCounter() Default constructor. |
|
ReferenceCounter(const ReferenceCounter & void) Copy constructor (counter of the new object must be zero) |
|
ReferenceCounter( ReferenceCounter && void) Forbid move constructor. |
|
ReferenceCounter & | operator=(const ReferenceCounter & void) Forbid copy assignment. |
ReferenceCounter & | operator=( ReferenceCounter && void) Forbid move assignment. |
int | countReferences() const Return the current number of references to this object. |
Public Static Functions
void | addReference(Obj_t * o) Increase the reference counter of object o . |
void | removeReference(Obj_t * o) Decrease the reference counter of object o . If the counter is zero, the object is released. |
void | decreaseReference(Obj_t * o) Decrease the reference counter of object o . The object is not released, even if the counter is zero. |
Documentation
typedef
Util::ReferenceCounter::ReferenceCounter_t
protected |
typedef ReferenceCounter < Obj_t, ObjReleaseHandler_t > ReferenceCounter_t |
Type definition for this class. It can be used to call a parent’s constructor from the inheriting class.
Defined in Util/ReferenceCounter.h:42
typedef
Util::ReferenceCounter::ref_t
public |
typedef Reference < Obj_t > ref_t |
Type definition for a reference to an object of the inheriting class.
Defined in Util/ReferenceCounter.h:46
function
Util::ReferenceCounter::ReferenceCounter
public | inline |
ReferenceCounter( | ) |
Default constructor.
Defined in Util/ReferenceCounter.h:49
function
Util::ReferenceCounter::ReferenceCounter
public | inline |
ReferenceCounter( | const ReferenceCounter & | void ) |
Copy constructor (counter of the new object must be zero)
Defined in Util/ReferenceCounter.h:52
function
Util::ReferenceCounter::ReferenceCounter
public |
ReferenceCounter( | ReferenceCounter && | void ) |
Forbid move constructor.
Defined in Util/ReferenceCounter.h:55
function
Util::ReferenceCounter::operator=
public |
ReferenceCounter & operator=( | const ReferenceCounter & | void ) |
Forbid copy assignment.
Defined in Util/ReferenceCounter.h:58
function
Util::ReferenceCounter::operator=
public |
ReferenceCounter & operator=( | ReferenceCounter && | void ) |
Forbid move assignment.
Defined in Util/ReferenceCounter.h:61
function
Util::ReferenceCounter::countReferences
public | const | inline |
int countReferences( | ) const |
Return the current number of references to this object.
Defined in Util/ReferenceCounter.h:64
function
Util::ReferenceCounter::addReference
public | static | inline |
void addReference( | Obj_t * | o ) |
Increase the reference counter of objecto
.
Defined in Util/ReferenceCounter.h:67
function
Util::ReferenceCounter::removeReference
public | static | inline |
void removeReference( | Obj_t * | o ) |
Decrease the reference counter of objecto
. If the counter is zero, the object is released.
Defined in Util/ReferenceCounter.h:70
function
Util::ReferenceCounter::decreaseReference
public | static | inline |
void decreaseReference( | Obj_t * | o ) |
Decrease the reference counter of objecto
. The object is not released, even if the counter is zero.
Defined in Util/ReferenceCounter.h:73