ATLAS Offline Software
Loading...
Searching...
No Matches
BoundSurfaceCnv_p2.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5//-----------------------------------------------------------------------------
6//
7// file: BoundSurfaceCnv_p2.cxx
8//
9// ----------------------------------------------------------------------------
10
17#include <typeinfo>
18#include <memory>
19
20template< class SURFACE, class BOUNDS_CNV >
21void
23persToTrans( const Trk::BoundSurface_p2* , SURFACE* , MsgStream & )
24{
25 throw std::runtime_error("BoundSurfaceCnv_p2::persToTrans shouldn't be called any more!");
26}
27
28template< class SURFACE, class BOUNDS_CNV >
29SURFACE*
31{
32 SURFACE* transObj = m_surfaceCnv.createTransient( persObj, log );
33 typename BOUNDS_CNV::Trans_t* bounds = this->createTransFromPStore( &m_boundsCnv, persObj->m_bounds, log );
34 transObj->m_bounds = std::shared_ptr<typename BOUNDS_CNV::Trans_t>(bounds);
35 return transObj;
36}
37
38
39template< class SURFACE, class BOUNDS_CNV >
40void
42transToPers( const SURFACE *transObj, Trk::BoundSurface_p2 *persObj, MsgStream &log )
43{
44 m_surfaceCnv.transToPers( transObj, persObj, log );
45 if ((transObj->m_bounds).get() && !dynamic_cast<const Trk::NoBounds*>((transObj->m_bounds).get()))
46 persObj->m_bounds = this->toPersistent( &m_boundsCnv, (transObj->m_bounds).get(), log );
47}
48
49// specialized for polymorphic surfaces
51
52template< class SURFACE >
53void
55persToTrans( const Trk::BoundSurface_p2 * , SURFACE * , MsgStream & )
56{
57 throw std::runtime_error("BoundSurfaceCnv_p2::persToTrans shouldn't be called any more!");
58 // This is because in the SurfaceCnv we might need to return an already existing surface (belong to a DetElement)
59}
60
61template < class SURFACE >
62SURFACE*
64{
65 SURFACE* transObj = m_surfaceCnv.createTransient( persObj, log );
66
67 Trk::SurfaceBounds* bounds = this->createTransFromPStore( (TPCnvForSurfBnds**)nullptr, persObj->m_bounds, log );
68 transObj->m_bounds = std::shared_ptr<Trk::SurfaceBounds>(bounds);
69 return transObj;
70}
71
72
73template< class SURFACE >
74void
76transToPers( const SURFACE *transObj, Trk::BoundSurface_p2 *persObj, MsgStream &log )
77{
78 m_surfaceCnv.transToPers( transObj, persObj, log );
79 if ((transObj->m_bounds).get() && !dynamic_cast<const Trk::NoBounds*>((transObj->m_bounds).get()))
80 persObj->m_bounds = this->toPersistent( (TPCnvForSurfBnds**)nullptr, (transObj->m_bounds).get(), log );
81}
82
83
ITPConverterFor< Trk::SurfaceBounds > TPCnvForSurfBnds
void transToPers(const SURFACE *, Trk::BoundSurface_p2 *, MsgStream &)
void persToTrans(const Trk::BoundSurface_p2 *, SURFACE *, MsgStream &)
SurfaceCnv_p2< SURFACE > m_surfaceCnv
SURFACE * createTransient(const Trk::BoundSurface_p2 *persObj, MsgStream &log)
Common base class for all TP converters, specialized for a given transient type.
Definition TPConverter.h:37
CNV::Trans_t * createTransFromPStore(CNV **cnv, const TPObjRef &ref, MsgStream &log) const
TPObjRef toPersistent(CNV **cnv, const typename CNV::TransBase_t *transObj, MsgStream &log) const
Bounds object for a boundless surface (...)
Definition NoBounds.h:30
Abstract base class for surface bounds to be specified.