| The Gaudi Framework v28r2p1 (f1a77ff4)

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

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Protected Types | Protected Member Functions | Protected Attributes | List of all members
PersistencySvc Class Reference

PersistencySvc class implementation definition. More...

`#include <src/PersistencySvc/PersistencySvc.h>`

Inheritance diagram for PersistencySvc:
[legend]
Collaboration diagram for PersistencySvc:
[legend]

## Classes
class | ServiceEntry

## Public Member Functions
IPersistencySvc Interface implementation
long | repSvcType () const override
| Return default service type. More...
const CLID & | objType () const override
| Retrieve the class type of objects the converter produces. (DUMMY) More...
StatusCode | createObj (IOpaqueAddress *pAddress, DataObject *&refpObject) override
| Implementation of IConverter: Create the transient representation of an object. More...
StatusCode | fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
| Implementation of IConverter: Resolve the references of the created transient object. More...
StatusCode | updateObj (IOpaqueAddress *pAddress, DataObject *refpObject) override
| Implementation of IConverter: Update the transient object from the other representation. More...
StatusCode | updateObjRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
| Implementation of IConverter: Update the references of an updated transient object. More...
StatusCode | createRep (DataObject *pObject, IOpaqueAddress *&refpAddress) override
| Implementation of IConverter: Convert the transient object to the requested representation. More...
StatusCode | fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
| Implementation of IConverter: Resolve the references of the converted object. More...
StatusCode | updateRep (IOpaqueAddress *pAddress, DataObject *pObject) override
| Implementation of IConverter: Update the converted representation of a transient object. More...
StatusCode | updateRepRefs (IOpaqueAddress *pAddress, DataObject *pObject) override
| Implementation of IConverter: Update the references of an already converted object. More...
StatusCode | setDataProvider (IDataProviderSvc *pStore) override
| Define transient datastore. More...
SmartIF< IDataProviderSvc > & | dataProvider () const override
| Access reference to transient datastore. More...
StatusCode | setConversionSvc (IConversionSvc *svc) override
| Set conversion service the converter is connected to. More...
SmartIF< IConversionSvc > & | conversionSvc () const override
| Get conversion service the converter is connected to. More...
StatusCode | setAddressCreator (IAddressCreator *creator) override
| Set address creator facility. More...
SmartIF< IAddressCreator > & | addressCreator () const override
| Retrieve address creator facility. More...
StatusCode | addConverter (IConverter *pConverter) override
| Add converter object to conversion service. More...
StatusCode | addConverter (const CLID &clid) override
| Add converter object to conversion service. More...
IConverter * | converter (const CLID &clid) override
| Retrieve converter from list. More...
StatusCode | removeConverter (const CLID &clid) override
| Remove converter object from conversion service (if present). More...
StatusCode | connectOutput (const std::string &outputFile, const std::string &openMode) override
| Connect the output file to the service with open mode. More...
StatusCode | connectOutput (const std::string &outputFile) override
| Connect the output file to the service. More...
StatusCode | commitOutput (const std::string &output, bool do_commit) override
| Commit pending output. More...
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. More...
StatusCode | convertAddress (const IOpaqueAddress *pAddress, std::string &refAddress) override
| Convert an address to string form. More...
StatusCode | createAddress (long svc_type, const CLID &clid, const std::string &refAddress, IOpaqueAddress *&refpAddress) override
| Convert an address in string form to object form. More...
: IPersistencySvc implementation
StatusCode | addCnvService (IConversionSvc *service) override
| Add a new Service. More...
StatusCode | removeCnvService (long type) override
| Remove a Service. More...
StatusCode | setDefaultCnvService (long type) override
| Set default service type. More...
StatusCode | getService (long service_type, IConversionSvc *&refpSvc) override
| Retrieve conversion service identified by technology. More...
StatusCode | getService (const std::string &service_type, IConversionSvc *&refpSvc) override
| Retrieve conversion service identified by technology. More...
: IService implementation
StatusCode | initialize () override
| Initialize the service. More...
StatusCode | finalize () override
| stop the service. More...
Public Member Functions inherited from extends< Service, IConversionSvc, IPersistencySvc, IAddressCreator >
void * | i_cast (const InterfaceID &tid) const override
| Implementation of IInterface::i_cast. More...
StatusCode | queryInterface (const InterfaceID &ti, void **pp) override
| Implementation of IInterface::queryInterface. More...
std::vector< std::string > | getInterfaceNames () const override
| Implementation of IInterface::getInterfaceNames. More...
| ~extends () override=default
| Virtual destructor. More...
Public Member Functions inherited from Service
const std::string & | name () const override
| Retrieve name of the service. More...
StatusCode | configure () override
StatusCode | initialize () override
StatusCode | start () override
StatusCode | stop () override
StatusCode | finalize () override
StatusCode | terminate () override
Gaudi::StateMachine::State | FSMState () const override
Gaudi::StateMachine::State | targetFSMState () const override
StatusCode | reinitialize () override
StatusCode | restart () override
StatusCode | sysInitialize () override
| Initialize Service. More...
StatusCode | sysStart () override
| Initialize Service. More...
StatusCode | sysStop () override
| Initialize Service. More...
StatusCode | sysFinalize () override
| Finalize Service. More...
StatusCode | sysReinitialize () override
| Re-initialize the Service. More...
StatusCode | sysRestart () override
| Re-initialize the Service. More...
| Service (std::string name, ISvcLocator *svcloc)
| Standard Constructor. More...
SmartIF< ISvcLocator > & | serviceLocator () const override
| Retrieve pointer to service locator. More...
StatusCode | setProperties ()
| Method for setting declared properties to the values specified for the job. More...
template<class T >
StatusCode | service (const std::string &name, const T *&psvc, bool createIf=true) const
| Access a service by name, creating it if it doesn't already exist. More...
template<class T >
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const
template<typename IFace = IService>
SmartIF< IFace > | service (const std::string &name, bool createIf=true) const
template<class T >
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const
| Access a service by name and type, creating it if it doesn't already exist. More...
template<class T >
StatusCode | declarePrivateTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
| Declare used Private tool. More...
template<class T >
StatusCode | declarePublicTool (ToolHandle< T > &handle, std::string toolTypeAndName="", bool createIf=true)
| Declare used Public tool. More...
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
Public Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
| PropertyHolder ()=default
| ~PropertyHolder () override=default
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Details::PropertyBase &prop)
| Declare a property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none")
| Helper to wrap a regular data member and use it as a regular property. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, TYPE &value, const std::string &doc="none") const
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, Gaudi::Property< TYPE, VERIFIER, HANDLERS > &prop, const std::string &doc="none")
| Declare a PropertyBase instance setting name and documentation. More...
Gaudi::Details::PropertyBase * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="")
| Declare a remote property. More...
StatusCode | setProperty (const Gaudi::Details::PropertyBase &p) override
| set the property form another property More...
StatusCode | setProperty (const std::string &s) override
| set the property from the formatted string More...
StatusCode | setProperty (const std::string &n, const std::string &v) override
| set the property from name and the value More...
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value More...
StatusCode | getProperty (Gaudi::Details::PropertyBase *p) const override
| get the property More...
const Gaudi::Details::PropertyBase & | getProperty (const std::string &name) const override
| get the property by name More...
StatusCode | getProperty (const std::string &n, std::string &v) const override
| convert the property to the string More...
const std::vector< Gaudi::Details::PropertyBase * > & | getProperties () const override
| get all properties More...
bool | hasProperty (const std::string &name) const override
| Return true if we have a property with the given name. More...
| PropertyHolder (const PropertyHolder &)=delete
PropertyHolder & | operator= (const PropertyHolder &)=delete
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleBase &ref, const std::string &doc="none")
| Specializations for various GaudiHandles. More...
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, GaudiHandleArrayBase &ref, const std::string &doc="none")
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, DataObjectHandleBase &ref, const std::string &doc="none")
Public Member Functions inherited from CommonMessagingBase
virtual | ~CommonMessagingBase ()=default
| Virtual destructor. More...
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service. More...
MsgStream & | msgStream () const
| Return an uninitialized MsgStream. More...
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts. More...
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS) More...
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL) More...
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR) More...
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING) More...
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO) More...
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG) More...
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE) More...
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO) More...
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream More...
MSG::Level | outputLevel () const __attribute__((deprecated))
| Backward compatibility function for getting the output level. More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...
Public Member Functions inherited from extend_interfaces< Interfaces... >
| ~extend_interfaces () override=default
| Virtual destructor. More...

## Protected Types
typedef std::map< long, ServiceEntry > | Services

## Protected Member Functions
void | svcNamesHandler (Gaudi::Details::PropertyBase &theProp)
| Handlers for Service Names Property. More...
Protected Member Functions inherited from Service
| ~Service () override
| Standard Destructor. More...
int | outputLevel () const
| get the `Service's` output level More...
Protected Member Functions inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
Gaudi::Details::PropertyBase * | property (const std::string &name) const
Protected Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
void | updateMsgStreamOutputLevel (int level)
| Update the output level of the cached MsgStream. More...

## Protected Attributes
long | m_cnvDefType = TEST_StorageType
| Default service type. More...
SmartIF< IDataProviderSvc > | m_dataSvc
| Pointer to datma provider service. More...
Services | m_cnvServices
| List of convermsion workers. More...
SmartIF< IConversionSvc > | m_cnvDefault
| Default output service. More...
Gaudi::Property< std::vector< std::string > > | m_svcNames
bool | m_enable = true
| Flag to indicate that the service is enabled. More...
SmartIF< IAddressCreator > | m_addrCreator
| Pointer to the IAddressCreator interface of this, for addressCreator(). More...
Protected Attributes inherited from Service
Gaudi::StateMachine::State | m_state = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::StateMachine::State | m_targetState = Gaudi::StateMachine::OFFLINE
| Service state. More...
Gaudi::Property< int > | m_outputLevel {this, "OutputLevel", MSG::NIL, "output level"}
Gaudi::Property< bool > | m_auditInit {this, "AuditServices", false, "[[deprecated]] unused"}
Gaudi::Property< bool > | m_auditorInitialize {this, "AuditInitialize", false, "trigger auditor on initialize()"}
Gaudi::Property< bool > | m_auditorStart {this, "AuditStart", false, "trigger auditor on start()"}
Gaudi::Property< bool > | m_auditorStop {this, "AuditStop", false, "trigger auditor on stop()"}
Gaudi::Property< bool > | m_auditorFinalize {this, "AuditFinalize", false, "trigger auditor on finalize()"}
Gaudi::Property< bool > | m_auditorReinitialize {this, "AuditReinitialize", false, "trigger auditor on reinitialize()"}
Gaudi::Property< bool > | m_auditorRestart {this, "AuditRestart", false, "trigger auditor on restart()"}
SmartIF< IAuditorSvc > | m_pAuditorSvc
| Auditor Service. More...

## : Object implementation
| PersistencySvc (const std::string &name, ISvcLocator *svc)
| Standard Constructor. More...
| ~PersistencySvc () override=default
| Standard Destructor. More...
SmartIF< IConversionSvc > & | service (const std::string &nam)
| Retrieve conversion service by name. More...
SmartIF< IConversionSvc > & | service (long service_type)
| Retrieve conversion service from list. More...
SmartIF< IAddressCreator > & | addressCreator (long service_type)
| Retrieve address creator from list. More...
void | encodeAddrHdr (long service_type, const CLID &clid, std::string &address) const
| Retrieve string from storage type and clid. More...
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. More...
StatusCode | makeCall (int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
| Implementation helper. More...
bool | enable (bool value)
| Set enabled flag. More...

## Additional Inherited Members
Public Types inherited from extends< Service, IConversionSvc, IPersistencySvc, IAddressCreator >
using | base_class = extends
| Typedef to this class. More...
using | extend_interfaces_base = extend_interfaces< Interfaces... >
| Typedef to the base of this class. More...
Public Types inherited from Service
typedef Gaudi::PluginService::Factory< IService *, const std::string &, ISvcLocator * > | Factory
Public Types inherited from PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
using | PropertyHolderImpl = PropertyHolder< CommonMessaging< implements< IService, IProperty, IStateful > > >
| Typedef used to refer to this class from derived classes, as in. More...
Public Types inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
using | base_class = CommonMessaging
Public Types inherited from extend_interfaces< Interfaces... >
using | ext_iids = typename Gaudi::interface_list_cat< typename Interfaces::ext_iids... >::type
| take union of the ext_iids of all Interfaces... More...

## Detailed Description

PersistencySvc class implementation definition.

System: The LHCb Offline System

Package: PersistencySvc

Dependencies:

- STL: <vector>, <algorithm>, <functional>
- Generic service definition: "Kernel/Service.h"
- IConversionSvc definition: "Kernel/IConversionSvc.h"
- PersistencySvc definition: "Kernel/Interfaces/IPersistencySvc.h"

History:

     +---------+----------------------------------------------+---------+
     |    Date |                 Comment                      | Who     |
     +---------+----------------------------------------------+---------+
     | 3/11/98 | Initial version                              | M.Frank |
     +---------+----------------------------------------------+---------+

Author
  Markus Frank

Version
  1.0

Definition at line 50 of file PersistencySvc.h.

## Member Typedef Documentation

typedef std::map<long, ServiceEntry> PersistencySvc::Services
| protected

Definition at line 82 of file PersistencySvc.h.

## Constructor & Destructor Documentation

PersistencySvc::PersistencySvc | ( | const std::string & | name,
|  | ISvcLocator * | svc
| ) |  |

Standard Constructor.

Definition at line 556 of file PersistencySvc.cpp.

556 : base_class( name, svc )
557 {
558 m_svcNames.declareUpdateHandler( &PersistencySvc::svcNamesHandler, this );
559 }
PersistencySvc::m_svcNames
Gaudi::Property< std::vector< std::string > > m_svcNames
Definition: PersistencySvc.h:248
extends< Service, IConversionSvc, IPersistencySvc, IAddressCreator >::base_class
extends base_class
Typedef to this class.
Definition: extends.h:14
PersistencySvc::svcNamesHandler
void svcNamesHandler(Gaudi::Details::PropertyBase &theProp)
Handlers for Service Names Property.
Definition: PersistencySvc.cpp:546

PersistencySvc::~PersistencySvc | ( |  | ) |
| override default

Standard Destructor.

## Member Function Documentation

StatusCode PersistencySvc::addCnvService | ( | IConversionSvc * | service | ) |
| override

Add a new Service.

Add data service.

Definition at line 259 of file PersistencySvc.cpp.

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 }
PersistencySvc::ServiceEntry::conversionSvc
SmartIF< IConversionSvc > & conversionSvc() const
Definition: PersistencySvc.h:78
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:123
IAddressCreator
IAddressCreator interface definition.
Definition: IAddressCreator.h:28
std::map::end
T end(T...args)
IService
General service interface definition.
Definition: IService.h:18
gaudirun.type
type
Definition: gaudirun.py:125
PersistencySvc::m_cnvDefault
SmartIF< IConversionSvc > m_cnvDefault
Default output service.
Definition: PersistencySvc.h:246
PersistencySvc::removeCnvService
StatusCode removeCnvService(long type) override
Remove a Service.
Definition: PersistencySvc.cpp:291
std::map::find
T find(T...args)
IConverter::repSvcType
virtual long repSvcType() const =0
Retrieve the class type of the data store the converter uses.
PersistencySvc::m_cnvServices
Services m_cnvServices
List of convermsion workers.
Definition: PersistencySvc.h:244
std::map::emplace
T emplace(T...args)
make_SmartIF
SmartIF< IFace > make_SmartIF(IFace *iface)
Definition: SmartIF.h:143
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:106
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
PersistencySvc::m_dataSvc
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to datma provider service.
Definition: PersistencySvc.h:242

StatusCode PersistencySvc::addConverter | ( | IConverter * | pConverter | ) |
| override

Add converter object to conversion service.

Definition at line 203 of file PersistencySvc.cpp.

204 {
205 if ( !pConverter ) return NO_CONVERTER;
206 IConversionSvc* svc = service( pConverter->repSvcType() );
207 return svc ? svc->addConverter( pConverter ) : BAD_STORAGE_TYPE;
208 }
PersistencySvc::service
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
Definition: PersistencySvc.cpp:226
IConversionSvc
Definition: IConversionSvc.h:37
IConversionSvc::addConverter
virtual StatusCode addConverter(IConverter *pConverter)=0
Add converter object to conversion service.
IConverter::repSvcType
virtual long repSvcType() const =0
Retrieve the class type of the data store the converter uses.

StatusCode PersistencySvc::addConverter | ( | const CLID & | clid | ) |
| override

Add converter object to conversion service.

Definition at line 200 of file PersistencySvc.cpp.

200 { return StatusCode::FAILURE; }
StatusCode::FAILURE
Definition: StatusCode.h:29

SmartIF< IAddressCreator > & PersistencySvc::addressCreator | ( |  | ) | const
| override

Retrieve address creator facility.

Definition at line 438 of file PersistencySvc.cpp.

438 { return m_addrCreator; }
PersistencySvc::m_addrCreator
SmartIF< IAddressCreator > m_addrCreator
Pointer to the IAddressCreator interface of this, for addressCreator().
Definition: PersistencySvc.h:255

SmartIF< IAddressCreator > & PersistencySvc::addressCreator | ( | long | service_type | ) |
| protected

Retrieve address creator from list.

Retrieve address creator service from list.

Definition at line 160 of file PersistencySvc.cpp.

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 }
PersistencySvc::service
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
Definition: PersistencySvc.cpp:226
SmartIF< IAddressCreator >
PersistencySvc::ServiceEntry::addrCreator
SmartIF< IAddressCreator > & addrCreator() const
Definition: PersistencySvc.h:79
IConversionSvc
Definition: IConversionSvc.h:37
std::map::end
T end(T...args)
gaudirun.type
type
Definition: gaudirun.py:125
std::map::find
T find(T...args)
PersistencySvc::m_cnvServices
Services m_cnvServices
List of convermsion workers.
Definition: PersistencySvc.h:244
gaudirun.s
string s
Definition: gaudirun.py:245

StatusCode PersistencySvc::commitOutput | ( | const std::string & | output,
|  | bool | do_commit
| ) |  |
| override

Commit pending output.

Definition at line 321 of file PersistencySvc.cpp.

321 { return StatusCode::SUCCESS; }
StatusCode::SUCCESS
Definition: StatusCode.h:30

StatusCode PersistencySvc::connectOutput | ( | const std::string & | outputFile,
|  | const std::string & | openMode
| ) |  |
| override

Connect the output file to the service with open mode.

Definition at line 312 of file PersistencySvc.cpp.

313 {
314 return connectOutput( outputFile );
315 }
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

StatusCode PersistencySvc::connectOutput | ( | const std::string & | outputFile | ) |
| override

Connect the output file to the service.

Definition at line 318 of file PersistencySvc.cpp.

318 { return StatusCode::SUCCESS; }
StatusCode::SUCCESS
Definition: StatusCode.h:30

SmartIF< IConversionSvc > & PersistencySvc::conversionSvc | ( |  | ) | const
| override

Get conversion service the converter is connected to.

Definition at line 197 of file PersistencySvc.cpp.

197 { return m_cnvDefault; }
PersistencySvc::m_cnvDefault
SmartIF< IConversionSvc > m_cnvDefault
Default output service.
Definition: PersistencySvc.h:246

StatusCode PersistencySvc::convertAddress | ( | const IOpaqueAddress * | pAddress,
|  | std::string & | refAddress
| ) |  |
| override

Convert an address to string form.

Definition at line 333 of file PersistencySvc.cpp.

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 }
PersistencySvc::addressCreator
SmartIF< IAddressCreator > & addressCreator() const override
Retrieve address creator facility.
Definition: PersistencySvc.cpp:438
IOpaqueAddress::clID
virtual const CLID & clID() const =0
Retrieve class information from link.
IAddressCreator
IAddressCreator interface definition.
Definition: IAddressCreator.h:28
std::string
STL class.
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
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IOpaqueAddress::svcType
virtual long svcType() const =0
Retrieve service type.
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
std::string::clear
T clear(T...args)
IAddressCreator::convertAddress
virtual StatusCode convertAddress(const IOpaqueAddress *pAddress, std::string &refAddress)=0
Convert an address to string form.

IConverter * PersistencySvc::converter | ( | const CLID & | clid | ) |
| override

Retrieve converter from list.

Definition at line 223 of file PersistencySvc.cpp.

223 { return nullptr; }

StatusCode PersistencySvc::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 at line 324 of file PersistencySvc.cpp.

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 }
PersistencySvc::addressCreator
SmartIF< IAddressCreator > & addressCreator() const override
Retrieve address creator facility.
Definition: PersistencySvc.cpp:438
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.
IAddressCreator
IAddressCreator interface definition.
Definition: IAddressCreator.h:28

StatusCode PersistencySvc::createAddress | ( | long | svc_type,
|  | const CLID & | clid,
|  | const std::string & | refAddress,
|  | IOpaqueAddress *& | refpAddress
| ) |  |
| override

Convert an address in string form to object form.

Definition at line 360 of file PersistencySvc.cpp.

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 }
PersistencySvc::addressCreator
SmartIF< IAddressCreator > & addressCreator() const override
Retrieve address creator facility.
Definition: PersistencySvc.cpp:438
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.
IAddressCreator
IAddressCreator interface definition.
Definition: IAddressCreator.h:28
std::string
STL class.
CLID
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
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

StatusCode PersistencySvc::createObj | ( | IOpaqueAddress * | pAddress,
|  | DataObject *& | refpObject
| ) |  |
| override

Implementation of IConverter: Create the transient representation of an object.

Create the transient representation of an object.

Definition at line 112 of file PersistencySvc.cpp.

113 {
114 return makeCall( CREATE_OBJ, pAddr, refpObj );
115 }
CREATE_OBJ
Definition: PersistencySvc.cpp:46
PersistencySvc::makeCall
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
Definition: PersistencySvc.cpp:56

StatusCode PersistencySvc::createRep | ( | DataObject * | pObject,
|  | IOpaqueAddress *& | refpAddress
| ) |  |
| override

Implementation of IConverter: Convert the transient object to the requested representation.

Convert the transient object to the requested representation.

Definition at line 136 of file PersistencySvc.cpp.

137 {
138 return makeCall( CREATE_REP, refpAddr, pObj );
139 }
PersistencySvc::makeCall
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
Definition: PersistencySvc.cpp:56
CREATE_REP
Definition: PersistencySvc.cpp:50

SmartIF< IDataProviderSvc > & PersistencySvc::dataProvider | ( |  | ) | const
| override

Access reference to transient datastore.

Access the dataprovider service.

Definition at line 187 of file PersistencySvc.cpp.

187 { return m_dataSvc; }
PersistencySvc::m_dataSvc
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to datma provider service.
Definition: PersistencySvc.h:242

void PersistencySvc::decodeAddrHdr | ( | const std::string & | address,
|  | long & | service_type,
|  | CLID & | clid,
|  | std::string & | address_trailer
| ) |  | const
| protected

Retrieve storage type and clid from address header of string.

Definition at line 386 of file PersistencySvc.cpp.

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 }
std::istringstream
STL class.
std::istringstream::str
T str(T...args)
end
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:50
std::string::clear
T clear(T...args)
std::string::find
T find(T...args)
std::string::size
T size(T...args)
std::string::substr
T substr(T...args)
std::stol
T stol(T...args)

bool PersistencySvc::enable | ( | bool | value | ) |
| protected

Set enabled flag.

Definition at line 549 of file PersistencySvc.cpp.

550 {
551 std::swap( value, m_enable );
552 return value;
553 }
std::swap
T swap(T...args)
PersistencySvc::m_enable
bool m_enable
Flag to indicate that the service is enabled.
Definition: PersistencySvc.h:252

void PersistencySvc::encodeAddrHdr | ( | long | service_type,
|  | const CLID & | clid,
|  | std::string & | address
| ) |  | const
| protected

Retrieve string from storage type and clid.

Definition at line 375 of file PersistencySvc.cpp.

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 }
std::stringstream
STL class.
std::stringstream::str
T str(T...args)

StatusCode PersistencySvc::fillObjRefs | ( | IOpaqueAddress * | pAddress,
|  | DataObject * | pObject
| ) |  |
| override

Implementation of IConverter: Resolve the references of the created transient object.

Resolve the references of the created transient object.

Definition at line 118 of file PersistencySvc.cpp.

119 {
120 return makeCall( FILL_OBJ_REFS, pAddr, pObj );
121 }
PersistencySvc::makeCall
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
Definition: PersistencySvc.cpp:56
FILL_OBJ_REFS
Definition: PersistencySvc.cpp:47

StatusCode PersistencySvc::fillRepRefs | ( | IOpaqueAddress * | pAddress,
|  | DataObject * | pObject
| ) |  |
| override

Implementation of IConverter: Resolve the references of the converted object.

Resolve the references of the converted object.

Definition at line 142 of file PersistencySvc.cpp.

143 {
144 return makeCall( FILL_REP_REFS, pAddr, pObj );
145 }
PersistencySvc::makeCall
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
Definition: PersistencySvc.cpp:56
FILL_REP_REFS
Definition: PersistencySvc.cpp:51

StatusCode PersistencySvc::finalize | ( |  | ) |
| override

stop the service.

Definition at line 537 of file PersistencySvc.cpp.

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 }
PersistencySvc::m_addrCreator
SmartIF< IAddressCreator > m_addrCreator
Pointer to the IAddressCreator interface of this, for addressCreator().
Definition: PersistencySvc.h:255
StatusCode::SUCCESS
Definition: StatusCode.h:30
std::map::clear
T clear(T...args)
PersistencySvc::m_cnvServices
Services m_cnvServices
List of convermsion workers.
Definition: PersistencySvc.h:244

StatusCode PersistencySvc::getService | ( | long | service_type,
|  | IConversionSvc *& | refpSvc
| ) |  |
| override

Retrieve conversion service identified by technology.

Definition at line 441 of file PersistencySvc.cpp.

442 {
443 refpSvc = service( service_type );
444 return refpSvc ? StatusCode::SUCCESS : StatusCode::FAILURE;
445 }
PersistencySvc::service
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
Definition: PersistencySvc.cpp:226
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode::FAILURE
Definition: StatusCode.h:29

StatusCode PersistencySvc::getService | ( | const std::string & | service_type,
|  | IConversionSvc *& | refpSvc
| ) |  |
| override

Retrieve conversion service identified by technology.

Definition at line 448 of file PersistencySvc.cpp.

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 }
PersistencySvc::service
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
Definition: PersistencySvc.cpp:226
StatusCode::SUCCESS
Definition: StatusCode.h:30
SmartIF< IService >
StatusCode::FAILURE
Definition: StatusCode.h:29
IConversionSvc
Definition: IConversionSvc.h:37
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:299
PersistencySvc::m_svcNames
Gaudi::Property< std::vector< std::string > > m_svcNames
Definition: PersistencySvc.h:248
ACCESS_StorageType
const long ACCESS_StorageType
Definition: ClassID.h:60
MYSQL_StorageType
const long MYSQL_StorageType
Definition: ClassID.h:64
POOL_MYSQL_StorageType
const long POOL_MYSQL_StorageType
Definition: ClassID.h:72
POOL_ROOTKEY_StorageType
const long POOL_ROOTKEY_StorageType
Definition: ClassID.h:69
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
std::strlen
T strlen(T...args)
PersistencySvc::getService
StatusCode getService(long service_type, IConversionSvc *&refpSvc) override
Retrieve conversion service identified by technology.
Definition: PersistencySvc.cpp:441
POOL_ORACLE_StorageType
const long POOL_ORACLE_StorageType
Definition: ClassID.h:73
ROOT_StorageType
const long ROOT_StorageType
Definition: ClassID.h:52
ORACLE_StorageType
const long ORACLE_StorageType
Definition: ClassID.h:65
POOL_ROOT_StorageType
const long POOL_ROOT_StorageType
Definition: ClassID.h:68
POOL_StorageType
const long POOL_StorageType
Definition: ClassID.h:67
std::string::length
T length(T...args)
POOL_ROOTTREE_StorageType
const long POOL_ROOTTREE_StorageType
Definition: ClassID.h:70
std::string::c_str
T c_str(T...args)
PersistencySvc::m_cnvServices
Services m_cnvServices
List of convermsion workers.
Definition: PersistencySvc.h:244
SQLSERVER_StorageType
const long SQLSERVER_StorageType
Definition: ClassID.h:63
IConverter::conversionSvc
virtual SmartIF< IConversionSvc > & conversionSvc() const =0
Get conversion service the converter is connected to.
OBJY_StorageType
const long OBJY_StorageType
Definition: ClassID.h:53
SICB_StorageType
const long SICB_StorageType
Definition: ClassID.h:51

StatusCode PersistencySvc::initialize | ( |  | ) |
| override

Initialize the service.

Definition at line 525 of file PersistencySvc.cpp.

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 }
PersistencySvc::m_addrCreator
SmartIF< IAddressCreator > m_addrCreator
Pointer to the IAddressCreator interface of this, for addressCreator().
Definition: PersistencySvc.h:255
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:64
StatusCode::isSuccess
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:74
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:126
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:117
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode PersistencySvc::makeCall | ( | int | typ,
|  | IOpaqueAddress *& | pAddress,
|  | DataObject *& | pObject
| ) |  |
| protected

Implementation helper.

Definition at line 56 of file PersistencySvc.cpp.

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 }
CREATE_OBJ
Definition: PersistencySvc.cpp:46
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
StatusCode::SUCCESS
Definition: StatusCode.h:30
IConverter::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)=0
Create the transient representation of an object.
StatusCode::FAILURE
Definition: StatusCode.h:29
IConversionSvc
Definition: IConversionSvc.h:37
PersistencySvc::m_enable
bool m_enable
Flag to indicate that the service is enabled.
Definition: PersistencySvc.h:252
FILL_OBJ_REFS
Definition: PersistencySvc.cpp:47
IConverter::createRep
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
IConverter::updateRepRefs
virtual StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an already converted object.
IConverter::updateObj
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)=0
Update the transient object from the other representation.
FILL_REP_REFS
Definition: PersistencySvc.cpp:51
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
IConverter::updateObjRefs
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
PersistencySvc::m_cnvDefault
SmartIF< IConversionSvc > m_cnvDefault
Default output service.
Definition: PersistencySvc.h:246
IOpaqueAddress::svcType
virtual long svcType() const =0
Retrieve service type.
IConverter::updateRep
virtual StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the converted representation of a transient object.
IConverter::fillObjRefs
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the created transient object.
CREATE_REP
Definition: PersistencySvc.cpp:50
UPDATE_OBJ
Definition: PersistencySvc.cpp:48
IConverter::fillRepRefs
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
UPDATE_REP_REFS
Definition: PersistencySvc.cpp:53
UPDATE_REP
Definition: PersistencySvc.cpp:52

const CLID & PersistencySvc::objType | ( |  | ) | const
| override

Retrieve the class type of objects the converter produces. (DUMMY)

Retrieve the class type of objects the converter produces.

Definition at line 522 of file PersistencySvc.cpp.

522 { return CLID_NULL; }

StatusCode PersistencySvc::removeCnvService | ( | long | type | ) |
| override

Remove a Service.

Remove conversion service.

Definition at line 291 of file PersistencySvc.cpp.

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 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
PersistencySvc::ServiceEntry::service
SmartIF< IService > & service() const
Definition: PersistencySvc.h:77
std::map::end
T end(T...args)
std::map::erase
T erase(T...args)
std::map::find
T find(T...args)
PersistencySvc::m_cnvServices
Services m_cnvServices
List of convermsion workers.
Definition: PersistencySvc.h:244

StatusCode PersistencySvc::removeConverter | ( | const CLID & | clid | ) |
| override

Remove converter object from conversion service (if present).

Definition at line 211 of file PersistencySvc.cpp.

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 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
PersistencySvc::m_cnvServices
Services m_cnvServices
List of convermsion workers.
Definition: PersistencySvc.h:244

long PersistencySvc::repSvcType | ( |  | ) | const
| override

Return default service type.

Retrieve the class type of the data store the converter uses.

Definition at line 302 of file PersistencySvc.cpp.

302 { return m_cnvDefault ? m_cnvDefault->repSvcType() : 0; }
PersistencySvc::m_cnvDefault
SmartIF< IConversionSvc > m_cnvDefault
Default output service.
Definition: PersistencySvc.h:246
IConverter::repSvcType
virtual long repSvcType() const =0
Retrieve the class type of the data store the converter uses.

SmartIF< IConversionSvc > & PersistencySvc::service | ( | const std::string & | nam | ) |
| protected

Retrieve conversion service by name.

Definition at line 226 of file PersistencySvc.cpp.

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 }
PersistencySvc::service
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
Definition: PersistencySvc.cpp:226
SmartIF< IConversionSvc >
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:123
PersistencySvc::ServiceEntry::service
SmartIF< IService > & service() const
Definition: PersistencySvc.h:77
std::map::end
T end(T...args)
Gaudi::Utils::TypeNameString
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:12
PersistencySvc::addCnvService
StatusCode addCnvService(IConversionSvc *service) override
Add a new Service.
Definition: PersistencySvc.cpp:259
std::find_if
T find_if(T...args)
std::map::begin
T begin(T...args)
PersistencySvc::m_cnvServices
Services m_cnvServices
List of convermsion workers.
Definition: PersistencySvc.h:244
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

SmartIF< IConversionSvc > & PersistencySvc::service | ( | long | service_type | ) |
| protected

Retrieve conversion service from list.

Definition at line 244 of file PersistencySvc.cpp.

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 }
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
SmartIF< IConversionSvc >
PersistencySvc::m_svcNames
Gaudi::Property< std::vector< std::string > > m_svcNames
Definition: PersistencySvc.h:248
std::map::end
T end(T...args)
gaudirun.type
type
Definition: gaudirun.py:125
std::map::find
T find(T...args)
PersistencySvc::m_cnvServices
Services m_cnvServices
List of convermsion workers.
Definition: PersistencySvc.h:244

StatusCode PersistencySvc::setAddressCreator | ( | IAddressCreator * | creator | ) |
| override

Set address creator facility.

Definition at line 428 of file PersistencySvc.cpp.

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 }
StatusCode::FAILURE
Definition: StatusCode.h:29

StatusCode PersistencySvc::setConversionSvc | ( | IConversionSvc * | svc | ) |
| override

Set conversion service the converter is connected to.

Definition at line 190 of file PersistencySvc.cpp.

191 {
192 m_cnvDefault = svc;
193 return StatusCode( StatusCode::SUCCESS, true );
194 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
PersistencySvc::m_cnvDefault
SmartIF< IConversionSvc > m_cnvDefault
Default output service.
Definition: PersistencySvc.h:246

StatusCode PersistencySvc::setDataProvider | ( | IDataProviderSvc * | pStore | ) |
| override

Define transient datastore.

Define transient data store.

Definition at line 177 of file PersistencySvc.cpp.

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 }
StatusCode::SUCCESS
Definition: StatusCode.h:30
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
PersistencySvc::m_cnvServices
Services m_cnvServices
List of convermsion workers.
Definition: PersistencySvc.h:244
PersistencySvc::m_dataSvc
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to datma provider service.
Definition: PersistencySvc.h:242

StatusCode PersistencySvc::setDefaultCnvService | ( | long | type | ) |
| override

Set default service type.

Set default conversion service.

Definition at line 305 of file PersistencySvc.cpp.

306 {
307 m_cnvDefault = service( type );
308 return StatusCode::SUCCESS;
309 }
PersistencySvc::service
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
Definition: PersistencySvc.cpp:226
StatusCode::SUCCESS
Definition: StatusCode.h:30
gaudirun.type
type
Definition: gaudirun.py:125
PersistencySvc::m_cnvDefault
SmartIF< IConversionSvc > m_cnvDefault
Default output service.
Definition: PersistencySvc.h:246

void PersistencySvc::svcNamesHandler | ( | Gaudi::Details::PropertyBase & | theProp | ) |
| protected

Handlers for Service Names Property.

Definition at line 546 of file PersistencySvc.cpp.

546 { DEBMSG << p << endmsg; }
DEBMSG
#define DEBMSG
Definition: PersistencySvc.cpp:38
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244

StatusCode PersistencySvc::updateObj | ( | IOpaqueAddress * | pAddress,
|  | DataObject * | refpObject
| ) |  |
| override

Implementation of IConverter: Update the transient object from the other representation.

Update the transient object from the other representation.

Definition at line 124 of file PersistencySvc.cpp.

125 {
126 return makeCall( UPDATE_OBJ, pAddr, pObj );
127 }
PersistencySvc::makeCall
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
Definition: PersistencySvc.cpp:56
UPDATE_OBJ
Definition: PersistencySvc.cpp:48

StatusCode PersistencySvc::updateObjRefs | ( | IOpaqueAddress * | pAddress,
|  | DataObject * | pObject
| ) |  |
| override

Implementation of IConverter: Update the references of an updated transient object.

Update the references of an updated transient object.

Definition at line 130 of file PersistencySvc.cpp.

131 {
132 return makeCall( UPDATE_OBJ_REFS, pAddr, pObj );
133 }
UPDATE_OBJ_REFS
Definition: PersistencySvc.cpp:49
PersistencySvc::makeCall
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
Definition: PersistencySvc.cpp:56

StatusCode PersistencySvc::updateRep | ( | IOpaqueAddress * | pAddress,
|  | DataObject * | pObject
| ) |  |
| override

Implementation of IConverter: Update the converted representation of a transient object.

Update the converted representation of a transient object.

Definition at line 148 of file PersistencySvc.cpp.

149 {
150 return makeCall( UPDATE_REP, pAddr, pObj );
151 }
PersistencySvc::makeCall
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
Definition: PersistencySvc.cpp:56
UPDATE_REP
Definition: PersistencySvc.cpp:52

StatusCode PersistencySvc::updateRepRefs | ( | IOpaqueAddress * | pAddress,
|  | DataObject * | pObject
| ) |  |
| override

Implementation of IConverter: Update the references of an already converted object.

Update the references of an already converted object.

Definition at line 154 of file PersistencySvc.cpp.

155 {
156 return makeCall( UPDATE_REP_REFS, pAddr, pObj );
157 }
PersistencySvc::makeCall
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
Definition: PersistencySvc.cpp:56
UPDATE_REP_REFS
Definition: PersistencySvc.cpp:53

## Member Data Documentation

SmartIF<IAddressCreator> PersistencySvc::m_addrCreator
| mutable protected

Pointer to the IAddressCreator interface of this, for addressCreator().

Definition at line 255 of file PersistencySvc.h.

SmartIF<IConversionSvc> PersistencySvc::m_cnvDefault
| mutable protected

Default output service.

Definition at line 246 of file PersistencySvc.h.

long PersistencySvc::m_cnvDefType = TEST_StorageType
| protected

Default service type.

Definition at line 240 of file PersistencySvc.h.

Services PersistencySvc::m_cnvServices
| protected

List of convermsion workers.

Definition at line 244 of file PersistencySvc.h.

SmartIF<IDataProviderSvc> PersistencySvc::m_dataSvc
| mutable protected

Pointer to datma provider service.

Definition at line 242 of file PersistencySvc.h.

bool PersistencySvc::m_enable = true
| protected

Flag to indicate that the service is enabled.

Definition at line 252 of file PersistencySvc.h.

Gaudi::Property<std::vector<std::string> > PersistencySvc::m_svcNames
| protected

Initial value:
{
this, "CnvServices", {}, "Names of services to be requested from the service locator and added by default"}

Definition at line 248 of file PersistencySvc.h.

The documentation for this class was generated from the following files:

- GaudiCommonSvc/src/PersistencySvc/PersistencySvc.h
- GaudiCommonSvc/src/PersistencySvc/PersistencySvc.cpp