A template class representing a reference counted pointer. More...
#include <refcount_ptr.h>
Public Member Functions | |
refcount_ptr (T *p=NULL) | |
~refcount_ptr () | |
refcount_ptr (const refcount_ptr &other) | |
refcount_ptr & | operator= (const refcount_ptr &other) |
operator T* () | |
T & | operator* () |
T * | operator-> () |
operator const T * () const | |
const T & | operator* () const |
const T * | operator-> () const |
bool | IsNULL () const |
Checks whether or not an object is referenced by the reference counted pointer. More... | |
bool | operator< (const refcount_ptr &other) const |
Less-than operator, e.g. for sorting. More... | |
bool | operator== (const refcount_ptr &other) const |
Equals operator. More... | |
bool | operator!= (const refcount_ptr &other) const |
Not-Equals operator. More... | |
A template class representing a reference counted pointer.
Basically, when a pointer assigned to the reference counted pointer, it increases the reference count of the pointed-to object. When the reference counted pointer is destroyed (or NULL is assigned to it), it decreases the reference count of the pointed-to object. If the reference count reaches zero, the object is deleted.
Definition at line 33 of file refcount_ptr.h.
|
inline |
Constructor for a reference counted pointer.
p | Pointer to an object; default is NULL. |
Definition at line 131 of file refcount_ptr.h.
|
inline |
The destructor causes the reference count to be decreased by one. If the reference count of the object reaches zero, it is deleted (freed).
Definition at line 143 of file refcount_ptr.h.
|
inline |
Copy constructor, which causes the reference count of the pointed-to object to be increased.
other | The reference counted pointer to copy from. |
Definition at line 154 of file refcount_ptr.h.
|
inline |
Checks whether or not an object is referenced by the reference counted pointer.
Definition at line 218 of file refcount_ptr.h.
Referenced by Component::CheckConsistency(), Component::Clone(), CycloneVHMachine::Create(), HP700RXMachine::Create(), MVME187Machine::Create(), RISCVvirtMachine::Create(), TestM88KMachine::Create(), GXemul::DumpMachineAsHTML(), ListComponentsCommand::Execute(), GXemul::GenerateHTMLListOfComponents(), FileLoader::Load(), ComponentFactory::RegisterComponentClass(), and GXemul::SetRootComponent().
|
inline |
Definition at line 196 of file refcount_ptr.h.
|
inline |
Definition at line 181 of file refcount_ptr.h.
|
inline |
Not-Equals operator.
other | The reference counted pointer to compare this object to. |
Definition at line 258 of file refcount_ptr.h.
|
inline |
Definition at line 186 of file refcount_ptr.h.
|
inline |
Definition at line 201 of file refcount_ptr.h.
|
inline |
Definition at line 191 of file refcount_ptr.h.
|
inline |
Definition at line 206 of file refcount_ptr.h.
|
inline |
Less-than operator, e.g. for sorting.
other | The reference counted pointer to compare this object to. |
Definition at line 231 of file refcount_ptr.h.
|
inline |
Assignment operator. If an object is already referenced, it is released (i.e. its reference is decreased, and if it is zero, it is freed). The object referenced to by the other reference counted pointer then gets its reference count increased.
other | The reference counted pointer to assign from. |
Definition at line 170 of file refcount_ptr.h.
|
inline |
Equals operator.
other | The reference counted pointer to compare this object to. |
Definition at line 245 of file refcount_ptr.h.