| The Gaudi Framework v29r1 (5cd95fa2)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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 {
47 class WorkerEntry final
48 {
49 CLID m_class;
50 IConverter* m_converter;
51
52 public:
53 WorkerEntry( const CLID& cl, IConverter* cnv ) : m_class( cl ), m_converter( cnv )
54 {
55 if ( m_converter ) m_converter->addRef();
56 }
57
58 ~WorkerEntry()
59 {
60 if ( m_converter ) m_converter->release();
61 }
62
63 WorkerEntry( WorkerEntry&& orig ) noexcept
64 : m_class{orig.m_class}, m_converter{std::exchange( orig.m_converter, nullptr )}
65 {
66 }
67
68 WorkerEntry& operator=( WorkerEntry&& orig ) noexcept
69 {
70 m_class = orig.m_class;
71 std::swap( m_converter, orig.m_converter );
72 return *this;
73 }
74
75 WorkerEntry( const WorkerEntry& copy ) = delete;
76 WorkerEntry& operator=( const WorkerEntry& copy ) = delete;
77
78 IConverter* converter() { return m_converter; }
79
80 const CLID& clID() const { return m_class; }
81 };
82
83 public:
85 ConversionSvc( const std::string& name, ISvcLocator* svc, long type );
86
88 ConversionSvc( const ConversionSvc& ) = delete;
89 ConversionSvc& operator=( const ConversionSvc& ) = delete;
90
92 StatusCode initialize() override;
93
95 StatusCode finalize() override;
96
98 long repSvcType() const override;
99
101 const CLID& objType() const override;
102
107 StatusCode setDataProvider( IDataProviderSvc* pService ) override;
108
112 SmartIF<IDataProviderSvc>& dataProvider() const override;
113
115 StatusCode setConversionSvc( IConversionSvc* svc ) override;
116
118 SmartIF<IConversionSvc>& conversionSvc() const override;
119
121 StatusCode setAddressCreator( IAddressCreator* creator ) override;
122
124 SmartIF<IAddressCreator>& addressCreator() const override;
125
127 StatusCode createObj( IOpaqueAddress* pAddress, DataObject*& refpObject ) override;
128
130 StatusCode fillObjRefs( IOpaqueAddress* pAddress, DataObject* pObject ) override;
131
133 StatusCode updateObj( IOpaqueAddress* pAddress, DataObject* refpObject ) override;
134
136 StatusCode updateObjRefs( IOpaqueAddress* pAddress, DataObject* pObject ) override;
137
139 StatusCode createRep( DataObject* pObject, IOpaqueAddress*& refpAddress ) override;
140
142 StatusCode fillRepRefs( IOpaqueAddress* pAddress, DataObject* pObject ) override;
143
145 StatusCode updateRep( IOpaqueAddress* pAddress, DataObject* pObject ) override;
146
148 StatusCode updateRepRefs( IOpaqueAddress* pAddress, DataObject* pObject ) override;
149
151 StatusCode addConverter( const CLID& clid ) override;
152
154 StatusCode addConverter( IConverter* pConverter ) override;
155
157 StatusCode removeConverter( const CLID& clid ) override;
158
160 IConverter* converter( const CLID& wanted ) override;
161
163 StatusCode connectOutput( const std::string& outputFile, const std::string& openMode ) override;
164
166 StatusCode connectOutput( const std::string& output ) override;
167
169 StatusCode commitOutput( const std::string& output, bool do_commit ) override;
170
172 StatusCode createAddress( long svc_type, const CLID& clid, const std::string* par, const unsigned long* ip,
173 IOpaqueAddress*& refpAddress ) override;
174
176 StatusCode convertAddress( const IOpaqueAddress* pAddress, std::string& refAddress ) override;
177
179 StatusCode createAddress( long svc_type, const CLID& clid, const std::string& refAddress,
180 IOpaqueAddress*& refpAddress ) override;
181
183 virtual StatusCode updateServiceState( IOpaqueAddress* pAddress );
184
185 protected:
187 virtual IConverter* createConverter( long typ, const CLID& clid, const ICnvFactory* fac );
188
190 virtual StatusCode configureConverter( long typ, const CLID& clid, IConverter* cnv );
191
193 virtual StatusCode initializeConverter( long typ, const CLID& clid, IConverter* cnv );
194
196 virtual StatusCode activateConverter( long typ, const CLID& clid, IConverter* cnv );
197
199 virtual void loadConverter( DataObject* pObject );
200
202 virtual SmartIF<IAddressCreator>& addressCreator() { return m_addressCreator; }
203
204 protected:
205 StatusCode makeCall( int typ, bool ignore_add, bool ignore_obj, bool update, IOpaqueAddress*& pAddress,
206 DataObject*& pObject );
207
209 mutable SmartIF<IDataProviderSvc> m_dataSvc;
211 mutable SmartIF<IAddressCreator> m_addressCreator;
213 mutable SmartIF<IConversionSvc> m_cnvSvc;
215 long m_type;
217 std::vector<WorkerEntry> m_workers;
218 };
219 #endif // GAUDIKERNEL_CONVERSIONSVC_H
ConversionSvc::WorkerEntry::converter
IConverter * converter()
Definition: ConversionSvc.h:78
SmartIF< IDataProviderSvc >
Kernel.h
ConversionSvc::addressCreator
virtual SmartIF< IAddressCreator > & addressCreator()
Retrieve address creation interface.
Definition: ConversionSvc.h:202
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:32
IConversionSvc
Definition: IConversionSvc.h:37
gaudirun.output
output
Definition: gaudirun.py:404
std::swap
T swap(T...args)
IAddressCreator
IAddressCreator interface definition.
Definition: IAddressCreator.h:28
ConversionSvc::WorkerEntry::~WorkerEntry
~WorkerEntry()
Definition: ConversionSvc.h:58
ConversionSvc::WorkerEntry::clID
const CLID & clID() const
Definition: ConversionSvc.h:80
ConversionSvc::WorkerEntry
Definition: ConversionSvc.h:47
ConversionSvc::m_addressCreator
SmartIF< IAddressCreator > m_addressCreator
Pointer to the address creation service interface.
Definition: ConversionSvc.h:211
IDataProviderSvc
Data provider interface definition.
Definition: IDataProviderSvc.h:45
operator=
PropertyMgr & operator=(const PropertyMgr &)=delete
std::string
STL class.
Service.h
ConversionSvc::WorkerEntry::m_class
CLID m_class
Definition: ConversionSvc.h:49
compareOutputFiles.par
string par
Definition: compareOutputFiles.py:437
IDataProviderSvc.h
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:28
gaudirun.type
type
Definition: gaudirun.py:133
ConversionSvc::WorkerEntry::WorkerEntry
WorkerEntry(const CLID &cl, IConverter *cnv)
Definition: ConversionSvc.h:53
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:209
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:213
ConversionSvc::m_type
long m_type
Conversion service type.
Definition: ConversionSvc.h:215
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:217
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:110
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
ConversionSvc::WorkerEntry::WorkerEntry
WorkerEntry(WorkerEntry &&orig) noexcept
Definition: ConversionSvc.h:63
ConversionSvc::WorkerEntry::m_converter
IConverter * m_converter
Definition: ConversionSvc.h:50
ConversionSvc::WorkerEntry::operator=
WorkerEntry & operator=(WorkerEntry &&orig) noexcept
Definition: ConversionSvc.h:68
GaudiPython.Pythonizations.update
update
Definition: Pythonizations.py:123