Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
Arcane::PtrT< T > Class Template Reference

Encapsulation of a pointer. More...

#include <arcane/utils/Ptr.h>

Inheritance diagram for Arcane::PtrT< T >:
Collaboration diagram for Arcane::PtrT< T >:

Public Member Functions

 PtrT ()=default
 Constructs an instance without a reference.
 PtrT (T *t)
 Constructs an instance referring to t.
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

PtrT< T > & operator= (const PtrT< T > &from)
 Copy operator.
template<typename T2>
PtrT< T > & operator= (const PtrT< T2 > &from)
PtrT< T > & operator= (T *new_value)
 Assigns the value new_value to the instance.
 PtrT (const PtrT< T > &from)
 Constructs a reference referring to from.
template<typename T2>
 PtrT (const PtrT< T2 > &from)
 Constructs a reference referring to from.

Protected Attributes

T * m_value = nullptr
 Pointer to the referenced object.

Detailed Description

template<class T>
class Arcane::PtrT< T >

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 avoid accidental copies, the copy constructor and copy operators are protected.

In debug mode, checks that we do not access a null pointer.

The template parameter does not need to be defined. This class can therefore be instantiated for an opaque type.

Definition at line 45 of file Ptr.h.

Constructor & Destructor Documentation

◆ PtrT() [1/3]

template<class T>
Arcane::PtrT< T >::PtrT ( const PtrT< T > & from)
inlineprotected

Constructs a reference referring to from.

Definition at line 71 of file Ptr.h.

References m_value, and PtrT().

Referenced by operator=(), operator=(), PtrT(), and PtrT().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PtrT() [2/3]

template<class T>
template<typename T2>
Arcane::PtrT< T >::PtrT ( const PtrT< T2 > & from)
inlineprotected

Constructs a reference referring to from.

Definition at line 77 of file Ptr.h.

References m_value, and PtrT().

Here is the call graph for this function:

◆ PtrT() [3/3]

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

Constructs an instance referring to t.

Definition at line 87 of file Ptr.h.

References m_value.

Member Function Documentation

◆ get()

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

◆ isNull()

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

Definition at line 124 of file Ptr.h.

◆ operator*()

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

Returns the object referenced by the instance.

Definition at line 107 of file Ptr.h.

References Arcane::arcaneNullPointerError(), and m_value.

Here is the call graph for this function:

◆ operator->()

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

Returns the object referenced by the instance.

Definition at line 97 of file Ptr.h.

References Arcane::arcaneNullPointerError(), and m_value.

Here is the call graph for this function:

◆ operator=() [1/3]

template<class T>
PtrT< T > & Arcane::PtrT< T >::operator= ( const PtrT< T > & from)
inlineprotected

Copy operator.

Definition at line 50 of file Ptr.h.

References m_value, and PtrT().

Referenced by Arcane::ScopedPtrT< T >::operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [2/3]

template<class T>
template<typename T2>
PtrT< T > & Arcane::PtrT< T >::operator= ( const PtrT< T2 > & from)
inlineprotected

Definition at line 57 of file Ptr.h.

◆ operator=() [3/3]

template<class T>
PtrT< T > & Arcane::PtrT< T >::operator= ( T * new_value)
inlineprotected

Assigns the value new_value to the instance.

Definition at line 64 of file Ptr.h.

References m_value, and PtrT().

Here is the call graph for this function:

Member Data Documentation

◆ m_value

template<class T>
T* Arcane::PtrT< T >::m_value = nullptr
protected

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