| # 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
PersistencySvc.h
Go to the documentation of this file.
1 // ============================================================
2 //
3 // PersistencySvc.h
4 // ------------------------------------------------------------
5 //
6 // Package : PersistencySvc
7 //
8 // Author : Markus Frank
9 //
10 // ===========================================================
11 #ifndef PERSISTENCYSVC_PERSISTENCYSVC_H
12 #define PERSISTENCYSVC_PERSISTENCYSVC_H 1
13
14 // Framework include files
15 #include "GaudiKernel/Service.h"
16 #include "GaudiKernel/IConversionSvc.h"
17 #include "GaudiKernel/IPersistencySvc.h"
18 #include "GaudiKernel/IAddressCreator.h"
19
20 // STL include files
21 #include <map>
22 #include <algorithm>
23 #include <functional>
24
49 class PersistencySvc : public extends3<Service,
50 IConversionSvc,
51 IPersistencySvc,
52 IAddressCreator> {
53 protected:
54
55 class ServiceEntry {
56 long m_serviceType;
57 mutable SmartIF<IService> m_service;
58 mutable SmartIF<IConversionSvc> m_cnvService;
59 mutable SmartIF<IAddressCreator> m_addrCreator;
60 public:
61 ServiceEntry( long type,
62 SmartIF<IService>& svc,
63 SmartIF<IConversionSvc>& cnv,
64 SmartIF<IAddressCreator>& cr) {
65 m_serviceType = type;
66 m_addrCreator = cr;
67 m_cnvService = cnv;
68 m_service = svc;
69 }
70 ServiceEntry( long type,
71 IService* svc,
72 IConversionSvc* cnv,
73 IAddressCreator* cr) {
74 m_serviceType = type;
75 m_addrCreator = cr;
76 m_cnvService = cnv;
77 m_service = svc;
78 }
79 ServiceEntry(const ServiceEntry& copy) {
80 m_serviceType = copy.m_serviceType;
81 m_addrCreator = copy.m_addrCreator;
82 m_cnvService = copy.m_cnvService;
83 m_service = copy.m_service;
84 }
85 virtual ~ServiceEntry() {
86 }
87 SmartIF<IService>& service() const {
88 return m_service;
89 }
90 SmartIF<IConversionSvc>& conversionSvc() const {
91 return m_cnvService;
92 }
93 SmartIF<IAddressCreator>& addrCreator() const {
94 return m_addrCreator;
95 }
96 long svcType() const {
97 return m_serviceType;
98 }
99 };
100 typedef std::map<long,ServiceEntry> Services;
101 /*
102 class SvcTest : public std::unary_function<ServiceEntry, bool> {
103 public:
104 SvcTest(long test) : m_test(test) {
105 }
106 virtual ~SvcTest() {
107 }
108 bool operator()( const ServiceEntry& testee ) {
109 return m_test == testee.svcType() ? true : false;
110 }
111 protected:
112 long m_test;
113 };
114 */
115 public:
116
119
120 long repSvcType() const;
121
123 const CLID& objType() const;
124
126 virtual StatusCode createObj(IOpaqueAddress* pAddress,DataObject*& refpObject);
127
129 virtual StatusCode fillObjRefs(IOpaqueAddress* pAddress, DataObject* pObject);
130
132 virtual StatusCode updateObj(IOpaqueAddress* pAddress, DataObject* refpObject);
133
135 virtual StatusCode updateObjRefs(IOpaqueAddress* pAddress, DataObject* pObject);
136
138 virtual StatusCode createRep(DataObject* pObject, IOpaqueAddress*& refpAddress);
139
141 virtual StatusCode fillRepRefs(IOpaqueAddress* pAddress,DataObject* pObject);
142
144 virtual StatusCode updateRep(IOpaqueAddress* pAddress, DataObject* pObject);
145
147 virtual StatusCode updateRepRefs(IOpaqueAddress* pAddress, DataObject* pObject);
148
150 virtual StatusCode setDataProvider(IDataProviderSvc* pStore);
151
153 virtual SmartIF<IDataProviderSvc>& dataProvider() const;
154
156 virtual StatusCode setConversionSvc(IConversionSvc* svc);
157
159 virtual SmartIF<IConversionSvc>& conversionSvc() const;
160
162 virtual StatusCode setAddressCreator(IAddressCreator* creator);
163
165 virtual SmartIF<IAddressCreator>& addressCreator() const;
166
168 virtual StatusCode addConverter(IConverter* pConverter);
169
171 virtual StatusCode addConverter(const CLID& clid);
172
174 virtual IConverter* converter(const CLID& clid);
175
177 virtual StatusCode removeConverter(const CLID& clid);
178
180 virtual StatusCode connectOutput(const std::string& outputFile,
181 const std::string& openMode);
183 virtual StatusCode connectOutput(const std::string& outputFile);
184
186 virtual StatusCode commitOutput(const std::string& output, bool do_commit);
187
189 virtual StatusCode createAddress(long svc_type,
190 const CLID& clid,
191 const std::string* pars,
192 const unsigned long* ipars,
193 IOpaqueAddress*& refpAddress);
194
196 virtual StatusCode convertAddress( const IOpaqueAddress* pAddress,
197 std::string& refAddress);
198
200 virtual StatusCode createAddress( long svc_type,
201 const CLID& clid,
202 const std::string& refAddress,
203 IOpaqueAddress*& refpAddress);
205
208
209 virtual StatusCode addCnvService(IConversionSvc* service);
210
212 virtual StatusCode removeCnvService(long type);
213
215 virtual StatusCode setDefaultCnvService(long type);
216
218 virtual StatusCode getService(long service_type, IConversionSvc*& refpSvc);
219
221 virtual StatusCode getService(const std::string& service_type, IConversionSvc*& refpSvc);
223
226
227 virtual StatusCode initialize();
228
230 virtual StatusCode finalize();
232
235
236 PersistencySvc(const std::string& name, ISvcLocator* svc);
237
239 virtual ~PersistencySvc();
240 protected:
241
243 SmartIF<IConversionSvc>& service(const std::string& nam);
244
246 SmartIF<IConversionSvc>& service(long service_type);
247
249 SmartIF<IAddressCreator>& addressCreator(long service_type);
250
252 void encodeAddrHdr(long service_type,
253 const CLID& clid,
254 std::string& address) const;
255
257 void decodeAddrHdr(const std::string& address,
258 long& service_type,
259 CLID& clid,
260 std::string& address_trailer) const;
261
262
264 StatusCode makeCall(int typ, IOpaqueAddress*& pAddress, DataObject*& pObject);
265
267 bool enable(bool value);
269
271 void svcNamesHandler( Property& theProp );
272
274 long m_cnvDefType;
276 mutable SmartIF<IDataProviderSvc> m_dataSvc;
278 Services m_cnvServices;
280 mutable SmartIF<IConversionSvc> m_cnvDefault;
284 StringArrayProperty m_svcNames;
286 bool m_enable;
287
289 mutable SmartIF<IAddressCreator> m_addrCreator;
290 };
291 #endif // PERSISTENCYSVC_PERSISTENCYSVC_H