Encapsulation of a pointer. More...
#include <arccore/base/CheckedPointer.h>
Public Member Functions | |
| CheckedPointer () | |
| Constructs an instance without a reference. | |
| CheckedPointer (T *t) | |
| Constructs an instance referring to t. | |
| operator bool () const | |
| T * | operator-> () const |
| Returns the object referenced by the instance. | |
| T & | operator* () const |
| Returns the object referenced by the instance. | |
| T * | get () const |
| Returns the object referenced by the instance. | |
| bool | isNull () const |
Protected Member Functions | |
| const CheckedPointer< T > & | operator= (const CheckedPointer< T > &from) |
| Copy operator. | |
| template<typename T2> | |
| const CheckedPointer< T > & | operator= (const CheckedPointer< T2 > &from) |
| const CheckedPointer< T > & | operator= (T *new_value) |
| Assigns the value new_value to the instance. | |
| CheckedPointer (const CheckedPointer< T > &from) | |
| Constructs a reference referring to from. | |
| template<typename T2> | |
| CheckedPointer (const CheckedPointer< T2 > &from) | |
| Constructs a reference referring to from. | |
Protected Attributes | |
| T * | m_value |
| Pointer to the referenced object. | |
Friends | |
| template<typename T2> | |
| bool | operator== (const CheckedPointer< T > &v1, const CheckedPointer< T2 > &v2) |
| Compares the objects referenced by v1 and v2 The comparison is done pointer by pointer. | |
| template<typename T2> | |
| bool | operator!= (const CheckedPointer< T > &v1, const CheckedPointer< T2 > &v2) |
| Compares the objects referenced by v1 and v2 The comparison is done pointer by pointer. | |
Encapsulation of a pointer.
This class does nothing special other than encapsulating a pointer of any type. It serves as a base class for other classes that provide more advanced features like AutoRefT.
To prevent accidental copies, the copy constructor and copy operators are protected.
In debug mode, it checks that a null pointer is not accessed.
The template parameter does not need to be defined. This class can therefore be instantiated for an opaque type.
Definition at line 44 of file CheckedPointer.h.
|
inlineprotected |
Constructs a reference referring to from.
Definition at line 70 of file CheckedPointer.h.
References CheckedPointer(), and m_value.
Referenced by CheckedPointer(), CheckedPointer(), operator!=, operator=(), operator=(), and operator==.
|
inlineprotected |
Constructs a reference referring to from.
Definition at line 76 of file CheckedPointer.h.
References CheckedPointer(), and m_value.
|
inline |
Constructs an instance without a reference.
Definition at line 83 of file CheckedPointer.h.
References m_value.
|
inlineexplicit |
Constructs an instance referring to t.
Definition at line 88 of file CheckedPointer.h.
References m_value.
|
inline |
Returns the object referenced by the instance.
Definition at line 124 of file CheckedPointer.h.
References m_value.
Referenced by operator!=, and operator==.
|
inline |
Definition at line 129 of file CheckedPointer.h.
|
inlineexplicit |
Definition at line 94 of file CheckedPointer.h.
|
inline |
Returns the object referenced by the instance.
Definition at line 109 of file CheckedPointer.h.
References Arcane::arccoreNullPointerError(), and m_value.
|
inline |
Returns the object referenced by the instance.
Definition at line 99 of file CheckedPointer.h.
References Arcane::arccoreNullPointerError(), and m_value.
|
inlineprotected |
Copy operator.
Definition at line 49 of file CheckedPointer.h.
References CheckedPointer(), and m_value.
|
inlineprotected |
Definition at line 56 of file CheckedPointer.h.
|
inlineprotected |
Assigns the value new_value to the instance.
Definition at line 63 of file CheckedPointer.h.
References CheckedPointer(), and m_value.
|
friend |
Compares the objects referenced by v1 and v2 The comparison is done pointer by pointer.
| false | if they are equal |
| true | otherwise |
Definition at line 153 of file CheckedPointer.h.
References CheckedPointer(), and get().
|
friend |
Compares the objects referenced by v1 and v2 The comparison is done pointer by pointer.
| true | if they are equal |
| false | otherwise |
Definition at line 141 of file CheckedPointer.h.
References CheckedPointer(), and get().
|
protected |
Pointer to the referenced object.
Definition at line 160 of file CheckedPointer.h.
Referenced by CheckedPointer(), CheckedPointer(), CheckedPointer(), CheckedPointer(), get(), operator*(), operator->(), operator=(), and operator=().