| The Gaudi Framework v30r0 (c919700c)

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

- File List
- File Members

PersistencySvc.cpp
Go to the documentation of this file.
1 //====================================================================
2 // PersistencySvc.cpp
3 //--------------------------------------------------------------------
4 //
5 // Package : System ( The LHCb Offline System)
6 //
7 // Description: implementation of the PersistencySvc
8 //
9 // Author : M.Frank
10 // History :
11 // +---------+----------------------------------------------+---------
12 // | Date | Comment | Who
13 // +---------+----------------------------------------------+---------
14 // | 29/10/98| Initial version | MF
15 // +---------+----------------------------------------------+---------
16 //
17 //====================================================================
18 #define PERSISTENCYSVC_PERSISTENCYSVC_CPP
19
20 // Interface definitions
21 #include "GaudiKernel/DataObject.h"
22 #include "GaudiKernel/IConverter.h"
23 #include "GaudiKernel/IDataProviderSvc.h"
24 #include "GaudiKernel/IDataSelector.h"
25 #include "GaudiKernel/IOpaqueAddress.h"
26 #include "GaudiKernel/ISvcLocator.h"
27 #include "GaudiKernel/MsgStream.h"
28 #include "GaudiKernel/SmartIF.h"
29 #include "GaudiKernel/TypeNameString.h"
30 #include "GaudiKernel/strcasecmp.h"
31
32 // Implementation specific definitions
33 #include "PersistencySvc.h"
34
35 #define ON_DEBUG if ( msgLevel( MSG::DEBUG ) )
36 #define ON_VERBOSE if ( msgLvel( MSG::VERBOSE ) )
37
38 #define DEBMSG ON_DEBUG debug()
39 #define VERMSG ON_VERBOSE verbose()
40
41 // Instantiation of a static factory class used by clients to create
42 // instances of this service
43 DECLARE_COMPONENT( PersistencySvc )
44
45 enum CnvSvcAction {
46 CREATE_OBJ,
47 FILL_OBJ_REFS,
48 UPDATE_OBJ,
49 UPDATE_OBJ_REFS,
50 CREATE_REP,
51 FILL_REP_REFS,
52 UPDATE_REP,
53 UPDATE_REP_REFS
54 };
55
56 StatusCode PersistencySvc::makeCall( int typ, IOpaqueAddress*& pAddress, DataObject*& pObject )
57 {
58 if ( m_enable ) {
59 IConversionSvc* svc = nullptr;
60 switch ( typ ) {
61 case CREATE_REP:
62 case FILL_REP_REFS:
63 case UPDATE_REP:
64 case UPDATE_REP_REFS:
65 svc = m_cnvDefault;
66 break;
67 default:
68 if ( !pAddress ) return INVALID_ADDRESS;
69 svc = service( pAddress->svcType() );
70 if ( !svc ) return BAD_STORAGE_TYPE;
71 break;
72 }
73
74 StatusCode status( StatusCode::FAILURE, true );
75 switch ( typ ) {
76 case CREATE_OBJ:
77 pObject = nullptr;
78 status = svc->createObj( pAddress, pObject );
79 break;
80 case FILL_OBJ_REFS:
81 status = svc->fillObjRefs( pAddress, pObject );
82 break;
83 case UPDATE_OBJ:
84 status = svc->updateObj( pAddress, pObject );
85 break;
86 case UPDATE_OBJ_REFS:
87 status = svc->updateObjRefs( pAddress, pObject );
88 break;
89 case CREATE_REP:
90 status = svc->createRep( pObject, pAddress );
91 break;
92 case FILL_REP_REFS:
93 status = svc->fillRepRefs( pAddress, pObject );
94 break;
95 case UPDATE_REP:
96 status = svc->updateRep( pAddress, pObject );
97 break;
98 case UPDATE_REP_REFS:
99 status = svc->updateRepRefs( pAddress, pObject );
100 break;
101 default:
102 status = StatusCode::FAILURE;
103 break;
104 }
105 status.ignore();
106 return status;
107 }
108 return StatusCode::SUCCESS;
109 }
110
112 StatusCode PersistencySvc::createObj( IOpaqueAddress* pAddr, DataObject*& refpObj )
113 {
114 return makeCall( CREATE_OBJ, pAddr, refpObj );
115 }
116
118 StatusCode PersistencySvc::fillObjRefs( IOpaqueAddress* pAddr, DataObject* pObj )
119 {
120 return makeCall( FILL_OBJ_REFS, pAddr, pObj );
121 }
122
124 StatusCode PersistencySvc::updateObj( IOpaqueAddress* pAddr, DataObject* pObj )
125 {
126 return makeCall( UPDATE_OBJ, pAddr, pObj );
127 }
128
130 StatusCode PersistencySvc::updateObjRefs( IOpaqueAddress* pAddr, DataObject* pObj )
131 {
132 return makeCall( UPDATE_OBJ_REFS, pAddr, pObj );
133 }
134
136 StatusCode PersistencySvc::createRep( DataObject* pObj, IOpaqueAddress*& refpAddr )
137 {
138 return makeCall( CREATE_REP, refpAddr, pObj );
139 }
140
142 StatusCode PersistencySvc::fillRepRefs( IOpaqueAddress* pAddr, DataObject* pObj )
143 {
144 return makeCall( FILL_REP_REFS, pAddr, pObj );
145 }
146
148 StatusCode PersistencySvc::updateRep( IOpaqueAddress* pAddr, DataObject* pObj )
149 {
150 return makeCall( UPDATE_REP, pAddr, pObj );
151 }
152
154 StatusCode PersistencySvc::updateRepRefs( IOpaqueAddress* pAddr, DataObject* pObj )
155 {
156 return makeCall( UPDATE_REP_REFS, pAddr, pObj );
157 }
158
160 SmartIF<IAddressCreator>& PersistencySvc::addressCreator( long type )
161 {
162 long typ = type;
163 auto it = m_cnvServices.find( typ );
164 if ( it == m_cnvServices.end() ) {
165 IConversionSvc* s = service( type );
166 if ( s ) {
167 it = m_cnvServices.find( typ );
168 if ( it != m_cnvServices.end() ) return it->second.addrCreator();
169 }
170 static SmartIF<IAddressCreator> no_creator;
171 return no_creator;
172 }
173 return it->second.addrCreator();
174 }
175
177 StatusCode PersistencySvc::setDataProvider( IDataProviderSvc* pDataSvc )
178 {
179 m_dataSvc = pDataSvc;
180 for ( auto& i : m_cnvServices ) {
181 i.second.conversionSvc()->setDataProvider( m_dataSvc ).ignore();
182 }
183 return StatusCode( StatusCode::SUCCESS, true );
184 }
185
187 SmartIF<IDataProviderSvc>& PersistencySvc::dataProvider() const { return m_dataSvc; }
188
190 StatusCode PersistencySvc::setConversionSvc( IConversionSvc* svc )
191 {
192 m_cnvDefault = svc;
193 return StatusCode( StatusCode::SUCCESS, true );
194 }
195
197 SmartIF<IConversionSvc>& PersistencySvc::conversionSvc() const { return m_cnvDefault; }
198
200 StatusCode PersistencySvc::addConverter( const CLID& /* clid */ ) { return StatusCode::FAILURE; }
201
203 StatusCode PersistencySvc::addConverter( IConverter* pConverter )
204 {
205 if ( !pConverter ) return NO_CONVERTER;
206 IConversionSvc* svc = service( pConverter->repSvcType() );
207 return svc ? svc->addConverter( pConverter ) : BAD_STORAGE_TYPE;
208 }
209
211 StatusCode PersistencySvc::removeConverter( const CLID& clid )
212 {
213 // Remove converter type from all services
214 StatusCode status = NO_CONVERTER, iret = StatusCode::SUCCESS;
215 for ( auto& i : m_cnvServices ) {
216 iret = i.second.conversionSvc()->removeConverter( clid );
217 if ( iret.isSuccess() ) status = iret;
218 }
219 return status;
220 }
221
223 IConverter* PersistencySvc::converter( const CLID& /*clid*/ ) { return nullptr; }
224
226 SmartIF<IConversionSvc>& PersistencySvc::service( const std::string& nam )
227 {
228 Gaudi::Utils::TypeNameString tn( nam );
229 auto it = std::find_if( m_cnvServices.begin(), m_cnvServices.end(),
230 [&]( Services::const_reference i ) { return i.second.service()->name() == tn.name(); } );
231 if ( it != m_cnvServices.end() ) return it->second.conversionSvc();
232
233 auto svc = Service::service<IConversionSvc>( nam, true );
234 if ( svc && addCnvService( svc.get() ).isSuccess() ) {
235 return service( nam ); // now it is in the list
236 }
237
238 info() << "Cannot access Conversion service:" << nam << endmsg;
239 static SmartIF<IConversionSvc> no_svc;
240 return no_svc;
241 }
242
244 SmartIF<IConversionSvc>& PersistencySvc::service( long type )
245 {
246 // Check wether this is already an active service
247 auto it = m_cnvServices.find( type );
248 if ( it != m_cnvServices.end() ) return it->second.conversionSvc();
249 // if not, check if the service is in the list and may be requested
250 for ( const auto& i : m_svcNames.value() ) {
251 auto& svc = service( i );
252 if ( svc && svc->repSvcType() == type ) return svc;
253 }
254 static SmartIF<IConversionSvc> no_svc;
255 return no_svc;
256 }
257
259 StatusCode PersistencySvc::addCnvService( IConversionSvc* servc )
260 {
261 if ( !servc ) return BAD_STORAGE_TYPE;
262 long type = servc->repSvcType();
263 long def_typ = ( m_cnvDefault ? m_cnvDefault->repSvcType() : 0 );
264 auto it = m_cnvServices.find( type );
265 auto cnv_svc = ( it != m_cnvServices.end() ? it->second.conversionSvc() : nullptr );
266 if ( type == def_typ ) m_cnvDefault = servc;
267 if ( cnv_svc == servc ) return StatusCode::SUCCESS;
268
269 auto iservc = make_SmartIF( servc );
270 auto icr = iservc.as<IAddressCreator>();
271 if ( icr ) {
272 auto isvc = iservc.as<IService>();
273 if ( isvc ) {
274 if ( cnv_svc ) removeCnvService( type ).ignore();
275 auto p = m_cnvServices.emplace( type, ServiceEntry( type, isvc, iservc, icr ) );
276 if ( !p.second ) {
277 info() << "Cannot add Conversion service of type " << isvc->name() << endmsg;
278 return StatusCode::FAILURE;
279 }
280 info() << "Added successfully Conversion service:" << isvc->name() << endmsg;
281 iservc->setAddressCreator( this ).ignore();
282 iservc->setDataProvider( m_dataSvc ).ignore();
283 return StatusCode::SUCCESS;
284 }
285 }
286 info() << "Cannot add Conversion service of type " << type << endmsg;
287 return StatusCode::FAILURE;
288 }
289
291 StatusCode PersistencySvc::removeCnvService( long svctype )
292 {
293 auto it = m_cnvServices.find( svctype );
294 if ( it == m_cnvServices.end() ) return BAD_STORAGE_TYPE;
295 it->second.service()->release();
296 it->second.addrCreator()->release();
297 m_cnvServices.erase( it );
298 return StatusCode::SUCCESS;
299 }
300
302 long PersistencySvc::repSvcType() const { return m_cnvDefault ? m_cnvDefault->repSvcType() : 0; }
303
305 StatusCode PersistencySvc::setDefaultCnvService( long type )
306 {
307 m_cnvDefault = service( type );
308 return StatusCode::SUCCESS;
309 }
310
312 StatusCode PersistencySvc::connectOutput( const std::string& outputFile, const std::string& /* openMode */ )
313 {
314 return connectOutput( outputFile );
315 }
316
318 StatusCode PersistencySvc::connectOutput( const std::string& ) { return StatusCode::SUCCESS; }
319
321 StatusCode PersistencySvc::commitOutput( const std::string&, bool ) { return StatusCode::SUCCESS; }
322
324 StatusCode PersistencySvc::createAddress( long svc_type, const CLID& clid, const std::string* pars,
325 const unsigned long* ipars, IOpaqueAddress*& refpAddress )
326 {
327 refpAddress = nullptr;
328 IAddressCreator* svc = addressCreator( svc_type );
329 return svc ? svc->createAddress( svc_type, clid, pars, ipars, refpAddress ) : BAD_STORAGE_TYPE;
330 }
331
333 StatusCode PersistencySvc::convertAddress( const IOpaqueAddress* pAddress, std::string& refAddress )
334 {
335 // Assumuption is that the Persistency service prepends a header
336 // and requests the conversion service refered to by the service
337 // type to encode the rest
338 long svc_type = 0;
339 CLID clid = 0;
340 if ( pAddress ) {
341 svc_type = pAddress->svcType();
342 clid = pAddress->clID();
343 }
344 IAddressCreator* svc = addressCreator( svc_type );
345 StatusCode status = BAD_STORAGE_TYPE; // Preset error
346 refAddress.clear();
347
348 if ( svc ) {
349 // Found service, set header
350 encodeAddrHdr( svc_type, clid, refAddress );
351 std::string address;
352 // Get rest of address from conversion service
353 status = svc->convertAddress( pAddress, address );
354 refAddress += address;
355 }
356 return status;
357 }
358
360 StatusCode PersistencySvc::createAddress( long /* svc_type */, const CLID& /* clid */, const std::string& refAddress,
361 IOpaqueAddress*& refpAddress )
362 {
363 // Assumption is that the Persistency service decodes that header
364 // and requests the conversion service referred to by the service
365 // type to decode the rest
366 long new_svc_type = 0;
367 CLID new_clid = 0;
368 std::string address_trailer;
369 decodeAddrHdr( refAddress, new_svc_type, new_clid, address_trailer );
370 IAddressCreator* svc = addressCreator( new_svc_type );
371 return svc ? svc->createAddress( new_svc_type, new_clid, address_trailer, refpAddress ) : BAD_STORAGE_TYPE;
372 }
373
375 void PersistencySvc::encodeAddrHdr( long service_type, const CLID& clid, std::string& address ) const
376 {
377 // For address header, use xml-style format of
378 // <addrhdr service_type="xxx" clid="yyy" />
379 std::stringstream stream;
380 int svctyp = service_type; // must put int into stream, not char
381 stream << "<address_header service_type=\"" << svctyp << "\" clid=\"" << clid << "\" /> ";
382 address = stream.str();
383 }
384
386 void PersistencySvc::decodeAddrHdr( const std::string& address, long& service_type, CLID& clid,
387 std::string& address_trailer ) const
388 {
389 // For address header, use xml-style format of
390 // <address_header service_type="xxx" clid="yyy" />
391 service_type = 0;
392 clid = 0;
393 address_trailer.clear();
394
395 // Check for address_header tag
396 size_t pos = address.find( "<address_header" );
397 if ( std::string::npos != pos ) {
398 // Get service_type
399 pos = address.find( "service_type=\"" );
400 if ( std::string::npos != pos ) {
401 pos += 14;
402 size_t end = address.find( '"', pos );
403 if ( std::string::npos != end ) {
404 service_type = std::stol( address.substr( pos, end - pos ) );
405 // Get clid
406 pos = address.find( "clid=\"" );
407 if ( std::string::npos != pos ) {
408 pos += 6;
409 end = address.find( '\"', pos );
410 if ( std::string::npos != end ) {
411 std::istringstream str;
412 str.str( address.substr( pos, end - pos ) );
413 str >> clid;
414 // Get trailer_address
415 pos = address.find( '>' );
416 if ( pos < ( address.size() - 2 ) ) { // this means that '>' was found (pos != npos)
417 // it is before the last char
418 address_trailer = address.substr( pos + 1 );
419 }
420 }
421 }
422 }
423 }
424 }
425 }
426
428 StatusCode PersistencySvc::setAddressCreator( IAddressCreator* )
429 {
430 // The persistency service is a address creation dispatcher istelf.
431 // The persistency service can NEVER create addresses itself.
432 // The entry point must only be provided in order to fulfill the needs of the
433 // implementing interfaces.
434 return StatusCode::FAILURE;
435 }
436
438 SmartIF<IAddressCreator>& PersistencySvc::addressCreator() const { return m_addrCreator; }
439
441 StatusCode PersistencySvc::getService( long service_type, IConversionSvc*& refpSvc )
442 {
443 refpSvc = service( service_type );
444 return refpSvc ? StatusCode::SUCCESS : StatusCode::FAILURE;
445 }
446
448 StatusCode PersistencySvc::getService( const std::string& service_type, IConversionSvc*& refpSvc )
449 {
450 const char* imp = service_type.c_str();
451 long len = service_type.length();
452 if (::strncasecmp( imp, "SICB", len ) == 0 )
453 return getService( SICB_StorageType, refpSvc );
454 else if (::strncasecmp( imp, "ZEBRA", len ) == 0 )
455 return getService( SICB_StorageType, refpSvc );
456 else if (::strncasecmp( imp, "MS Access", len ) == 0 )
457 return getService( ACCESS_StorageType, refpSvc );
458 else if (::strncasecmp( imp, "Microsoft Access", strlen( "Microsoft Access" ) ) == 0 )
459 return getService( ACCESS_StorageType, refpSvc );
460 else if (::strncasecmp( imp, "SQL Server", len ) == 0 )
461 return getService( SQLSERVER_StorageType, refpSvc );
462 else if (::strncasecmp( imp, "Microsoft ODBC for Oracle", len ) == 0 )
463 return getService( ORACLE_StorageType, refpSvc );
464 else if (::strncasecmp( imp, "Oracle ODBC", strlen( "Oracle ODBC" ) ) == 0 )
465 return getService( ORACLE_StorageType, refpSvc );
466 else if (::strncasecmp( imp, "Oracle OCI", strlen( "Oracle OCI" ) ) == 0 )
467 return getService( ORACLE_StorageType, refpSvc );
468 else if (::strncasecmp( imp, "MySQL", len ) == 0 )
469 return getService( MYSQL_StorageType, refpSvc );
470 else if (::strncasecmp( imp, "ROOT", len ) == 0 )
471 return getService( ROOT_StorageType, refpSvc );
472 else if (::strncasecmp( imp, "OBJY", len ) == 0 )
473 return getService( OBJY_StorageType, refpSvc );
474 else if (::strncasecmp( imp, "OBJYECTI", 7 ) == 0 )
475 return getService( OBJY_StorageType, refpSvc );
476 else if (::strncasecmp( imp, "POOL_ROOTKEY", 12 ) == 0 )
477 return getService( POOL_ROOTKEY_StorageType, refpSvc );
478 else if (::strncasecmp( imp, "POOL_ROOTTREE", 12 ) == 0 )
479 return getService( POOL_ROOTTREE_StorageType, refpSvc );
480 else if (::strncasecmp( imp, "POOL_ROOT", 9 ) == 0 )
481 return getService( POOL_ROOT_StorageType, refpSvc );
482 else if (::strncasecmp( imp, "POOL_MySQL", 8 ) == 0 )
483 return getService( POOL_MYSQL_StorageType, refpSvc );
484 else if (::strncasecmp( imp, "POOL_ORACLE", 8 ) == 0 )
485 return getService( POOL_ORACLE_StorageType, refpSvc );
486 else if (::strncasecmp( imp, "POOL_ACCESS", 8 ) == 0 )
487 return getService( POOL_ACCESS_StorageType, refpSvc );
488 else if (::strncasecmp( imp, "POOL", 4 ) == 0 )
489 return getService( POOL_StorageType, refpSvc );
490
491 for ( const auto& i : m_cnvServices ) {
492 SmartIF<IService> svc( i.second.conversionSvc() );
493 if ( svc ) {
494 // Check wether this is already an active service: first check by service name
495 if ( svc->name() == service_type ) {
496 refpSvc = i.second.conversionSvc();
497 return StatusCode::SUCCESS;
498 }
499 // Check wether this is already an active service: now check by service type
500 auto instance = svc.get();
501 if ( System::typeinfoName( typeid( *instance ) ) == service_type ) {
502 refpSvc = i.second.conversionSvc();
503 return StatusCode::SUCCESS;
504 }
505 }
506 }
507 // if not, check if the service is in the list and may be requested
508 for ( const auto& i : m_svcNames.value() ) {
509 Gaudi::Utils::TypeNameString itm( i );
510 if ( itm.name() == service_type || itm.type() == service_type ) {
511 IConversionSvc* svc = service( i );
512 if ( svc ) {
513 refpSvc = svc;
514 return StatusCode::SUCCESS;
515 }
516 }
517 }
518 return StatusCode::FAILURE;
519 }
520
522 const CLID& PersistencySvc::objType() const { return CLID_NULL; }
523
525 StatusCode PersistencySvc::initialize()
526 {
527 m_addrCreator = this; // initialize internal pointer to IAddressCreator interface
528 // Initialize basic service
529 StatusCode status = Service::initialize();
530 if ( UNLIKELY( !status.isSuccess() ) ) {
531 error() << "Error initializing Service base class." << endmsg;
532 }
533 return status;
534 }
535
537 StatusCode PersistencySvc::finalize()
538 {
539 // Release all workers
540 m_cnvServices.clear();
541 // Release references to this to avoid loops
542 m_addrCreator = nullptr;
543 return StatusCode::SUCCESS;
544 }
545
546 void PersistencySvc::svcNamesHandler( Gaudi::Details::PropertyBase& p ) { DEBMSG << p << endmsg; }
547
549 bool PersistencySvc::enable( bool value )
550 {
551 std::swap( value, m_enable );
552 return value;
553 }
554
556 PersistencySvc::PersistencySvc( const std::string& name, ISvcLocator* svc ) : base_class( name, svc )
557 {
558 m_svcNames.declareUpdateHandler( &PersistencySvc::svcNamesHandler, this );
559 }
PersistencySvc::m_addrCreator
SmartIF< IAddressCreator > m_addrCreator
Pointer to the IAddressCreator interface of this, for addressCreator().
Definition: PersistencySvc.h:255
IDataSelector.h
CREATE_OBJ
Definition: PersistencySvc.cpp:46
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:128
UPDATE_OBJ_REFS
Definition: PersistencySvc.cpp:49
PersistencySvc::service
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
Definition: PersistencySvc.cpp:226
PersistencySvc::ServiceEntry::conversionSvc
SmartIF< IConversionSvc > & conversionSvc() const
Definition: PersistencySvc.h:78
PersistencySvc::addressCreator
SmartIF< IAddressCreator > & addressCreator() const override
Retrieve address creator facility.
Definition: PersistencySvc.cpp:438
StatusCode::SUCCESS
Definition: StatusCode.h:29
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:64
SmartIF< IAddressCreator >
PersistencySvc::ServiceEntry::addrCreator
SmartIF< IAddressCreator > & addrCreator() const
Definition: PersistencySvc.h:79
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition: ISvcLocator.h:25
std::istringstream
STL class.
IConverter
The data converters are responsible to translate data from one representation into another...
Definition: IConverter.h:58
IOpaqueAddress::clID
virtual const CLID & clID() const =0
Retrieve class information from link.
Service::name
const std::string & name() const override
Retrieve name of the service.
Definition: Service.cpp:289
IConverter::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)=0
Create the transient representation of an object.
DEBMSG
#define DEBMSG
Definition: PersistencySvc.cpp:38
PersistencySvc::initialize
StatusCode initialize() override
Initialize the service.
Definition: PersistencySvc.cpp:525
IConversionSvc
Definition: IConversionSvc.h:37
MsgStream.h
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:112
PersistencySvc::connectOutput
StatusCode connectOutput(const std::string &outputFile, const std::string &openMode) override
Connect the output file to the service with open mode.
Definition: PersistencySvc.cpp:312
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:336
IAddressCreator::createAddress
virtual StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ipar, IOpaqueAddress *&refpAddress)=0
Create a Generic address using explicit arguments to identify a single object.
PersistencySvc::ServiceEntry
Definition: PersistencySvc.h:53
std::swap
T swap(T...args)
PersistencySvc::m_svcNames
Gaudi::Property< std::vector< std::string > > m_svcNames
Definition: PersistencySvc.h:248
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:50
ACCESS_StorageType
const long ACCESS_StorageType
Definition: ClassID.h:60
IAddressCreator
IAddressCreator interface definition.
Definition: IAddressCreator.h:28
PersistencySvc::ServiceEntry::service
SmartIF< IService > & service() const
Definition: PersistencySvc.h:77
PersistencySvc::m_enable
bool m_enable
Flag to indicate that the service is enabled.
Definition: PersistencySvc.h:252
PersistencySvc::setConversionSvc
StatusCode setConversionSvc(IConversionSvc *svc) override
Set conversion service the converter is connected to.
Definition: PersistencySvc.cpp:190
IConversionSvc::addConverter
virtual StatusCode addConverter(IConverter *pConverter)=0
Add converter object to conversion service.
PersistencySvc::makeCall
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
Definition: PersistencySvc.cpp:56
FILL_OBJ_REFS
Definition: PersistencySvc.cpp:47
std::map::end
T end(T...args)
IConverter::createRep
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
MYSQL_StorageType
const long MYSQL_StorageType
Definition: ClassID.h:64
IDataProviderSvc
Data provider interface definition.
Definition: IDataProviderSvc.h:46
PersistencySvc::removeConverter
StatusCode removeConverter(const CLID &clid) override
Remove converter object from conversion service (if present).
Definition: PersistencySvc.cpp:211
PersistencySvc::PersistencySvc
PersistencySvc(const std::string &name, ISvcLocator *svc)
Standard Constructor.
Definition: PersistencySvc.cpp:556
IConverter::updateRepRefs
virtual StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an already converted object.
POOL_MYSQL_StorageType
const long POOL_MYSQL_StorageType
Definition: ClassID.h:72
PersistencySvc::updateRep
StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Update the converted representation of a transient object.
Definition: PersistencySvc.cpp:148
std::stringstream
STL class.
PersistencySvc::updateObjRefs
StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Update the references of an updated transient object.
Definition: PersistencySvc.cpp:130
PersistencySvc::addConverter
StatusCode addConverter(IConverter *pConverter) override
Add converter object to conversion service.
Definition: PersistencySvc.cpp:203
IConverter::updateObj
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)=0
Update the transient object from the other representation.
PersistencySvc::convertAddress
StatusCode convertAddress(const IOpaqueAddress *pAddress, std::string &refAddress) override
Convert an address to string form.
Definition: PersistencySvc.cpp:333
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition: PluginService.h:33
std::string
STL class.
POOL_ROOTKEY_StorageType
const long POOL_ROOTKEY_StorageType
Definition: ClassID.h:69
PersistencySvc::fillObjRefs
StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Resolve the references of the created transient object.
Definition: PersistencySvc.cpp:118
PersistencySvc::enable
bool enable(bool value)
Set enabled flag.
Definition: PersistencySvc.cpp:549
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:106
PersistencySvc::setDataProvider
StatusCode setDataProvider(IDataProviderSvc *pStore) override
Define transient datastore.
Definition: PersistencySvc.cpp:177
POOL_ACCESS_StorageType
const long POOL_ACCESS_StorageType
Definition: ClassID.h:71
Gaudi::Utils::TypeNameString
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:12
IDataProviderSvc.h
FILL_REP_REFS
Definition: PersistencySvc.cpp:51
PersistencySvc::encodeAddrHdr
void encodeAddrHdr(long service_type, const CLID &clid, std::string &address) const
Retrieve string from storage type and clid.
Definition: PersistencySvc.cpp:375
IService
General service interface definition.
Definition: IService.h:18
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
gaudirun.type
type
Definition: gaudirun.py:133
PersistencySvc::createRep
StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress) override
Implementation of IConverter: Convert the transient object to the requested representation.
Definition: PersistencySvc.cpp:136
PersistencySvc::finalize
StatusCode finalize() override
stop the service.
Definition: PersistencySvc.cpp:537
IConverter::updateObjRefs
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
SmartIF.h
PersistencySvc::getService
StatusCode getService(long service_type, IConversionSvc *&refpSvc) override
Retrieve conversion service identified by technology.
Definition: PersistencySvc.cpp:441
std::map::erase
T erase(T...args)
CnvSvcAction
CnvSvcAction
Definition: PersistencySvc.cpp:45
POOL_ORACLE_StorageType
const long POOL_ORACLE_StorageType
Definition: ClassID.h:73
PersistencySvc::m_cnvDefault
SmartIF< IConversionSvc > m_cnvDefault
Default output service.
Definition: PersistencySvc.h:246
PersistencySvc::commitOutput
StatusCode commitOutput(const std::string &output, bool do_commit) override
Commit pending output.
Definition: PersistencySvc.cpp:321
std::stringstream::str
T str(T...args)
end
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:64
PersistencySvc
PersistencySvc class implementation definition.
Definition: PersistencySvc.h:50
ROOT_StorageType
const long ROOT_StorageType
Definition: ClassID.h:52
PersistencySvc::fillRepRefs
StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Resolve the references of the converted object.
Definition: PersistencySvc.cpp:142
PersistencySvc::conversionSvc
SmartIF< IConversionSvc > & conversionSvc() const override
Get conversion service the converter is connected to.
Definition: PersistencySvc.cpp:197
IOpaqueAddress::svcType
virtual long svcType() const =0
Retrieve service type.
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition: Property.h:32
PersistencySvc::dataProvider
SmartIF< IDataProviderSvc > & dataProvider() const override
Access reference to transient datastore.
Definition: PersistencySvc.cpp:187
IConverter::updateRep
virtual StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the converted representation of a transient object.
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
PersistencySvc.h
std::string::clear
T clear(T...args)
ORACLE_StorageType
const long ORACLE_StorageType
Definition: ClassID.h:65
POOL_ROOT_StorageType
const long POOL_ROOT_StorageType
Definition: ClassID.h:68
PersistencySvc::addCnvService
StatusCode addCnvService(IConversionSvc *service) override
Add a new Service.
Definition: PersistencySvc.cpp:259
IOpaqueAddress.h
PersistencySvc::removeCnvService
StatusCode removeCnvService(long type) override
Remove a Service.
Definition: PersistencySvc.cpp:291
PersistencySvc::updateObj
StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject) override
Implementation of IConverter: Update the transient object from the other representation.
Definition: PersistencySvc.cpp:124
PersistencySvc::createAddress
StatusCode createAddress(long svc_type, const CLID &clid, const std::string *pars, const unsigned long *ipars, IOpaqueAddress *&refpAddress) override
Create a Generic address using explicit arguments to identify a single object.
Definition: PersistencySvc.cpp:324
POOL_StorageType
const long POOL_StorageType
Definition: ClassID.h:67
std::map::find
T find(T...args)
std::string::size
T size(T...args)
IConverter::fillObjRefs
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the created transient object.
IConverter::repSvcType
virtual long repSvcType() const =0
Retrieve the class type of the data store the converter uses.
PersistencySvc::svcNamesHandler
void svcNamesHandler(Gaudi::Details::PropertyBase &theProp)
Handlers for Service Names Property.
Definition: PersistencySvc.cpp:546
POOL_ROOTTREE_StorageType
const long POOL_ROOTTREE_StorageType
Definition: ClassID.h:70
IAddressCreator::convertAddress
virtual StatusCode convertAddress(const IOpaqueAddress *pAddress, std::string &refAddress)=0
Convert an address to string form.
std::map::begin
T begin(T...args)
PersistencySvc::createObj
StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject) override
Implementation of IConverter: Create the transient representation of an object.
Definition: PersistencySvc.cpp:112
Gaudi::Utils::TypeNameString::type
const std::string & type() const
Definition: TypeNameString.h:39
std::string::c_str
T c_str(T...args)
PersistencySvc::m_cnvServices
Services m_cnvServices
List of convermsion workers.
Definition: PersistencySvc.h:244
std::map::emplace
T emplace(T...args)
gaudirun.s
string s
Definition: gaudirun.py:253
TypeNameString.h
CommonMessaging
Definition: CommonMessaging.h:62
PersistencySvc::setAddressCreator
StatusCode setAddressCreator(IAddressCreator *creator) override
Set address creator facility.
Definition: PersistencySvc.cpp:428
std::string::substr
T substr(T...args)
make_SmartIF
SmartIF< IFace > make_SmartIF(IFace *iface)
Definition: SmartIF.h:152
PersistencySvc::decodeAddrHdr
void decodeAddrHdr(const std::string &address, long &service_type, CLID &clid, std::string &address_trailer) const
Retrieve storage type and clid from address header of string.
Definition: PersistencySvc.cpp:386
CREATE_REP
Definition: PersistencySvc.cpp:50
SQLSERVER_StorageType
const long SQLSERVER_StorageType
Definition: ClassID.h:63
StatusCode::FAILURE
Definition: StatusCode.h:29
Gaudi::Utils::TypeNameString::name
const std::string & name() const
Definition: TypeNameString.h:40
IConverter::conversionSvc
virtual SmartIF< IConversionSvc > & conversionSvc() const =0
Get conversion service the converter is connected to.
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:84
UPDATE_OBJ
Definition: PersistencySvc.cpp:48
OBJY_StorageType
const long OBJY_StorageType
Definition: ClassID.h:53
PersistencySvc::setDefaultCnvService
StatusCode setDefaultCnvService(long type) override
Set default service type.
Definition: PersistencySvc.cpp:305
SICB_StorageType
const long SICB_StorageType
Definition: ClassID.h:51
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
IConverter.h
PersistencySvc::objType
const CLID & objType() const override
Retrieve the class type of objects the converter produces. (DUMMY)
Definition: PersistencySvc.cpp:522
IConverter::fillRepRefs
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
UPDATE_REP_REFS
Definition: PersistencySvc.cpp:53
PersistencySvc::updateRepRefs
StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject) override
Implementation of IConverter: Update the references of an already converted object.
Definition: PersistencySvc.cpp:154
std::stol
T stol(T...args)
ISvcLocator.h
PersistencySvc::repSvcType
long repSvcType() const override
Return default service type.
Definition: PersistencySvc.cpp:302
strcasecmp.h
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:209
DataObject.h
UPDATE_REP
Definition: PersistencySvc.cpp:52
PersistencySvc::m_dataSvc
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to datma provider service.
Definition: PersistencySvc.h:242
PersistencySvc::converter
IConverter * converter(const CLID &clid) override
Retrieve converter from list.
Definition: PersistencySvc.cpp:223