ContRap-Core
|
Class RefPtr is an internal pointer class which implements the reference counter. More...
#include <pointer.h>
Public Member Functions | |
RefPtr (void *object, int rc) | |
Creates a new reference pointer. | |
RefPtr (void *object, int rc, const DPtr &source, PointerMode mode=SOURCE) | |
Creates a new reference pointer with source information. | |
~RefPtr () | |
Destroys the instance. | |
void | operator= (const RefPtr &reference) |
Copy operator. | |
long | synchronize_time_stamp () |
Returns the current global time stamp and adds one to the it. | |
void | invalidate () |
Invalidates the reference without destroying the contents of the pointer. | |
bool | is_valid () const |
Returns true if the reference is valid. | |
Data Fields | |
void * | object |
Reference. | |
int | rc |
Reference counter. | |
long | time_stamp |
Time stamp. | |
PointerMode | mode |
Deletion mode. | |
DPtr | source |
Pointer to the reference data. | |
Static Public Attributes | |
static long | global_stamp |
Global time stamp. |
Class RefPtr is an internal pointer class which implements the reference counter.
The class RefPtr contains the real object pointer. Each smart pointer references a RefPtr.
You will never need to work with this class directly.
crp::RefPtr::RefPtr | ( | void * | object, |
int | rc | ||
) | [inline] |
Creates a new reference pointer.
object | Void pointer to the object |
rc | Initial number of references |
mode | Destruction mode of the pointer |
crp::RefPtr::RefPtr | ( | void * | object, |
int | rc, | ||
const DPtr & | source, | ||
PointerMode | mode = SOURCE |
||
) | [inline] |
Creates a new reference pointer with source information.
object | Void pointer to the object |
rc | Initial number of references |
source | Source object pointer |
mode | Destruction mode of the pointer |
crp::RefPtr::~RefPtr | ( | ) | [inline] |
Destroys the instance.
void crp::RefPtr::invalidate | ( | ) | [inline] |
Invalidates the reference without destroying the contents of the pointer.
bool crp::RefPtr::is_valid | ( | ) | const [inline] |
Returns true if the reference is valid.
A valid reference is a reference, which points to a valid object. Additionally, if the pointer mode of the reference is SOURCE the source pointer must be not zero.
void crp::RefPtr::operator= | ( | const RefPtr & | reference | ) | [inline] |
Copy operator.
reference | Other reference |
long crp::RefPtr::synchronize_time_stamp | ( | ) | [inline] |
Returns the current global time stamp and adds one to the it.
long crp::RefPtr::global_stamp [static] |
Global time stamp.
Deletion mode.
void* crp::RefPtr::object |
Reference.
int crp::RefPtr::rc |
Reference counter.
Pointer to the reference data.
Time stamp.