Encapsulation of a pointer with a reference counter. More...
#include <arccore/base/ReferenceCounter.h>
Public Types | |
| typedef CheckedPointer< T > | BaseClass |
| Type of the base class. | |
Public Member Functions | |
| ReferenceCounter () | |
| Constructs an instance without a reference. | |
| ReferenceCounter (T *t) | |
| Constructs an instance referencing t. | |
| ReferenceCounter (const ReferenceCounter< T > &from) | |
| Constructs a reference referencing from. | |
| ReferenceCounter< T > & | operator= (const ReferenceCounter< T > &from) |
| Copy operator. | |
| ReferenceCounter< T > & | operator= (T *new_value) |
| Assigns the value new_value to the instance. | |
| ~ReferenceCounter () | |
| Destructor. Decrements the reference counter of the pointed object. | |
| Public Member Functions inherited from Arcane::CheckedPointer< T > | |
| 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 |
Public Attributes | |
| T * | m_value |
| Pointer to the referenced object. | |
Additional Inherited Members | |
| Protected Member Functions inherited from Arcane::CheckedPointer< T > | |
| 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 inherited from Arcane::CheckedPointer< T > | |
| T * | m_value |
| Pointer to the referenced object. | |
Encapsulation of a pointer with a reference counter.
This class holds a pointer of a type that must implement the following methods:
Unlike std::shared_ptr, the reference counter is managed internally by the type T. This class performs no action based on the reference counter value. the eventual destruction of the object when the reference counter reaches zero is handled by the object itself.
Definition at line 44 of file ReferenceCounter.h.
| typedef CheckedPointer<T> Arcane::ReferenceCounter< T >::BaseClass |
Type of the base class.
Definition at line 50 of file ReferenceCounter.h.
|
inline |
Constructs an instance without a reference.
Definition at line 57 of file ReferenceCounter.h.
|
inlineexplicit |
Constructs an instance referencing t.
Definition at line 61 of file ReferenceCounter.h.
|
inline |
Constructs a reference referencing from.
Definition at line 67 of file ReferenceCounter.h.
|
inline |
Destructor. Decrements the reference counter of the pointed object.
Definition at line 88 of file ReferenceCounter.h.
|
inline |
Copy operator.
Definition at line 74 of file ReferenceCounter.h.
|
inline |
Assigns the value new_value to the instance.
Definition at line 81 of file ReferenceCounter.h.
| T* Arcane::CheckedPointer< T >::m_value |
Pointer to the referenced object.
Definition at line 160 of file CheckedPointer.h.
Referenced by Arcane::ReferenceCounter< IModuleFactoryInfo >::operator=(), and Arcane::ReferenceCounter< IModuleFactoryInfo >::ReferenceCounter().