class PSmartPointer: public PObject

This is the class for pointers to objects that use the smart pointer system.

Inheritance:


Public

[more] Construction
[more] Overrides from class PObject
[more] Pointer access functions

Protected Fields

[more]PSmartObject* object
Object the smart pointer points to.


Inherited from PObject:

Public

Run Time Type functions

Comparison functions

I/O functions

Miscellaneous functions


Documentation

This is the class for pointers to objects that use the smart pointer system. In conjunction with the PSmartObject class, this class references objects that can have the automatic deletion of the object instance when there are no more smart pointer instances pointing to it.

A PSmartPointer carries the pointer to a PSmartObject instance which contains a reference count. Assigning or copying instances of smart pointers will automatically increment and decrement the reference count. When the last instance that references a PSmartObject instance is destroyed or overwritten, the PSmartObject is deleted.

A NULL value is possible for a smart pointer. It can be detected via the IsNULL() function.

o Construction

o PSmartPointer( PSmartObject * obj = NULL )
Create a new smart pointer instance and have it point to the specified PSmartObject instance.
Parameters:
obj - Smart object to point to.

o PSmartPointer( const PSmartPointer & ptr )
Create a new smart pointer and point it at the data pointed to by the ptr parameter. The reference count for the object being pointed at is incremented.
Parameters:
ptr - Smart pointer to make a copy of.

ovirtual ~PSmartPointer()
Destroy the smart pointer and decrement the reference count on the object being pointed to. If there are no more references then the object is deleted.

oPSmartPointer& operator=( const PSmartPointer & ptr )
Assign this pointer to the value specified in the ptr parameter.

The previous object being pointed to has its reference count decremented as this will no longer point to it. If there are no more references then the object is deleted.

The new object being pointed to after the assignment has its reference count incremented.

Parameters:
ptr - Smart pointer to assign.

o Overrides from class PObject

ovirtual Comparison Compare( const PObject & obj ) const
Determine the relative rank of the pointers. This is identical to determining the relative rank of the integer values represented by the memory pointers.

Returns:
EqualTo if objects point to the same object instance, otherwise LessThan and GreaterThan may be returned depending on the relative values of the memory pointers.

o Pointer access functions

oBOOL IsNULL() const
Determine if the smart pointer has been set to point to an actual object instance.

Returns:
TRUE if the pointer is NULL.

oPSmartObject* GetObject() const
Get the current value if the internal smart object pointer.

Returns:
pointer to object instance.

oPSmartObject* object
Object the smart pointer points to.


Direct child classes:
PImage
PNotifier

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.