The Gaudi Framework  master (42b00024)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Converter.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef GAUDIKERNEL_CONVERTER_H
12 #define GAUDIKERNEL_CONVERTER_H
13 
14 // generic experiment headers
16 #include <GaudiKernel/IConverter.h>
19 #include <GaudiKernel/IService.h>
21 
22 // Forward declarations
23 class IMessageSvc;
24 class IRegistry;
25 
34 class GAUDI_API Converter : public implements<IConverter> {
35 public:
36  using Factory = Gaudi::PluginService::Factory<IConverter*( ISvcLocator* )>;
37 
39  StatusCode initialize() override;
40 
42  StatusCode finalize() override;
43 
45  StatusCode setDataProvider( IDataProviderSvc* svc ) override;
46 
48  SmartIF<IDataProviderSvc>& dataProvider() const override;
49 
51  StatusCode setConversionSvc( IConversionSvc* svc ) override;
52 
54  SmartIF<IConversionSvc>& conversionSvc() const override;
55 
57  StatusCode setAddressCreator( IAddressCreator* creator ) override;
58 
60  SmartIF<IAddressCreator>& addressCreator() const override;
61 
63  const CLID& objType() const override;
64 
66  // MSF: Masked to generate compiler error due to interface change
67  virtual long i_repSvcType() const;
68 
70  StatusCode createObj( IOpaqueAddress* pAddress, DataObject*& refpObject ) override;
71 
73  StatusCode fillObjRefs( IOpaqueAddress* pAddress, DataObject* pObject ) override;
74 
76  StatusCode updateObj( IOpaqueAddress* pAddress, DataObject* refpObject ) override;
77 
79  StatusCode updateObjRefs( IOpaqueAddress* pAddress, DataObject* pObject ) override;
80 
82  StatusCode createRep( DataObject* pObject, IOpaqueAddress*& refpAddress ) override;
83 
85  StatusCode fillRepRefs( IOpaqueAddress* pAddress, DataObject* pObject ) override;
86 
88  StatusCode updateRep( IOpaqueAddress* pAddress, DataObject* pObject ) override;
89 
91  StatusCode updateRepRefs( IOpaqueAddress* pAddress, DataObject* pObject ) override;
92 
94  Converter( long storage_type, const CLID& class_type, ISvcLocator* svc = 0 );
95 
97  SmartIF<IService> service( const std::string& name, const bool createIf = true ) const;
98 
99 protected:
101  SmartIF<ISvcLocator>& serviceLocator() const;
103  SmartIF<IMessageSvc>& msgSvc() const;
105  SmartIF<IDataManagerSvc>& dataManager() const;
106 
107 private:
124 };
125 
126 // Identified class for converters' factories
127 class GAUDI_API ConverterID final {
128 public:
129  ConverterID( long stype, CLID clid ) : m_stype( stype ), m_clid( clid ) {}
130  inline bool operator==( const ConverterID& id ) const { return m_stype == id.m_stype && m_clid == id.m_clid; }
131 
132 private:
133  friend std::ostream& operator<<( std::ostream&, const ConverterID& );
134  long m_stype;
136 };
137 
138 inline std::ostream& operator<<( std::ostream& s, const ConverterID& id ) {
139  return s << "CNV_" << id.m_stype << "_" << id.m_clid;
140 }
141 
142 // Macro to declare component factories
143 #define DECLARE_CONVERTER( x ) DECLARE_COMPONENT_WITH_ID( x, ConverterID( x::storageType(), x::classID() ) )
144 
145 #endif // GAUDIKERNEL_CONVERTER_H
operator<<
std::ostream & operator<<(std::ostream &s, const ConverterID &id)
Definition: Converter.h:138
Converter::m_conversionSvc
SmartIF< IConversionSvc > m_conversionSvc
Pointer to the connected conversion service.
Definition: Converter.h:119
IAddressCreator
Definition: IAddressCreator.h:38
IService.h
IMessageSvc
Definition: IMessageSvc.h:47
gaudirun.s
string s
Definition: gaudirun.py:346
IOpaqueAddress
Definition: IOpaqueAddress.h:33
ISvcLocator
Definition: ISvcLocator.h:46
IConverter
Definition: IConverter.h:68
IRegistry
Definition: IRegistry.h:32
ConverterID::ConverterID
ConverterID(long stype, CLID clid)
Definition: Converter.h:129
IDataProviderSvc.h
AvalancheSchedulerErrorTest.msgSvc
msgSvc
Definition: AvalancheSchedulerErrorTest.py:80
ConverterID
Definition: Converter.h:127
StatusCode
Definition: StatusCode.h:65
Converter
Definition: Converter.h:34
ConverterID::operator==
bool operator==(const ConverterID &id) const
Definition: Converter.h:130
Converter::m_addressCreator
SmartIF< IAddressCreator > m_addressCreator
Pointer to the address creation service interface.
Definition: Converter.h:113
ConverterID::m_clid
CLID m_clid
Definition: Converter.h:135
Converter::m_dataProvider
SmartIF< IDataProviderSvc > m_dataProvider
Pointer to data provider service.
Definition: Converter.h:115
Converter::m_dataManager
SmartIF< IDataManagerSvc > m_dataManager
Pointer to data manager service.
Definition: Converter.h:117
Write.creator
creator
Definition: Write.py:23
SmartIF< IDataProviderSvc >
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:18
IConverter.h
Converter::m_svcLocator
SmartIF< ISvcLocator > m_svcLocator
Service Locator reference.
Definition: Converter.h:121
implements
Base class used to implement the interfaces.
Definition: implements.h:19
ConditionsStallTest.name
name
Definition: ConditionsStallTest.py:77
Converter::m_messageSvc
SmartIF< IMessageSvc > m_messageSvc
MessageSvc reference.
Definition: Converter.h:123
DataObject
Definition: DataObject.h:37
Converter::Factory
Gaudi::PluginService::Factory< IConverter *(ISvcLocator *)> Factory
Definition: Converter.h:36
Converter::m_storageType
long m_storageType
Storage type.
Definition: Converter.h:109
IDataProviderSvc
Definition: IDataProviderSvc.h:53
ISvcLocator.h
ConversionSvc.h
Converter::m_classType
const CLID m_classType
Class type the converter can handle.
Definition: Converter.h:111
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:84
IDataManagerSvc.h
ConverterID::m_stype
long m_stype
Definition: Converter.h:134
IConversionSvc
Definition: IConversionSvc.h:47