| The Gaudi Framework v32r1 (f65d50dc)

ConversionSvc.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_CONVERSIONSVC_H
2 #define GAUDIKERNEL_CONVERSIONSVC_H 1
3
4 // Include files
5 #include "GaudiKernel/IAddressCreator.h"
6 #include "GaudiKernel/IConversionSvc.h"
7 #include "GaudiKernel/IDataProviderSvc.h"
8 #include "GaudiKernel/Kernel.h"
9 #include "GaudiKernel/Service.h"
10 #include <algorithm>
11 #include <utility>
12 #include <vector>
13
45 class GAUDI_API ConversionSvc : public extends<Service, IConversionSvc, IAddressCreator> {
46 class WorkerEntry final {
47 CLID m_class;
48 IConverter* m_converter;
49
50 public:
51 WorkerEntry( const CLID& cl, IConverter* cnv ) : m_class( cl ), m_converter( cnv ) {
52 if ( m_converter ) m_converter->addRef();
53 }
54
55 ~WorkerEntry() {
56 if ( m_converter ) m_converter->release();
57 }
58
59 WorkerEntry( WorkerEntry&& orig ) noexcept
60 : m_class{orig.m_class}, m_converter{std::exchange( orig.m_converter, nullptr )} {}
61
62 WorkerEntry& operator=( WorkerEntry&& orig ) noexcept {
63 m_class = orig.m_class;
64 std::swap( m_converter, orig.m_converter );
65 return *this;
66 }
67
68 WorkerEntry( const WorkerEntry& copy ) = delete;
69 WorkerEntry& operator=( const WorkerEntry& copy ) = delete;
70
71 IConverter* converter() { return m_converter; }
72
73 const CLID& clID() const { return m_class; }
74 };
75
76 public:
78 ConversionSvc( const std::string& name, ISvcLocator* svc, long type );
79
81 ConversionSvc( const ConversionSvc& ) = delete;
82 ConversionSvc& operator=( const ConversionSvc& ) = delete;
83
85 StatusCode initialize() override;
86
88 StatusCode finalize() override;
89
91 long repSvcType() const override;
92
94 const CLID& objType() const override;
95
100 StatusCode setDataProvider( IDataProviderSvc* pService ) override;
101
105 SmartIF<IDataProviderSvc>& dataProvider() const override;
106
108 StatusCode setConversionSvc( IConversionSvc* svc ) override;
109
111 SmartIF<IConversionSvc>& conversionSvc() const override;
112
114 StatusCode setAddressCreator( IAddressCreator* creator ) override;
115
117 SmartIF<IAddressCreator>& addressCreator() const override;
118
120 StatusCode createObj( IOpaqueAddress* pAddress, DataObject*& refpObject ) override;
121
123 StatusCode fillObjRefs( IOpaqueAddress* pAddress, DataObject* pObject ) override;
124
126 StatusCode updateObj( IOpaqueAddress* pAddress, DataObject* refpObject ) override;
127
129 StatusCode updateObjRefs( IOpaqueAddress* pAddress, DataObject* pObject ) override;
130
132 StatusCode createRep( DataObject* pObject, IOpaqueAddress*& refpAddress ) override;
133
135 StatusCode fillRepRefs( IOpaqueAddress* pAddress, DataObject* pObject ) override;
136
138 StatusCode updateRep( IOpaqueAddress* pAddress, DataObject* pObject ) override;
139
141 StatusCode updateRepRefs( IOpaqueAddress* pAddress, DataObject* pObject ) override;
142
144 StatusCode addConverter( const CLID& clid ) override;
145
147 StatusCode addConverter( IConverter* pConverter ) override;
148
150 StatusCode removeConverter( const CLID& clid ) override;
151
153 IConverter* converter( const CLID& wanted ) override;
154
156 StatusCode connectOutput( const std::string& outputFile, const std::string& openMode ) override;
157
159 StatusCode connectOutput( const std::string& output ) override;
160
162 StatusCode commitOutput( const std::string& output, bool do_commit ) override;
163
165 StatusCode createAddress( long svc_type, const CLID& clid, const std::string* par, const unsigned long* ip,
166 IOpaqueAddress*& refpAddress ) override;
167
169 StatusCode convertAddress( const IOpaqueAddress* pAddress, std::string& refAddress ) override;
170
172 StatusCode createAddress( long svc_type, const CLID& clid, const std::string& refAddress,
173 IOpaqueAddress*& refpAddress ) override;
174
176 virtual StatusCode updateServiceState( IOpaqueAddress* pAddress );
177
178 protected:
180 virtual IConverter* createConverter( long typ, const CLID& clid, const ICnvFactory* fac );
181
183 virtual StatusCode configureConverter( long typ, const CLID& clid, IConverter* cnv );
184
186 virtual StatusCode initializeConverter( long typ, const CLID& clid, IConverter* cnv );
187
189 virtual StatusCode activateConverter( long typ, const CLID& clid, IConverter* cnv );
190
192 virtual void loadConverter( DataObject* pObject );
193
195 virtual SmartIF<IAddressCreator>& addressCreator() { return m_addressCreator; }
196
197 protected:
198 StatusCode makeCall( int typ, bool ignore_add, bool ignore_obj, bool update, IOpaqueAddress*& pAddress,
199 DataObject*& pObject );
200
202 mutable SmartIF<IDataProviderSvc> m_dataSvc;
204 mutable SmartIF<IAddressCreator> m_addressCreator;
206 mutable SmartIF<IConversionSvc> m_cnvSvc;
208 long m_type;
210 std::vector<WorkerEntry> m_workers;
211 };
212 #endif // GAUDIKERNEL_CONVERSIONSVC_H
ConversionSvc::WorkerEntry::converter
IConverter * converter()
Definition: ConversionSvc.h:71
ConversionSvc::WorkerEntry::clID
const CLID & clID() const
Definition: ConversionSvc.h:73
SmartIF< IDataProviderSvc >
Kernel.h
ConversionSvc::addressCreator
virtual SmartIF< IAddressCreator > & addressCreator()
Retrieve address creation interface.
Definition: ConversionSvc.h:195
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
IConverter
The data converters are responsible to translate data from one representation into another.
Definition: IConverter.h:58
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:41
IConversionSvc
Definition: IConversionSvc.h:37
gaudirun.output
output
Definition: gaudirun.py:484
std::swap
T swap(T... args)
IAddressCreator
IAddressCreator interface definition.
Definition: IAddressCreator.h:28
ConversionSvc::WorkerEntry::~WorkerEntry
~WorkerEntry()
Definition: ConversionSvc.h:55
ConversionSvc::WorkerEntry
Definition: ConversionSvc.h:46
ConversionSvc::m_addressCreator
SmartIF< IAddressCreator > m_addressCreator
Pointer to the address creation service interface.
Definition: ConversionSvc.h:204
IDataProviderSvc
Data provider interface definition.
Definition: IDataProviderSvc.h:43
std::string
STL class.
Service.h
ConversionSvc::WorkerEntry::m_class
CLID m_class
Definition: ConversionSvc.h:47
compareOutputFiles.par
string par
Definition: compareOutputFiles.py:465
IDataProviderSvc.h
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
gaudirun.type
type
Definition: gaudirun.py:142
ConversionSvc::WorkerEntry::WorkerEntry
WorkerEntry(const CLID &cl, IConverter *cnv)
Definition: ConversionSvc.h:51
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
ConversionSvc::m_dataSvc
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to data provider service.
Definition: ConversionSvc.h:202
std::vector
STL class.
IInterface::release
virtual unsigned long release()=0
Release Interface instance.
IAddressCreator.h
IConversionSvc.h
extends
Base class used to extend a class implementing other interfaces.
Definition: extends.h:10
ConversionSvc::m_cnvSvc
SmartIF< IConversionSvc > m_cnvSvc
Pointer to the IConversionSvc interface of this.
Definition: ConversionSvc.h:206
ConversionSvc::m_type
long m_type
Conversion service type.
Definition: ConversionSvc.h:208
IInterface::addRef
virtual unsigned long addRef()=0
Increment the reference count of Interface instance.
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
ConversionSvc
Base class for all conversion services.
Definition: ConversionSvc.h:45
ConversionSvc::m_workers
std::vector< WorkerEntry > m_workers
List of conversion workers.
Definition: ConversionSvc.h:210
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:71
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
ConversionSvc::WorkerEntry::WorkerEntry
WorkerEntry(WorkerEntry &&orig) noexcept
Definition: ConversionSvc.h:59
ConversionSvc::WorkerEntry::m_converter
IConverter * m_converter
Definition: ConversionSvc.h:48
ConversionSvc::WorkerEntry::operator=
WorkerEntry & operator=(WorkerEntry &&orig) noexcept
Definition: ConversionSvc.h:62
GaudiPython.Pythonizations.update
update
Definition: Pythonizations.py:119