ContRap-Core
Public Member Functions | Data Fields | Static Public Attributes

crp::RefPtr Class Reference

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.

Detailed Description

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.


Constructor & Destructor Documentation

crp::RefPtr::RefPtr ( void *  object,
int  rc 
) [inline]

Creates a new reference pointer.

Parameters:
objectVoid pointer to the object
rcInitial number of references
modeDestruction 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.

Parameters:
objectVoid pointer to the object
rcInitial number of references
sourceSource object pointer
modeDestruction mode of the pointer
crp::RefPtr::~RefPtr ( ) [inline]

Destroys the instance.


Member Function Documentation

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.

Parameters:
referenceOther reference
long crp::RefPtr::synchronize_time_stamp ( ) [inline]

Returns the current global time stamp and adds one to the it.


Field Documentation

Global time stamp.

Deletion mode.

Reference.

Reference counter.

Pointer to the reference data.

Time stamp.


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