ATLAS Offline Software
Loading...
Searching...
No Matches
GeoModel::TransientConstSharedPtr< Obj > Class Template Reference

The TransientConstSharedPtr allows non-const access if the pointer itself is non-const but in the const case only a const pointer is returned The class takes the ownership of the object using a shared_ptr. More...

#include <TransientConstSharedPtr.h>

Collaboration diagram for GeoModel::TransientConstSharedPtr< Obj >:

Public Types

using element_type = Obj
 type name

Public Member Functions

Obj * get ()
 Get (non-const) access to the underlying object.
Obj * operator-> ()
const Obj * get () const
 Get const access to the underlying object.
const Obj * operator-> () const
const Obj & operator* () const
 Dereference operator.
Obj & operator* ()
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
 TransientConstSharedPtr (std::unique_ptr< DerivType > ptr)
 Constructor from a unique_ptr.
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
 TransientConstSharedPtr (std::shared_ptr< DerivType > ptr)
 Constructor from shared_ptr.
 TransientConstSharedPtr (Obj *ptr)
 Constructor from raw ptr.
 TransientConstSharedPtr ()=default
 Standard constructor.
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
 TransientConstSharedPtr (const TransientConstSharedPtr< DerivType > &other)
 Delete the copy constructor if the object is const.
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
 TransientConstSharedPtr (TransientConstSharedPtr< DerivType > &&other)
 Standard move constructor.
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
TransientConstSharedPtroperator= (const TransientConstSharedPtr< DerivType > &other)
 Assignment operator.
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
TransientConstSharedPtroperator= (const std::shared_ptr< DerivType > &other)
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
TransientConstSharedPtroperator= (TransientConstSharedPtr< DerivType > &&other)
 Move assignment operator.
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
TransientConstSharedPtroperator= (std::unique_ptr< DerivType > &&other)
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
TransientConstSharedPtroperator= (std::shared_ptr< DerivType > &&other)
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
void reset (std::unique_ptr< DerivType > newObj)
 Overload the pointer.
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
void reset (std::shared_ptr< DerivType > &&newObj)
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
void reset (const std::shared_ptr< DerivType > &newObj)
void reset ()
std::shared_ptr< const Obj > release ()
 Release the memory.
 operator bool () const
 Is the pointer defined.
bool operator! () const
size_t use_count () const
 How many clients does the pointer have.
bool operator< (const TransientConstSharedPtr &other) const
 Smaller operator to insert the pointer into sets.
bool operator== (const TransientConstSharedPtr &other) const
 Equal operator.
bool operator!= (const TransientConstSharedPtr &other) const

Private Attributes

std::shared_ptr< Obj > m_ptr {}

Friends

template<typename DerivType>
class GeoModel::TransientConstSharedPtr

Detailed Description

template<typename Obj>
class GeoModel::TransientConstSharedPtr< Obj >

The TransientConstSharedPtr allows non-const access if the pointer itself is non-const but in the const case only a const pointer is returned The class takes the ownership of the object using a shared_ptr.

Definition at line 13 of file TransientConstSharedPtr.h.

Member Typedef Documentation

◆ element_type

template<typename Obj>
using GeoModel::TransientConstSharedPtr< Obj >::element_type = Obj

type name

Definition at line 17 of file TransientConstSharedPtr.h.

Constructor & Destructor Documentation

◆ TransientConstSharedPtr() [1/6]

template<typename Obj>
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
GeoModel::TransientConstSharedPtr< Obj >::TransientConstSharedPtr ( std::unique_ptr< DerivType > ptr)
inline

Constructor from a unique_ptr.

Definition at line 30 of file TransientConstSharedPtr.h.

31 : m_ptr{std::move(ptr)} {}
The TransientConstSharedPtr allows non-const access if the pointer itself is non-const but in the con...

◆ TransientConstSharedPtr() [2/6]

template<typename Obj>
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
GeoModel::TransientConstSharedPtr< Obj >::TransientConstSharedPtr ( std::shared_ptr< DerivType > ptr)
inline

Constructor from shared_ptr.

Definition at line 34 of file TransientConstSharedPtr.h.

35 : m_ptr{std::move(ptr)} {}

◆ TransientConstSharedPtr() [3/6]

template<typename Obj>
GeoModel::TransientConstSharedPtr< Obj >::TransientConstSharedPtr ( Obj * ptr)
inline

Constructor from raw ptr.

Definition at line 37 of file TransientConstSharedPtr.h.

37: m_ptr{ptr} {}

◆ TransientConstSharedPtr() [4/6]

template<typename Obj>
GeoModel::TransientConstSharedPtr< Obj >::TransientConstSharedPtr ( )
default

Standard constructor.

◆ TransientConstSharedPtr() [5/6]

template<typename Obj>
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
GeoModel::TransientConstSharedPtr< Obj >::TransientConstSharedPtr ( const TransientConstSharedPtr< DerivType > & other)
inline

Delete the copy constructor if the object is const.

Definition at line 43 of file TransientConstSharedPtr.h.

44 :

◆ TransientConstSharedPtr() [6/6]

template<typename Obj>
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
GeoModel::TransientConstSharedPtr< Obj >::TransientConstSharedPtr ( TransientConstSharedPtr< DerivType > && other)
inline

Standard move constructor.

Definition at line 48 of file TransientConstSharedPtr.h.

49 :

Member Function Documentation

◆ get() [1/2]

template<typename Obj>
Obj * GeoModel::TransientConstSharedPtr< Obj >::get ( )
inline

Get (non-const) access to the underlying object.

Definition at line 19 of file TransientConstSharedPtr.h.

19{ return m_ptr.get(); }

◆ get() [2/2]

template<typename Obj>
const Obj * GeoModel::TransientConstSharedPtr< Obj >::get ( ) const
inline

Get const access to the underlying object.

Definition at line 22 of file TransientConstSharedPtr.h.

22{ return m_ptr.get(); }

◆ operator bool()

template<typename Obj>
GeoModel::TransientConstSharedPtr< Obj >::operator bool ( ) const
inline

Is the pointer defined.

Definition at line 106 of file TransientConstSharedPtr.h.

106{ return m_ptr.get() != nullptr; }

◆ operator!()

template<typename Obj>
bool GeoModel::TransientConstSharedPtr< Obj >::operator! ( ) const
inline

Definition at line 107 of file TransientConstSharedPtr.h.

107{ return !m_ptr; }

◆ operator!=()

template<typename Obj>
bool GeoModel::TransientConstSharedPtr< Obj >::operator!= ( const TransientConstSharedPtr< Obj > & other) const
inline

Definition at line 119 of file TransientConstSharedPtr.h.

119 {
120 return other.get() != get();
121 }
Obj * get()
Get (non-const) access to the underlying object.

◆ operator*() [1/2]

template<typename Obj>
Obj & GeoModel::TransientConstSharedPtr< Obj >::operator* ( )
inline

Definition at line 26 of file TransientConstSharedPtr.h.

26{ return *m_ptr; }

◆ operator*() [2/2]

template<typename Obj>
const Obj & GeoModel::TransientConstSharedPtr< Obj >::operator* ( ) const
inline

Dereference operator.

Definition at line 25 of file TransientConstSharedPtr.h.

25{ return *m_ptr; }

◆ operator->() [1/2]

template<typename Obj>
Obj * GeoModel::TransientConstSharedPtr< Obj >::operator-> ( )
inline

Definition at line 20 of file TransientConstSharedPtr.h.

20{ return get(); }

◆ operator->() [2/2]

template<typename Obj>
const Obj * GeoModel::TransientConstSharedPtr< Obj >::operator-> ( ) const
inline

Definition at line 23 of file TransientConstSharedPtr.h.

23{ return get(); }

◆ operator<()

template<typename Obj>
bool GeoModel::TransientConstSharedPtr< Obj >::operator< ( const TransientConstSharedPtr< Obj > & other) const
inline

Smaller operator to insert the pointer into sets.

Definition at line 112 of file TransientConstSharedPtr.h.

112 {
113 return get() < other.get();
114 }

◆ operator=() [1/5]

template<typename Obj>
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
TransientConstSharedPtr & GeoModel::TransientConstSharedPtr< Obj >::operator= ( const std::shared_ptr< DerivType > & other)
inline

Definition at line 62 of file TransientConstSharedPtr.h.

63 {
65 return *this;
66 }

◆ operator=() [2/5]

template<typename Obj>
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
TransientConstSharedPtr & GeoModel::TransientConstSharedPtr< Obj >::operator= ( const TransientConstSharedPtr< DerivType > & other)
inline

Assignment operator.

Definition at line 54 of file TransientConstSharedPtr.h.

55 {
56 if (&other != this) {
58 }
59 return *this;
60 }

◆ operator=() [3/5]

template<typename Obj>
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
TransientConstSharedPtr & GeoModel::TransientConstSharedPtr< Obj >::operator= ( std::shared_ptr< DerivType > && other)
inline

Definition at line 81 of file TransientConstSharedPtr.h.

82 {
84 return *this;
85 }

◆ operator=() [4/5]

template<typename Obj>
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
TransientConstSharedPtr & GeoModel::TransientConstSharedPtr< Obj >::operator= ( std::unique_ptr< DerivType > && other)
inline

Definition at line 75 of file TransientConstSharedPtr.h.

76 {
78 return *this;
79 }

◆ operator=() [5/5]

template<typename Obj>
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
TransientConstSharedPtr & GeoModel::TransientConstSharedPtr< Obj >::operator= ( TransientConstSharedPtr< DerivType > && other)
inline

Move assignment operator.

Definition at line 69 of file TransientConstSharedPtr.h.

70 {
72 return *this;
73 }

◆ operator==()

template<typename Obj>
bool GeoModel::TransientConstSharedPtr< Obj >::operator== ( const TransientConstSharedPtr< Obj > & other) const
inline

Equal operator.

Definition at line 116 of file TransientConstSharedPtr.h.

116 {
117 return other.get() == get();
118 }

◆ release()

template<typename Obj>
std::shared_ptr< const Obj > GeoModel::TransientConstSharedPtr< Obj >::release ( )
inline

Release the memory.

Definition at line 104 of file TransientConstSharedPtr.h.

104{ return std::move(m_ptr); }

◆ reset() [1/4]

template<typename Obj>
void GeoModel::TransientConstSharedPtr< Obj >::reset ( )
inline

Definition at line 102 of file TransientConstSharedPtr.h.

102{ m_ptr.reset(); }

◆ reset() [2/4]

template<typename Obj>
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
void GeoModel::TransientConstSharedPtr< Obj >::reset ( const std::shared_ptr< DerivType > & newObj)
inline

Definition at line 98 of file TransientConstSharedPtr.h.

99 {
101 }

◆ reset() [3/4]

template<typename Obj>
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
void GeoModel::TransientConstSharedPtr< Obj >::reset ( std::shared_ptr< DerivType > && newObj)
inline

Definition at line 93 of file TransientConstSharedPtr.h.

94 {
96 }

◆ reset() [4/4]

template<typename Obj>
template<typename DerivType>
requires (std::is_base_of_v<Obj, DerivType>)
void GeoModel::TransientConstSharedPtr< Obj >::reset ( std::unique_ptr< DerivType > newObj)
inline

Overload the pointer.

Definition at line 88 of file TransientConstSharedPtr.h.

89 {
91 }

◆ use_count()

template<typename Obj>
size_t GeoModel::TransientConstSharedPtr< Obj >::use_count ( ) const
inline

How many clients does the pointer have.

Definition at line 109 of file TransientConstSharedPtr.h.

109{ return m_ptr.use_count(); }

◆ GeoModel::TransientConstSharedPtr

template<typename Obj>
template<typename DerivType>
friend class GeoModel::TransientConstSharedPtr
friend

Definition at line 15 of file TransientConstSharedPtr.h.

Member Data Documentation

◆ m_ptr

template<typename Obj>
std::shared_ptr<Obj> GeoModel::TransientConstSharedPtr< Obj >::m_ptr {}
private

Definition at line 124 of file TransientConstSharedPtr.h.

124{};

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