ATLAS Offline Software
StlAthenaPoolCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 //#include "GaudiKernel/DeclareFactoryEntries.h"
7 
8 // explicit instantiations
9 
10 template <class T>
12 {
13  friend class CnvFactory< StlAthenaPoolCnv<T> >;
16 public:
18  StlAthenaPoolCnv(ISvcLocator* svcloc) : BaseCnv_t(svcloc) {}
19 
22  {
23  MsgStream msg( this->msgSvc(), ClassName<Self_t>::name());
24  if ( !this->BaseCnv_t::initialize().isSuccess() ) {
25  msg << MSG::ERROR << "Could not initialize base class' converter ["
26  << ClassName<BaseCnv_t>::name() << "] !"
27  << endmsg;
28  return StatusCode::FAILURE;
29  }
30  const std::type_info& ti = typeid(T);
31  RootType rflx_type = RootType(ti);
32  if (!rflx_type) {
33  msg << MSG::ERROR
34  << "could not get Reflex::Type from type_info ["
35  << ti.name()
36  << "] for class ["
37  << ClassName<T>::name() << "] !"
38  << endmsg;
39  return StatusCode::FAILURE;
40  }
41  this->BaseCnv_t::m_classDesc = rflx_type;
42  return StatusCode::SUCCESS;
43  }
44 };
45 
46 
47 #define DECL_CNV(NAME, TDEF) \
48  typedef StlAthenaPoolCnv< NAME > TDEF; \
49  template class StlAthenaPoolCnv< NAME >; \
50  DECLARE_CONVERTER(TDEF)
51 
52 #define DECL2_CNV(N1, N2, TDEF) \
53  typedef StlAthenaPoolCnv< N1, N2 > TDEF; \
54  template class StlAthenaPoolCnv< N1, N2 >; \
55  DECLARE_CONVERTER(TDEF)
56 
57 #include "SGTools/BuiltinsClids.h"
58 // cppcheck-suppress unknownMacro
59 DECL_CNV(int, AthenaPoolIntCnv)
60 DECL_CNV(unsigned int, AthenaPoolUIntCnv)
61 DECL_CNV(float, AthenaPoolFloatCnv)
62 DECL_CNV(double, AthenaPoolDoubleCnv)
63 DECL_CNV(std::string, AthenaPoolStdStringCnv)
64 
65 #include "SGTools/StlVectorClids.h"
66 DECL_CNV(std::vector<int>, AthenaPoolStdVectorIntCnv)
67 DECL_CNV(std::vector<unsigned int>, AthenaPoolStdVectorUIntCnv)
68 DECL_CNV(std::vector<float>, AthenaPoolStdVectorFloatCnv)
69 DECL_CNV(std::vector<double>, AthenaPoolStdVectorDoubleCnv)
70 
71 #include "SGTools/StlMapClids.h"
72 DECL2_CNV(std::map<int, int>, AthenaPoolStdMapIntIntCnv)
73 DECL2_CNV(std::map<int, float>, AthenaPoolStdMapIntFloatCnv)
74 DECL2_CNV(std::map<int, double>, AthenaPoolStdMapIntDoubleCnv)
75 
76 DECL2_CNV(std::map<std::string, int>, AthenaPoolStdMapStringIntCnv)
77 DECL2_CNV(std::map<std::string, unsigned int>, AthenaPoolStdMapStringUIntCnv)
78 DECL2_CNV(std::map<std::string, float>, AthenaPoolStdMapStringFloatCnv)
79 DECL2_CNV(std::map<std::string, double>, AthenaPoolStdMapStringDoubleCnv)
80 
T_AthenaPoolCnv
This templated class provides the converter to translate an object to/from its persistent POOL repres...
Definition: T_AthenaPoolCnv.h:61
DECL_CNV
#define DECL_CNV(NAME, TDEF)
Definition: StlAthenaPoolCnv.cxx:47
initialize
void initialize()
Definition: run_EoverP.cxx:894
StlAthenaPoolCnv::Self_t
StlAthenaPoolCnv< T > Self_t
Definition: StlAthenaPoolCnv.cxx:15
BuiltinsClids.h
RootType
TTypeAdapter RootType
Definition: RootType.h:211
DECL2_CNV
#define DECL2_CNV(N1, N2, TDEF)
Definition: StlAthenaPoolCnv.cxx:52
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
StlAthenaPoolCnv
Definition: StlAthenaPoolCnv.cxx:12
StlAthenaPoolCnv::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations:
Definition: StlAthenaPoolCnv.cxx:21
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ClassName
An interface for getting the name of a class as a string.
Definition: AthenaKernel/AthenaKernel/ClassName.h:31
ClassName::name
static std::string name()
Return the name of class T as a string.
CnvFactory
Abstract factory to create the converter.
Definition: ToyConverter.h:16
T_AthenaPoolCnv.h
his file contains the class definition for the templated T_AthenaPoolCnv class.
StlAthenaPoolCnv::BaseCnv_t
T_AthenaPoolCnv< T > BaseCnv_t
Definition: StlAthenaPoolCnv.cxx:14
StlAthenaPoolCnv::StlAthenaPoolCnv
StlAthenaPoolCnv(ISvcLocator *svcloc)
Constructor.
Definition: StlAthenaPoolCnv.cxx:18
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
TScopeAdapter
Definition: RootType.h:119