| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ConversionSvc.h
Go to the documentation of this file.
1 // $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiKernel/GaudiKernel/ConversionSvc.h,v 1.15 2007/06/01 17:24:21 marcocle Exp $
2 #ifndef GAUDIKERNEL_CONVERSIONSVC_H
3 #define GAUDIKERNEL_CONVERSIONSVC_H 1
4
5 // Include files
6 #include <vector>
7 #include <algorithm>
8 #include <functional>
9 #include "GaudiKernel/Kernel.h"
10 #include "GaudiKernel/Service.h"
11 #include "GaudiKernel/IConversionSvc.h"
12 #include "GaudiKernel/IAddressCreator.h"
13 #include "GaudiKernel/IDataProviderSvc.h"
14
15
47 class GAUDI_API ConversionSvc: public extends2<Service, IConversionSvc, IAddressCreator>
48 {
49 public:
50 class WorkerEntry {
51 private:
52 CLID m_class;
53 IConverter* m_converter;
54 public:
55 WorkerEntry(const CLID& cl, IConverter* cnv)
56 : m_class(cl), m_converter(cnv) {
57 }
58 WorkerEntry(const WorkerEntry& copy)
59 : m_class(copy.m_class), m_converter(copy.m_converter) {
60 }
61 WorkerEntry& operator = (const WorkerEntry& copy) {
62 m_class = copy.m_class;
63 m_converter = copy.m_converter;
64 return *this;
65 }
66 virtual ~WorkerEntry() {
67 }
68 IConverter* converter() {
69 return m_converter;
70 }
71 const CLID& clID() const {
72 return m_class;
73 }
74 };
75 typedef std::vector<WorkerEntry> Workers;
76
77 class CnvTest : public std::unary_function<WorkerEntry, bool> {
78 protected:
79 const CLID m_test;
80 public:
81 CnvTest(const CLID& test) : m_test(test) {
82 }
83 virtual ~CnvTest() {
84 }
85 bool operator()( const WorkerEntry& testee ) {
86 return (m_test == testee.clID()) ? true : false;
87 }
88 };
89
90 public:
91
93 virtual StatusCode initialize();
94
96 virtual StatusCode finalize();
97
99 virtual long repSvcType() const;
100
102 const CLID& objType() const;
103
108 virtual StatusCode setDataProvider(IDataProviderSvc* pService);
109
113 virtual SmartIF<IDataProviderSvc>& dataProvider() const;
114
116 virtual StatusCode setConversionSvc(IConversionSvc* svc);
117
119 virtual SmartIF<IConversionSvc>& conversionSvc() const;
120
122 virtual StatusCode setAddressCreator(IAddressCreator* creator);
123
125 virtual SmartIF<IAddressCreator>& addressCreator() const;
126
128 virtual StatusCode createObj(IOpaqueAddress* pAddress,DataObject*& refpObject);
129
131 virtual StatusCode fillObjRefs(IOpaqueAddress* pAddress, DataObject* pObject);
132
134 virtual StatusCode updateObj(IOpaqueAddress* pAddress, DataObject* refpObject);
135
137 virtual StatusCode updateObjRefs(IOpaqueAddress* pAddress, DataObject* pObject);
138
140 virtual StatusCode createRep(DataObject* pObject, IOpaqueAddress*& refpAddress);
141
143 virtual StatusCode fillRepRefs(IOpaqueAddress* pAddress,DataObject* pObject);
144
146 virtual StatusCode updateRep(IOpaqueAddress* pAddress, DataObject* pObject);
147
149 virtual StatusCode updateRepRefs(IOpaqueAddress* pAddress, DataObject* pObject);
150
152 virtual StatusCode addConverter(const CLID& clid);
153
155 virtual StatusCode addConverter(IConverter* pConverter);
156
158 virtual StatusCode removeConverter(const CLID& clid);
159
161 virtual IConverter* converter(const CLID& wanted);
162
164 virtual StatusCode connectOutput(const std::string& outputFile,
165 const std::string& openMode);
166
168 virtual StatusCode connectOutput(const std::string& output);
169
171 virtual StatusCode commitOutput(const std::string& output, bool do_commit);
172
174 virtual StatusCode createAddress( long svc_type,
175 const CLID& clid,
176 const std::string* par,
177 const unsigned long* ip,
178 IOpaqueAddress*& refpAddress);
179
181 virtual StatusCode convertAddress( const IOpaqueAddress* pAddress,
182 std::string& refAddress);
183
185 virtual StatusCode createAddress( long svc_type,
186 const CLID& clid,
187 const std::string& refAddress,
188 IOpaqueAddress*& refpAddress);
189
191 virtual StatusCode updateServiceState(IOpaqueAddress* pAddress);
192
194 ConversionSvc(const std::string& name, ISvcLocator* svc, long type);
195
196 protected:
198 virtual ~ConversionSvc();
199
201 virtual IConverter* createConverter(long typ, const CLID& clid, const ICnvFactory* fac);
202
204 virtual StatusCode configureConverter(long typ, const CLID& clid, IConverter* cnv);
205
207 virtual StatusCode initializeConverter(long typ, const CLID& clid, IConverter* cnv);
208
210 virtual StatusCode activateConverter(long typ, const CLID& clid, IConverter* cnv);
211
213 virtual void loadConverter(DataObject* pObject);
214
216 virtual SmartIF<IAddressCreator>& addressCreator() {
217 return m_addressCreator;
218 }
219
220 protected:
221 StatusCode makeCall( int typ,
222 bool ignore_add,
223 bool ignore_obj,
224 bool update,
225 IOpaqueAddress*& pAddress,
226 DataObject*& pObject);
227
229 mutable SmartIF<IDataProviderSvc> m_dataSvc;
231 mutable SmartIF<IAddressCreator> m_addressCreator;
233 mutable SmartIF<IConversionSvc> m_cnvSvc;
235 long m_type;
237 Workers* m_workers;
238
239 private:
241 ConversionSvc(const ConversionSvc&);
243 ConversionSvc& operator= (const ConversionSvc&);
244 };
245 #endif // GAUDIKERNEL_CONVERSIONSVC_H