Arcane  4.1.12.0
User documentation
Loading...
Searching...
No Matches
Arcane::AutoRef2< T > Class Template Reference

Encapsulation of a pointer with a reference counter. More...

#include <arccore/base/AutoRef2.h>

Public Types

using ThatClass = AutoRef2<T>

Public Member Functions

 AutoRef2 ()=default
 Constructs an instance without a reference.
 AutoRef2 (T *t)
 Constructs an instance referencing t.
 AutoRef2 (const ThatClass &from)
 Constructs a reference referencing from.
 AutoRef2 (ThatClass &&from) noexcept
 Constructs a reference referencing from.
ThatClass & operator= (const ThatClass &from)
 Copy operator.
ThatClass & operator= (ThatClass &&from) noexcept
 Move operator.
ThatClass & operator= (T *new_value)
 Assigns the value new_value to the instance.
 ~AutoRef2 ()
 Destructor. Decrements the reference counter of the pointed object.
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
 operator bool () const

Friends

bool operator== (const ThatClass &a, const ThatClass &b)
bool operator!= (const ThatClass &a, const ThatClass &b)

Detailed Description

template<class T>
class Arcane::AutoRef2< T >

Encapsulation of a pointer with a reference counter.

This class encapsulates a pointer of a type that implements the methods of the abstract class ISharedReference (the template parameter does not need to derive from this class) and increments (addRef()) or decrements (removeRef()) the reference counter of the pointed element during successive assignments. 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 40 of file AutoRef2.h.

Member Typedef Documentation

◆ ThatClass

template<class T>
using Arcane::AutoRef2< T >::ThatClass = AutoRef2<T>

Definition at line 44 of file AutoRef2.h.

Constructor & Destructor Documentation

◆ AutoRef2() [1/3]

template<class T>
Arcane::AutoRef2< T >::AutoRef2 ( T * t)
inlineexplicit

Constructs an instance referencing t.

Definition at line 51 of file AutoRef2.h.

◆ AutoRef2() [2/3]

template<class T>
Arcane::AutoRef2< T >::AutoRef2 ( const ThatClass & from)
inline

Constructs a reference referencing from.

Definition at line 56 of file AutoRef2.h.

◆ AutoRef2() [3/3]

template<class T>
Arcane::AutoRef2< T >::AutoRef2 ( ThatClass && from)
inlinenoexcept

Constructs a reference referencing from.

Definition at line 61 of file AutoRef2.h.

◆ ~AutoRef2()

template<class T>
Arcane::AutoRef2< T >::~AutoRef2 ( )
inline

Destructor. Decrements the reference counter of the pointed object.

Definition at line 90 of file AutoRef2.h.

Member Function Documentation

◆ get()

template<class T>
T * Arcane::AutoRef2< T >::get ( ) const
inline

Returns the object referenced by the instance.

Definition at line 107 of file AutoRef2.h.

◆ isNull()

template<class T>
bool Arcane::AutoRef2< T >::isNull ( ) const
inline

Definition at line 109 of file AutoRef2.h.

◆ operator bool()

template<class T>
Arcane::AutoRef2< T >::operator bool ( ) const
inline

Definition at line 110 of file AutoRef2.h.

◆ operator*()

template<class T>
T & Arcane::AutoRef2< T >::operator* ( ) const
inline

Returns the object referenced by the instance.

Definition at line 100 of file AutoRef2.h.

◆ operator->()

template<class T>
T * Arcane::AutoRef2< T >::operator-> ( ) const
inline

Returns the object referenced by the instance.

Definition at line 93 of file AutoRef2.h.

◆ operator=() [1/3]

template<class T>
ThatClass & Arcane::AutoRef2< T >::operator= ( const ThatClass & from)
inline

Copy operator.

Definition at line 68 of file AutoRef2.h.

◆ operator=() [2/3]

template<class T>
ThatClass & Arcane::AutoRef2< T >::operator= ( T * new_value)
inline

Assigns the value new_value to the instance.

Definition at line 83 of file AutoRef2.h.

◆ operator=() [3/3]

template<class T>
ThatClass & Arcane::AutoRef2< T >::operator= ( ThatClass && from)
inlinenoexcept

Move operator.

Definition at line 74 of file AutoRef2.h.

◆ operator!=

template<class T>
bool operator!= ( const ThatClass & a,
const ThatClass & b )
friend

Definition at line 116 of file AutoRef2.h.

◆ operator==

template<class T>
bool operator== ( const ThatClass & a,
const ThatClass & b )
friend

Definition at line 112 of file AutoRef2.h.


The documentation for this class was generated from the following file: