ATLAS Offline Software
ToyConverter.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TOYCONVERSION_TOYCONVERTER_H
6 #define TOYCONVERSION_TOYCONVERTER_H
7 
9 
10 #include "GaudiKernel/Converter.h"
11 #include "GaudiKernel/StatusCode.h"
12 
15 
16 template <class Cnv> class CnvFactory;
17 
23 template <typename DATA>
24 class ToyConverter : public Converter {
25 public:
26  // tran->per
27  // StatusCode createRep(DataObject* pO, IOpaqueAddress*& pA);
28 
29  // per->tran
30  virtual StatusCode createObj(IOpaqueAddress*, DataObject *& pO) override {
31  //could alse get DATA (perhaps as std::any) from the IOA
32  pO = SG::asStorable(new DATA);
33  return StatusCode::SUCCESS;
34  }
35 
36  static const CLID& classID() { return ClassID_traits<DATA>::ID(); }
37 
38  virtual long int repSvcType() const override;
39  static long int storageType();
40 
41  ToyConverter(ISvcLocator* svcloc) :
42  Converter(storageType(), classID(), svcloc) {}
43 };
44 
45 
46 template <typename DATA>
49 }
50 template <typename DATA>
52  return storageType();
53 }
54 
55 #endif // TOYCONVERSION_TOYCONVERTER_H
ToyConverter::storageType
static long int storageType()
Definition: ToyConverter.h:47
ToyConversionSvc::storageType
static long int storageType()
Definition: ToyConversionSvc.cxx:7
ToyConverter::ToyConverter
ToyConverter(ISvcLocator *svcloc)
Definition: ToyConverter.h:41
ToyConverter
a toy converter template that creates a default instance of DATA
Definition: ToyConverter.h:24
StorableConversions.h
convert to and from a SG storable
SG::asStorable
DataObject * asStorable(T *pObject)
Definition: StorableConversions.h:158
ToyConverter::createObj
virtual StatusCode createObj(IOpaqueAddress *, DataObject *&pO) override
Definition: ToyConverter.h:30
ClassID_traits::ID
static const CLID & ID()
the CLID of T
Definition: Control/AthenaKernel/AthenaKernel/ClassID_traits.h:50
ClassID_traits.h
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CnvFactory
Abstract factory to create the converter.
Definition: ToyConverter.h:16
ToyConversionSvc.h
CLID
uint32_t CLID
The Class ID type.
Definition: Event/xAOD/xAODCore/xAODCore/ClassID_traits.h:47
Converter
Definition: Converter.h:27
ToyConverter::repSvcType
virtual long int repSvcType() const override
Definition: ToyConverter.h:51
ToyConverter::classID
static const CLID & classID()
Definition: ToyConverter.h:36