ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Trk::SurfacePtrHolderImpl< S > Class Template Reference

#include <SurfaceHolderImpl.h>

Inheritance diagram for Trk::SurfacePtrHolderImpl< S >:
Collaboration diagram for Trk::SurfacePtrHolderImpl< S >:

Public Member Functions

 SurfacePtrHolderImpl ()=default
 default ctor More...
 
 SurfacePtrHolderImpl (const S &s)
 ctor from const Surface ref. More...
 
 SurfacePtrHolderImpl (const S *s)
 ctor from const Surface ptr. Takes ownership More...
 
 SurfacePtrHolderImpl (const SurfacePtrHolderImpl &other)
 copy ctor More...
 
 SurfacePtrHolderImpl (SurfacePtrHolderImpl &&other) noexcept
 Move constructor we just steal the resource and leave other to point to nullptr. More...
 
SurfacePtrHolderImploperator= (const SurfacePtrHolderImpl &other)
 copy assingmemnt if surface is free we clone/copy. More...
 
SurfacePtrHolderImploperator= (SurfacePtrHolderImpl &&other) noexcept
 Move assignement we just steal the resource and leave other to point to nullptr. More...
 
void destroySurface () noexcept
 destroySurface deletes the ptr if not null and the surface isFree Usefull also for testing More...
 
const S * surfacePtr ()
 return the ptr we hold useful for tests More...
 
const S * release () noexcept
 release ala unique_ptr release More...
 

Static Public Member Functions

static const S * cloneHelper (const S *input)
 Helper for cloning or not when we need depending on if the surface isFree. More...
 

Protected Member Functions

 ~SurfacePtrHolderImpl ()
 

Protected Attributes

const S * m_associatedSurface = nullptr
 

Detailed Description

template<typename S>
class Trk::SurfacePtrHolderImpl< S >

Definition at line 78 of file SurfaceHolderImpl.h.

Constructor & Destructor Documentation

◆ SurfacePtrHolderImpl() [1/5]

template<typename S >
Trk::SurfacePtrHolderImpl< S >::SurfacePtrHolderImpl ( )
default

default ctor

◆ SurfacePtrHolderImpl() [2/5]

template<typename S >
Trk::SurfacePtrHolderImpl< S >::SurfacePtrHolderImpl ( const S &  s)
inlineexplicit

ctor from const Surface ref.

Definition at line 84 of file SurfaceHolderImpl.h.

86  {}

◆ SurfacePtrHolderImpl() [3/5]

template<typename S >
Trk::SurfacePtrHolderImpl< S >::SurfacePtrHolderImpl ( const S *  s)
inlineexplicit

ctor from const Surface ptr. Takes ownership

Definition at line 88 of file SurfaceHolderImpl.h.

90  {}

◆ SurfacePtrHolderImpl() [4/5]

template<typename S >
Trk::SurfacePtrHolderImpl< S >::SurfacePtrHolderImpl ( const SurfacePtrHolderImpl< S > &  other)
inline

copy ctor

Definition at line 92 of file SurfaceHolderImpl.h.

93  : m_associatedSurface(cloneHelper(other.m_associatedSurface))
94  {}

◆ SurfacePtrHolderImpl() [5/5]

template<typename S >
Trk::SurfacePtrHolderImpl< S >::SurfacePtrHolderImpl ( SurfacePtrHolderImpl< S > &&  other)
inlinenoexcept

Move constructor we just steal the resource and leave other to point to nullptr.

Definition at line 97 of file SurfaceHolderImpl.h.

98  {
99  // tranfer ownership and leave other nullptr
100  m_associatedSurface = other.m_associatedSurface;
101  other.m_associatedSurface = nullptr;
102  }

◆ ~SurfacePtrHolderImpl()

template<typename S >
Trk::SurfacePtrHolderImpl< S >::~SurfacePtrHolderImpl ( )
inlineprotected

Definition at line 156 of file SurfaceHolderImpl.h.

156 { destroySurface(); };

Member Function Documentation

◆ cloneHelper()

template<typename S >
static const S* Trk::SurfacePtrHolderImpl< S >::cloneHelper ( const S *  input)
inlinestatic

Helper for cloning or not when we need depending on if the surface isFree.

Definition at line 147 of file SurfaceHolderImpl.h.

148  {
149  return (input && input->isFree() ? input->clone() : input);
150  }

◆ destroySurface()

template<typename S >
void Trk::SurfacePtrHolderImpl< S >::destroySurface ( )
inlinenoexcept

destroySurface deletes the ptr if not null and the surface isFree Usefull also for testing

Definition at line 128 of file SurfaceHolderImpl.h.

129  {
130  if (m_associatedSurface && m_associatedSurface->isFree()) {
131  delete m_associatedSurface;
132  }
133  //
134  m_associatedSurface = nullptr;
135  }

◆ operator=() [1/2]

template<typename S >
SurfacePtrHolderImpl& Trk::SurfacePtrHolderImpl< S >::operator= ( const SurfacePtrHolderImpl< S > &  other)
inline

copy assingmemnt if surface is free we clone/copy.

If not we just point to the one owned by detector geometry

Definition at line 105 of file SurfaceHolderImpl.h.

106  {
107  if (this != &other) {
108  destroySurface(); // clean up ourselves
109  m_associatedSurface = cloneHelper(other.m_associatedSurface);
110  }
111  return *this;
112  }

◆ operator=() [2/2]

template<typename S >
SurfacePtrHolderImpl& Trk::SurfacePtrHolderImpl< S >::operator= ( SurfacePtrHolderImpl< S > &&  other)
inlinenoexcept

Move assignement we just steal the resource and leave other to point to nullptr.

Definition at line 116 of file SurfaceHolderImpl.h.

117  {
118  // destroy current surface
119  destroySurface();
120  // steal payload of other and leave it to nullptr
121  this->m_associatedSurface = other.m_associatedSurface;
122  other.m_associatedSurface = nullptr;
123  return *this;
124  }

◆ release()

template<typename S >
const S* Trk::SurfacePtrHolderImpl< S >::release ( )
inlinenoexcept

release ala unique_ptr release

Definition at line 139 of file SurfaceHolderImpl.h.

140  {
141  const S* tmp = m_associatedSurface;
142  m_associatedSurface = nullptr;
143  return tmp;
144  }

◆ surfacePtr()

template<typename S >
const S* Trk::SurfacePtrHolderImpl< S >::surfacePtr ( )
inline

return the ptr we hold useful for tests

Definition at line 137 of file SurfaceHolderImpl.h.

137 { return m_associatedSurface; }

Member Data Documentation

◆ m_associatedSurface

template<typename S >
const S* Trk::SurfacePtrHolderImpl< S >::m_associatedSurface = nullptr
protected

Definition at line 153 of file SurfaceHolderImpl.h.


The documentation for this class was generated from the following file:
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
Trk::SurfacePtrHolderImpl::cloneHelper
static const S * cloneHelper(const S *input)
Helper for cloning or not when we need depending on if the surface isFree.
Definition: SurfaceHolderImpl.h:147
Trk::SurfacePtrHolderImpl::destroySurface
void destroySurface() noexcept
destroySurface deletes the ptr if not null and the surface isFree Usefull also for testing
Definition: SurfaceHolderImpl.h:128
JetTiledMap::S
@ S
Definition: TiledEtaPhiMap.h:44
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
Trk::SurfacePtrHolderImpl::m_associatedSurface
const S * m_associatedSurface
Definition: SurfaceHolderImpl.h:153
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16