ATLAS Offline Software
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 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 ObjGrp >
 TransientConstSharedPtr (std::unique_ptr< ObjGrp > ptr)
 Constructor from unique_ptr. More...
 
template<typename ObjGrp >
 TransientConstSharedPtr (std::shared_ptr< ObjGrp > ptr)
 Constructor from shared_ptr. More...
 
 TransientConstSharedPtr (Obj *ptr)
 Constructor from raw ptr. More...
 
 TransientConstSharedPtr ()=default
 Standard constructor. More...
 
template<typename ObjGrp >
 TransientConstSharedPtr (const TransientConstSharedPtr< ObjGrp > &other)
 Delete the copy constructor if the object is const. More...
 
template<typename ObjGrp >
 TransientConstSharedPtr (TransientConstSharedPtr< ObjGrp > &&other)
 Standard move constructor. More...
 
template<typename ObjGrp >
TransientConstSharedPtroperator= (const TransientConstSharedPtr< ObjGrp > &other)
 Assignment operator. More...
 
template<typename ObjGrp >
TransientConstSharedPtroperator= (const std::shared_ptr< ObjGrp > &other)
 
template<typename ObjGrp >
TransientConstSharedPtroperator= (TransientConstSharedPtr< ObjGrp > &&other)
 Move assignment operator. More...
 
template<typename ObjGrp >
TransientConstSharedPtroperator= (std::unique_ptr< ObjGrp > &&other)
 
template<typename ObjGrp >
TransientConstSharedPtroperator= (std::shared_ptr< ObjGrp > &&other)
 
template<typename ObjGrp >
void reset (std::unique_ptr< ObjGrp > newObj)
 Overload the pointer. More...
 
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...
 

Private Attributes

std::shared_ptr< Obj > m_ptr {}
 

Friends

template<typename ObjGrp >
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.

Constructor & Destructor Documentation

◆ TransientConstSharedPtr() [1/6]

template<typename Obj >
template<typename ObjGrp >
GeoModel::TransientConstSharedPtr< Obj >::TransientConstSharedPtr ( std::unique_ptr< ObjGrp >  ptr)
inline

Constructor from unique_ptr.

Definition at line 28 of file TransientConstSharedPtr.h.

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

◆ TransientConstSharedPtr() [2/6]

template<typename Obj >
template<typename ObjGrp >
GeoModel::TransientConstSharedPtr< Obj >::TransientConstSharedPtr ( std::shared_ptr< ObjGrp >  ptr)
inline

Constructor from shared_ptr.

Definition at line 31 of file TransientConstSharedPtr.h.

31 : 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 33 of file TransientConstSharedPtr.h.

33 : m_ptr{ptr} {}

◆ TransientConstSharedPtr() [4/6]

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

Standard constructor.

◆ TransientConstSharedPtr() [5/6]

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

Delete the copy constructor if the object is const.

Definition at line 39 of file TransientConstSharedPtr.h.

39  :
40  m_ptr{other.m_ptr}{}

◆ TransientConstSharedPtr() [6/6]

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

Standard move constructor.

Definition at line 43 of file TransientConstSharedPtr.h.

43  :
44  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 17 of file TransientConstSharedPtr.h.

17 { 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 20 of file TransientConstSharedPtr.h.

20 { return m_ptr.get(); }

◆ operator bool()

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

Is the pointer defined.

Definition at line 82 of file TransientConstSharedPtr.h.

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

◆ operator!()

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

Definition at line 83 of file TransientConstSharedPtr.h.

83 { return !m_ptr; }

◆ operator*() [1/2]

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

Definition at line 24 of file TransientConstSharedPtr.h.

24 { return *m_ptr; }

◆ operator*() [2/2]

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

Dereference operator.

Definition at line 23 of file TransientConstSharedPtr.h.

23 { return *m_ptr; }

◆ operator->() [1/2]

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

Definition at line 18 of file TransientConstSharedPtr.h.

18 { return get(); }

◆ operator->() [2/2]

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

Definition at line 21 of file TransientConstSharedPtr.h.

21 { 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 88 of file TransientConstSharedPtr.h.

88 { return m_ptr.get() < other.m_ptr.get(); }

◆ operator=() [1/5]

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

Definition at line 55 of file TransientConstSharedPtr.h.

55  {
56  m_ptr = other.m_ptr;
57  return *this;
58  }

◆ operator=() [2/5]

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

Assignment operator.

Definition at line 48 of file TransientConstSharedPtr.h.

48  {
49  if (&other != this) {
50  m_ptr = other.m_ptr;
51  }
52  return *this;
53  }

◆ operator=() [3/5]

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

Definition at line 71 of file TransientConstSharedPtr.h.

71  {
72  m_ptr = std::move(other);
73  return *this;
74  }

◆ operator=() [4/5]

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

Definition at line 66 of file TransientConstSharedPtr.h.

66  {
67  m_ptr = std::move(other);
68  return *this;
69  }

◆ operator=() [5/5]

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

Move assignment operator.

Definition at line 61 of file TransientConstSharedPtr.h.

61  {
62  m_ptr = std::move(other.m_ptr);
63  return *this;
64  }

◆ release()

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

Release the memory.

Definition at line 80 of file TransientConstSharedPtr.h.

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

◆ reset() [1/2]

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

Definition at line 78 of file TransientConstSharedPtr.h.

78 { m_ptr.reset(); }

◆ reset() [2/2]

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

Overload the pointer.

Definition at line 77 of file TransientConstSharedPtr.h.

77 { m_ptr = std::move(newObj); }

◆ use_count()

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

How many clients does the pointer have.

Definition at line 85 of file TransientConstSharedPtr.h.

85 { return m_ptr.use_count(); }

Friends And Related Function Documentation

◆ GeoModel::TransientConstSharedPtr

template<typename Obj >
template<typename ObjGrp >
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 91 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:91
GeoModel::TransientConstSharedPtr::get
Obj * get()
Get (non-const) access to the underlying object.
Definition: TransientConstSharedPtr.h:17
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16