This class lets you declare smart pointers to objects of a given type. Objects referenced by smart pointers are automatically destroyed when their reference counter drops to zero. More...
#include <ilserver/refcount.h>
Public Member Functions | |
IlsSmartPointer (const IlsSmartPointer< PointedType > &rhs) | |
This is the copy constructor of IlsSmartPointer . | |
IlsSmartPointer (PointedType *pointer=0) | |
This constructor increments the reference counter of the object to which the smart pointer points. | |
~IlsSmartPointer () | |
This destructor decrements the reference counter of the object to which the smart pointer points. | |
PointedType * | getValue () const |
This member function returns the value of the smart pointer. More... | |
IlsSmartPointer< PointedType > & | set (PointedType *rhs) |
This member function assigns a new value to the smart pointer. | |
Operators | |
The operators below let you handle a smart pointer as if it were an ordinary pointer.
| |
IlsSmartPointer< PointedType > & | operator= (const IlsSmartPointer< PointedType > &rhs) |
This operator assigns a new smart pointer to the smart pointer. | |
IlsSmartPointer< PointedType > & | operator= (PointedType *rhs) |
This operator assigns an ordinary pointer to the smart pointer. | |
PointedType * | operator-> () const |
This operator returns the value of the smart pointer. More... | |
operator PointedType * () const | |
This operator converts a smart pointer to an ordinary pointer. More... | |
PointedType & | operator* () const |
This operator returns a reference to the pointed object. More... | |
IlsBoolean | operator! () const |
This operator returns IlsTrue if the smart pointer is null. | |
IlsBoolean | operator== (PointedType *rhs) const |
This operator compares two pointers and returns IlsTrue if they are equal. | |
IlsBoolean | operator!= (PointedType *rhs) const |
IlsBoolean | operator== (const IlsSmartPointer< PointedType > &rhs) const |
This operator compares two smart pointers and returns IlsTrue if they are equal. | |
IlsBoolean | operator!= (const IlsSmartPointer< PointedType > &rhs) const |
This class lets you declare smart pointers to objects of a given type. Objects referenced by smart pointers are automatically destroyed when their reference counter drops to zero.
PointedType
must derive from IlsRefCounted
. In case of multiple inheritance, we recommend that you make the derivation virtual to avoid the creation of multiple reference counters to the same object.
IlsException
, IlsEntity
. PointedType* IlsSmartPointer< PointedType >::getValue | ( | ) | const |
This member function returns the value of the smart pointer.
It is useful especially when the conversion operator, described below, cannot be used or when the compiler is likely to encounter multiple user-defined conversions.
IlsSmartPointer< PointedType >::operator PointedType * | ( | ) | const |
This operator converts a smart pointer to an ordinary pointer.
IlsNullPointerDereferencing | If the smart pointer is null. |
IlsBoolean IlsSmartPointer< PointedType >::operator!= | ( | const IlsSmartPointer< PointedType > & | rhs | ) | const |
This operator compares two smart pointers and returns IlsTrue
if they are not equal.
IlsBoolean IlsSmartPointer< PointedType >::operator!= | ( | PointedType * | rhs | ) | const |
This operator compares two pointers and returns IlsTrue
if they are not equal.
PointedType& IlsSmartPointer< PointedType >::operator* | ( | ) | const |
This operator returns a reference to the pointed object.
IlsNullPointerDereferencing | If the smart pointer is null. |
PointedType* IlsSmartPointer< PointedType >::operator-> | ( | ) | const |
This operator returns the value of the smart pointer.
IlsNullPointerDereferencing | If the smart pointer is null. |