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

#include <SurfaceHolderImpl.h>

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

Public Member Functions

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

Static Public Member Functions

static const S * cloneHelper (const S *input)
 Helper for cloning or not when we need depending on if we have an associatedDetectorElement. More...
 

Protected Member Functions

 ~SurfacePtrHolderImplDetEl ()
 

Protected Attributes

const S * m_associatedSurface = nullptr
 

Detailed Description

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

Definition at line 141 of file SurfaceHolderImpl.h.

Constructor & Destructor Documentation

◆ SurfacePtrHolderImplDetEl() [1/5]

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

default ctor

◆ SurfacePtrHolderImplDetEl() [2/5]

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

ctor from const Surface ref.

Definition at line 148 of file SurfaceHolderImpl.h.

150  {}

◆ SurfacePtrHolderImplDetEl() [3/5]

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

ctor from const Surface ptr. Takes ownership

Definition at line 152 of file SurfaceHolderImpl.h.

154  {}

◆ SurfacePtrHolderImplDetEl() [4/5]

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

copy ctor

Definition at line 156 of file SurfaceHolderImpl.h.

157  : m_associatedSurface(cloneHelper(other.m_associatedSurface))
158  {}

◆ SurfacePtrHolderImplDetEl() [5/5]

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

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

Definition at line 161 of file SurfaceHolderImpl.h.

162  {
163  // tranfer ownership and leave other nullptr
164  m_associatedSurface = other.m_associatedSurface;
165  other.m_associatedSurface = nullptr;
166  }

◆ ~SurfacePtrHolderImplDetEl()

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

Definition at line 224 of file SurfaceHolderImpl.h.

224 { destroySurface(); };

Member Function Documentation

◆ cloneHelper()

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

Helper for cloning or not when we need depending on if we have an associatedDetectorElement.

Definition at line 213 of file SurfaceHolderImpl.h.

214  {
215  return (input && input->associatedDetectorElement() == nullptr
216  ? input->clone()
217  : input);
218  }

◆ destroySurface()

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

destroySurface deletes the ptr if not null and the surface has not a associatedDetectorElement Usefull also for testing

Definition at line 201 of file SurfaceHolderImpl.h.

202  {
203  if (m_associatedSurface &&
204  m_associatedSurface->associatedDetectorElement() == nullptr) {
205  delete m_associatedSurface;
206  }
207  //
208  m_associatedSurface = nullptr;
209  }

◆ operator=() [1/2]

template<typename S >
SurfacePtrHolderImplDetEl& Trk::SurfacePtrHolderImplDetEl< S >::operator= ( const SurfacePtrHolderImplDetEl< 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 169 of file SurfaceHolderImpl.h.

170  {
171  if (this != &other) {
172  destroySurface(); // clean up ourselves
173  m_associatedSurface = cloneHelper(other.m_associatedSurface);
174  }
175  return *this;
176  }

◆ operator=() [2/2]

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

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

Definition at line 179 of file SurfaceHolderImpl.h.

181  {
182  // destroy current surface
183  destroySurface();
184  // steal payload of other and leave it to nullptr
185  this->m_associatedSurface = other.m_associatedSurface;
186  other.m_associatedSurface = nullptr;
187  return *this;
188  }

◆ release()

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

release ala unique_ptr release

Definition at line 192 of file SurfaceHolderImpl.h.

193  {
194  const S* tmp = m_associatedSurface;
195  m_associatedSurface = nullptr;
196  return tmp;
197  }

◆ surfacePtr()

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

return the ptr we hold useful for tests

Definition at line 190 of file SurfaceHolderImpl.h.

190 { return m_associatedSurface; }

Member Data Documentation

◆ m_associatedSurface

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

Definition at line 221 of file SurfaceHolderImpl.h.


The documentation for this class was generated from the following file:
JetTiledMap::S
@ S
Definition: TiledEtaPhiMap.h:44
Trk::SurfacePtrHolderImplDetEl::m_associatedSurface
const S * m_associatedSurface
Definition: SurfaceHolderImpl.h:221
Trk::SurfacePtrHolderImplDetEl::destroySurface
void destroySurface() noexcept
destroySurface deletes the ptr if not null and the surface has not a associatedDetectorElement Useful...
Definition: SurfaceHolderImpl.h:201
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
Trk::SurfacePtrHolderImplDetEl::cloneHelper
static const S * cloneHelper(const S *input)
Helper for cloning or not when we need depending on if we have an associatedDetectorElement.
Definition: SurfaceHolderImpl.h:213
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
python.SystemOfUnits.s
float s
Definition: SystemOfUnits.py:147