ATLAS Offline Software
Public Types | Public Member Functions | Private Attributes | Friends | List of all members
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 More...
 

Public Member Functions

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

◆ TransientConstSharedPtr() [2/6]

template<typename Obj >
template<typename 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 >
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  :
45  m_ptr{other.m_ptr}{}

◆ TransientConstSharedPtr() [6/6]

template<typename Obj >
template<typename DerivType >
GeoModel::TransientConstSharedPtr< Obj >::TransientConstSharedPtr ( TransientConstSharedPtr< DerivType > &&  other)
inline

Standard move constructor.

Definition at line 48 of file TransientConstSharedPtr.h.

49  :
50  m_ptr{std::move(other.m_ptr)}{}

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  }

◆ 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 >
TransientConstSharedPtr& GeoModel::TransientConstSharedPtr< Obj >::operator= ( const std::shared_ptr< DerivType > &  other)
inline

Definition at line 62 of file TransientConstSharedPtr.h.

63  {
64  m_ptr = other.m_ptr;
65  return *this;
66  }

◆ operator=() [2/5]

template<typename Obj >
template<typename 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) {
57  m_ptr = other.m_ptr;
58  }
59  return *this;
60  }

◆ operator=() [3/5]

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

Definition at line 81 of file TransientConstSharedPtr.h.

82  {
83  m_ptr = std::move(other);
84  return *this;
85  }

◆ operator=() [4/5]

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

Definition at line 75 of file TransientConstSharedPtr.h.

76  {
77  m_ptr = std::move(other);
78  return *this;
79  }

◆ operator=() [5/5]

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

Move assignment operator.

Definition at line 69 of file TransientConstSharedPtr.h.

70  {
71  m_ptr = std::move(other.m_ptr);
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 >
void GeoModel::TransientConstSharedPtr< Obj >::reset ( const std::shared_ptr< DerivType > &  newObj)
inline

Definition at line 98 of file TransientConstSharedPtr.h.

99  {
100  m_ptr = std::move(newObj);
101  }

◆ reset() [3/4]

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

Definition at line 93 of file TransientConstSharedPtr.h.

94  {
95  m_ptr = std::move(newObj);
96  }

◆ reset() [4/4]

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

Overload the pointer.

Definition at line 88 of file TransientConstSharedPtr.h.

89  {
90  m_ptr = std::move(newObj);
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(); }

Friends And Related Function Documentation

◆ 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.


The documentation for this class was generated from the following file:
GeoModel::TransientConstSharedPtr::m_ptr
std::shared_ptr< Obj > m_ptr
Definition: TransientConstSharedPtr.h:124
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
GeoModel::TransientConstSharedPtr::get
Obj * get()
Get (non-const) access to the underlying object.
Definition: TransientConstSharedPtr.h:19
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16