Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

ReferencePointer Class Reference

Base class for smart-pointers to Object classes. More...

#include <Link.h>

Inheritance diagram for ReferencePointer:

LinkBase Link< T > List of all members.

Public Methods

bool __eq__ (const ReferencePointer &other)
bool __ne__ (const ReferencePointer &other)
 ReferencePointer ()
 Construct a ReferencePointer with no object reference (null pointer).

 ReferencePointer (Object *ptr)
 Assign to a specific object.

 ReferencePointer (const ReferencePointer &r)
 Light-weight copy with reference counting.

virtual ~ReferencePointer ()
 Decrement the object's reference count and destroy the object if the count reaches zero.

bool unique () const
 Returns true if this is the only reference to an object.

ReferencePointer & operator= (const ReferencePointer &r)
 Light-weight copy with reference counting.

void * operator= (void *p)
 Raw pointer assignment for NULL only.

void setNull ()
 Clear pointer.

bool isNull () const
 Test for null pointer.

bool operator! () const
 Test for null pointer.

bool valid () const
 Test for non-null pointer.

bool operator== (ReferencePointer const &p) const
 Comparison with other simdata pointers.

virtual Object__get__ ()

Protected Methods

void _assign_safe (Object *ptr)
 Rebind to a new object, testing for type compatibility.

void _assign_fast (Object *ptr)
 Rebind to a new object, without testing for type compatibility.

void _release ()
 Rebind to null.

virtual void _update (Object *p)
 Change object pointer without reference counting.

Object_get () const
 Get the current object pointer.


Protected Attributes

Object_reference
 The actual object pointer.


Detailed Description

Base class for smart-pointers to Object classes.

Author:
Mark Rose <mrose@stm.lbl.gov>


Constructor & Destructor Documentation

ReferencePointer::ReferencePointer   [inline, explicit]
 

Construct a ReferencePointer with no object reference (null pointer).

ReferencePointer::ReferencePointer Object   ptr [inline, explicit]
 

Assign to a specific object.

ReferencePointer::ReferencePointer const ReferencePointer &    r [inline, explicit]
 

Light-weight copy with reference counting.

virtual ReferencePointer::~ReferencePointer   [inline, virtual]
 

Decrement the object's reference count and destroy the object if the count reaches zero.


Member Function Documentation

bool ReferencePointer::__eq__ const ReferencePointer &    other
 

virtual Object* ReferencePointer::__get__   [inline, virtual]
 

bool ReferencePointer::__ne__ const ReferencePointer &    other
 

void ReferencePointer::_assign_fast Object   ptr [inline, protected]
 

Rebind to a new object, without testing for type compatibility.

Use this method only when you know that the pointer you are assignng from has the correct type.

void ReferencePointer::_assign_safe Object   ptr [inline, protected]
 

Rebind to a new object, testing for type compatibility.

This method calls _update(), which is overridden in the Pointer<> class to attempt a dynamic cast to the template type and throws an exception if the cast fails.

Object* ReferencePointer::_get   const [inline, protected]
 

Get the current object pointer.

void ReferencePointer::_release   [inline, protected]
 

Rebind to null.

virtual void ReferencePointer::_update Object   p [inline, protected, virtual]
 

Change object pointer without reference counting.

This method is extended in the Link<> class to test for type compatibility.

Reimplemented in Link< T >.

bool ReferencePointer::isNull   const [inline]
 

Test for null pointer.

bool ReferencePointer::operator!   const [inline]
 

Test for null pointer.

void* ReferencePointer::operator= void *    p [inline]
 

Raw pointer assignment for NULL only.

ReferencePointer& ReferencePointer::operator= const ReferencePointer &    r [inline]
 

Light-weight copy with reference counting.

bool ReferencePointer::operator== ReferencePointer const &    p const [inline]
 

Comparison with other simdata pointers.

void ReferencePointer::setNull   [inline]
 

Clear pointer.

bool ReferencePointer::unique   const [inline]
 

Returns true if this is the only reference to an object.

bool ReferencePointer::valid   const [inline]
 

Test for non-null pointer.


Member Data Documentation

Object* ReferencePointer::_reference [protected]
 

The actual object pointer.


The documentation for this class was generated from the following files:
SimData version pre-0.4.0. For more information on SimData, visit the SimData Homepage.

Generated on Tue Oct 14 12:06:42 2003, using Doxygen 1.2.18.

[SF.net]