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 164 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 171 of file SurfaceHolderImpl.h.

173  {}

◆ SurfacePtrHolderImplDetEl() [3/5]

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

ctor from const Surface ptr. Takes ownership

Definition at line 175 of file SurfaceHolderImpl.h.

177  {}

◆ SurfacePtrHolderImplDetEl() [4/5]

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

copy ctor

Definition at line 179 of file SurfaceHolderImpl.h.

180  : m_associatedSurface(cloneHelper(other.m_associatedSurface))
181  {}

◆ 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 184 of file SurfaceHolderImpl.h.

185  {
186  // tranfer ownership and leave other nullptr
187  m_associatedSurface = other.m_associatedSurface;
188  other.m_associatedSurface = nullptr;
189  }

◆ ~SurfacePtrHolderImplDetEl()

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

Definition at line 247 of file SurfaceHolderImpl.h.

247 { 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 236 of file SurfaceHolderImpl.h.

237  {
238  return (input && input->associatedDetectorElement() == nullptr
239  ? input->clone()
240  : input);
241  }

◆ 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 224 of file SurfaceHolderImpl.h.

225  {
226  if (m_associatedSurface &&
227  m_associatedSurface->associatedDetectorElement() == nullptr) {
228  delete m_associatedSurface;
229  }
230  //
231  m_associatedSurface = nullptr;
232  }

◆ 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 192 of file SurfaceHolderImpl.h.

193  {
194  if (this != &other) {
195  destroySurface(); // clean up ourselves
196  m_associatedSurface = cloneHelper(other.m_associatedSurface);
197  }
198  return *this;
199  }

◆ 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 202 of file SurfaceHolderImpl.h.

204  {
205  // destroy current surface
206  destroySurface();
207  // steal payload of other and leave it to nullptr
208  this->m_associatedSurface = other.m_associatedSurface;
209  other.m_associatedSurface = nullptr;
210  return *this;
211  }

◆ release()

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

release ala unique_ptr release

Definition at line 215 of file SurfaceHolderImpl.h.

216  {
217  const S* tmp = m_associatedSurface;
218  m_associatedSurface = nullptr;
219  return tmp;
220  }

◆ surfacePtr()

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

return the ptr we hold useful for tests

Definition at line 213 of file SurfaceHolderImpl.h.

213 { return m_associatedSurface; }

Member Data Documentation

◆ m_associatedSurface

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

Definition at line 244 of file SurfaceHolderImpl.h.


The documentation for this class was generated from the following file:
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
JetTiledMap::S
@ S
Definition: TiledEtaPhiMap.h:44
Trk::SurfacePtrHolderImplDetEl::m_associatedSurface
const S * m_associatedSurface
Definition: SurfaceHolderImpl.h:244
Trk::SurfacePtrHolderImplDetEl::destroySurface
void destroySurface() noexcept
destroySurface deletes the ptr if not null and the surface has not a associatedDetectorElement Useful...
Definition: SurfaceHolderImpl.h:224
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:236
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16