| The Gaudi Framework v32r1 (f65d50dc)

Classes | Protected Types | 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...
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 | declareTool (ToolHandle< T > &handle, std::string toolTypeAndName, bool createIf=true)
| Declare used 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
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, 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
Public Member Functions inherited from CommonMessaging< implements< IService, IProperty, IStateful > >
MSG::Level | msgLevel () const
| get the cached level (originally extracted from the embedded MsgStream) More...
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream More...
MSG::Level | outputLevel () const
| Backward compatibility function for getting the output level. More...
Public Member Functions inherited from CommonMessagingBase
virtual | ~CommonMessagingBase ()=default
| Virtual destructor. More...
const 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...

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

## Protected Member Functions
: Object implementation
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...
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 > >
MSG::Level | setUpMessaging () const
| Set up local caches. More...
MSG::Level | resetMessaging ()
| Reinitialize internal states. More...
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, " 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...

## 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
using | Factory = Gaudi::PluginService::Factory< IService *(const std::string &, ISvcLocator *)>
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

## ◆ Services

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

Definition at line 77 of file PersistencySvc.h.

## Member Function Documentation

## ◆ addCnvService()

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

Add a new Service.

Add data service.

Definition at line 235 of file PersistencySvc.cpp.

235 {
236 if ( !servc ) return Status::BAD_STORAGE_TYPE;
237 long type = servc->repSvcType();
238 long def_typ = ( m_cnvDefault ? m_cnvDefault->repSvcType() : 0 );
239 auto it = m_cnvServices.find( type );
240 auto cnv_svc = ( it != m_cnvServices.end() ? it->second.conversionSvc() : nullptr );
241 if ( type == def_typ ) m_cnvDefault = servc;
242 if ( cnv_svc == servc ) return StatusCode::SUCCESS;
243
244 auto iservc = make_SmartIF( servc );
245 auto icr = iservc.as<IAddressCreator>();
246 if ( icr ) {
247 auto isvc = iservc.as<IService>();
248 if ( isvc ) {
249 if ( cnv_svc ) removeCnvService( type ).ignore();
250 auto p = m_cnvServices.emplace( type, ServiceEntry( type, isvc, iservc, icr ) );
251 if ( !p.second ) {
252 info() << "Cannot add Conversion service of type " << isvc->name() << endmsg;
253 return StatusCode::FAILURE;
254 }
255 info() << "Added successfully Conversion service:" << isvc->name() << endmsg;
256 iservc->setAddressCreator( this ).ignore();
257 iservc->setDataProvider( m_dataSvc ).ignore();
258 return StatusCode::SUCCESS;
259 }
260 }
261 info() << "Cannot add Conversion service of type " << type << endmsg;
262 return StatusCode::FAILURE;
263 }
IAddressCreator
IAddressCreator interface definition.
Definition: IAddressCreator.h:28
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
std::map::end
T end(T... args)
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:104
IConverter::repSvcType
virtual long repSvcType() const =0
Retrieve the class type of the data store the converter uses.
IService
General service interface definition.
Definition: IService.h:18
gaudirun.type
type
Definition: gaudirun.py:142
PersistencySvc::m_cnvDefault
SmartIF< IConversionSvc > m_cnvDefault
Default output service.
Definition: PersistencySvc.h:235
PersistencySvc::removeCnvService
StatusCode removeCnvService(long type) override
Remove a Service.
Definition: PersistencySvc.cpp:266
std::map::find
T find(T... args)
StatusCode::ignore
const StatusCode & ignore() const
Ignore/check StatusCode.
Definition: StatusCode.h:153
PersistencySvc::ServiceEntry::conversionSvc
SmartIF< IConversionSvc > & conversionSvc() const
Definition: PersistencySvc.h:73
PersistencySvc::m_cnvServices
Services m_cnvServices
List of convermsion workers.
Definition: PersistencySvc.h:233
std::map::emplace
T emplace(T... args)
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
make_SmartIF
SmartIF< IFace > make_SmartIF(IFace *iface)
Definition: SmartIF.h:140
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
PersistencySvc::m_dataSvc
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to datma provider service.
Definition: PersistencySvc.h:231

## ◆ addConverter() [1/2]

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

Add converter object to conversion service.

Definition at line 183 of file PersistencySvc.cpp.

183 {
184 if ( !pConverter ) return Status::NO_CONVERTER;
185 IConversionSvc* svc = service( pConverter->repSvcType() );
186 return svc ? svc->addConverter( pConverter ) : Status::BAD_STORAGE_TYPE;
187 }
PersistencySvc::service
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
Definition: PersistencySvc.cpp:204
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.

## ◆ addConverter() [2/2]

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

Add converter object to conversion service.

Definition at line 180 of file PersistencySvc.cpp.

180 { return StatusCode::FAILURE; }
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86

## ◆ addressCreator() [1/2]

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

Retrieve address creator facility.

Definition at line 404 of file PersistencySvc.cpp.

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

## ◆ addressCreator() [2/2]

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

Retrieve address creator from list.

Retrieve address creator service from list.

Definition at line 145 of file PersistencySvc.cpp.

145 {
146 long typ = type;
147 auto it = m_cnvServices.find( typ );
148 if ( it == m_cnvServices.end() ) {
149 IConversionSvc* s = service( type );
150 if ( s ) {
151 it = m_cnvServices.find( typ );
152 if ( it != m_cnvServices.end() ) return it->second.addrCreator();
153 }
154 static SmartIF<IAddressCreator> no_creator;
155 return no_creator;
156 }
157 return it->second.addrCreator();
158 }
PersistencySvc::service
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
Definition: PersistencySvc.cpp:204
SmartIF< IAddressCreator >
IConversionSvc
Definition: IConversionSvc.h:37
PersistencySvc::ServiceEntry::addrCreator
SmartIF< IAddressCreator > & addrCreator() const
Definition: PersistencySvc.h:74
std::map::end
T end(T... args)
gaudirun.type
type
Definition: gaudirun.py:142
std::map::find
T find(T... args)
PersistencySvc::m_cnvServices
Services m_cnvServices
List of convermsion workers.
Definition: PersistencySvc.h:233
gaudirun.s
string s
Definition: gaudirun.py:316

## ◆ commitOutput()

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

Commit pending output.

Definition at line 293 of file PersistencySvc.cpp.

293 { return StatusCode::SUCCESS; }
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85

## ◆ connectOutput() [1/2]

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 285 of file PersistencySvc.cpp.

285 {
286 return connectOutput( outputFile );
287 }
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:285

## ◆ connectOutput() [2/2]

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

Connect the output file to the service.

Definition at line 290 of file PersistencySvc.cpp.

290 { return StatusCode::SUCCESS; }
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85

## ◆ conversionSvc()

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

Get conversion service the converter is connected to.

Definition at line 177 of file PersistencySvc.cpp.

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

## ◆ convertAddress()

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

Convert an address to string form.

Definition at line 304 of file PersistencySvc.cpp.

304 {
305 // Assumuption is that the Persistency service prepends a header
306 // and requests the conversion service refered to by the service
307 // type to encode the rest
308 long svc_type = 0;
309 CLID clid = 0;
310 if ( pAddress ) {
311 svc_type = pAddress->svcType();
312 clid = pAddress->clID();
313 }
314 IAddressCreator* svc = addressCreator( svc_type );
315 StatusCode status = Status::BAD_STORAGE_TYPE; // Preset error
316 refAddress.clear();
317
318 if ( svc ) {
319 // Found service, set header
320 encodeAddrHdr( svc_type, clid, refAddress );
321 std::string address;
322 // Get rest of address from conversion service
323 status = svc->convertAddress( pAddress, address );
324 refAddress += address;
325 }
326 return status;
327 }
PersistencySvc::addressCreator
SmartIF< IAddressCreator > & addressCreator() const override
Retrieve address creator facility.
Definition: PersistencySvc.cpp:404
IAddressCreator
IAddressCreator interface definition.
Definition: IAddressCreator.h:28
IOpaqueAddress::svcType
virtual long svcType() const =0
Retrieve service type.
std::string
STL class.
IOpaqueAddress::clID
virtual const CLID & clID() const =0
Retrieve class information from link.
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
PersistencySvc::encodeAddrHdr
void encodeAddrHdr(long service_type, const CLID &clid, std::string &address) const
Retrieve string from storage type and clid.
Definition: PersistencySvc.cpp:344
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.

## ◆ converter()

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

Retrieve converter from list.

Definition at line 201 of file PersistencySvc.cpp.

201 { return nullptr; }

## ◆ createAddress() [1/2]

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 296 of file PersistencySvc.cpp.

297 {
298 refpAddress = nullptr;
299 IAddressCreator* svc = addressCreator( svc_type );
300 return svc ? svc->createAddress( svc_type, clid, pars, ipars, refpAddress ) : Status::BAD_STORAGE_TYPE;
301 }
PersistencySvc::addressCreator
SmartIF< IAddressCreator > & addressCreator() const override
Retrieve address creator facility.
Definition: PersistencySvc.cpp:404
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

## ◆ createAddress() [2/2]

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 330 of file PersistencySvc.cpp.

331 {
332 // Assumption is that the Persistency service decodes that header
333 // and requests the conversion service referred to by the service
334 // type to decode the rest
335 long new_svc_type = 0;
336 CLID new_clid = 0;
337 std::string address_trailer;
338 decodeAddrHdr( refAddress, new_svc_type, new_clid, address_trailer );
339 IAddressCreator* svc = addressCreator( new_svc_type );
340 return svc ? svc->createAddress( new_svc_type, new_clid, address_trailer, refpAddress ) : Status::BAD_STORAGE_TYPE;
341 }
PersistencySvc::addressCreator
SmartIF< IAddressCreator > & addressCreator() const override
Retrieve address creator facility.
Definition: PersistencySvc.cpp:404
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:354

## ◆ createObj()

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 105 of file PersistencySvc.cpp.

105 {
106 return makeCall( CREATE_OBJ, pAddr, refpObj );
107 }
CREATE_OBJ
Definition: PersistencySvc.cpp:40
PersistencySvc::makeCall
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
Definition: PersistencySvc.cpp:50

## ◆ createRep()

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 125 of file PersistencySvc.cpp.

125 {
126 return makeCall( CREATE_REP, refpAddr, pObj );
127 }
PersistencySvc::makeCall
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
Definition: PersistencySvc.cpp:50
CREATE_REP
Definition: PersistencySvc.cpp:44

## ◆ dataProvider()

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

Access reference to transient datastore.

Access the dataprovider service.

Definition at line 168 of file PersistencySvc.cpp.

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

## ◆ decodeAddrHdr()

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 354 of file PersistencySvc.cpp.

355 {
356 // For address header, use xml-style format of
357 // <address_header service_type="xxx" clid="yyy" />
358 service_type = 0;
359 clid = 0;
360 address_trailer.clear();
361
362 // Check for address_header tag
363 size_t pos = address.find( "<address_header" );
364 if ( std::string::npos != pos ) {
365 // Get service_type
366 pos = address.find( "service_type=\"" );
367 if ( std::string::npos != pos ) {
368 pos += 14;
369 size_t end = address.find( '"', pos );
370 if ( std::string::npos != end ) {
371 service_type = std::stol( address.substr( pos, end - pos ) );
372 // Get clid
373 pos = address.find( "clid=\"" );
374 if ( std::string::npos != pos ) {
375 pos += 6;
376 end = address.find( '\"', pos );
377 if ( std::string::npos != end ) {
378 std::istringstream str;
379 str.str( address.substr( pos, end - pos ) );
380 str >> clid;
381 // Get trailer_address
382 pos = address.find( '>' );
383 if ( pos < ( address.size() - 2 ) ) { // this means that '>' was found (pos != npos)
384 // it is before the last char
385 address_trailer = address.substr( pos + 1 );
386 }
387 }
388 }
389 }
390 }
391 }
392 }
std::istringstream
STL class.
std::istringstream::str
T str(T... args)
IOTest.end
def end
Definition: IOTest.py:112
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)

## ◆ enable()

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

Set enabled flag.

Definition at line 507 of file PersistencySvc.cpp.

507 {
508 std::swap( value, m_enable );
509 return value;
510 }
std::swap
T swap(T... args)
PersistencySvc::m_enable
bool m_enable
Flag to indicate that the service is enabled.
Definition: PersistencySvc.h:247

## ◆ encodeAddrHdr()

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

Retrieve string from storage type and clid.

Definition at line 344 of file PersistencySvc.cpp.

344 {
345 // For address header, use xml-style format of
346 // <addrhdr service_type="xxx" clid="yyy" />
347 std::stringstream stream;
348 int svctyp = service_type; // must put int into stream, not char
349 stream << "<address_header service_type=\"" << svctyp << "\" clid=\"" << clid << "\" /> ";
350 address = stream.str();
351 }
std::stringstream
STL class.
std::stringstream::str
T str(T... args)

## ◆ fillObjRefs()

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 110 of file PersistencySvc.cpp.

110 {
111 return makeCall( FILL_OBJ_REFS, pAddr, pObj );
112 }
PersistencySvc::makeCall
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
Definition: PersistencySvc.cpp:50
FILL_OBJ_REFS
Definition: PersistencySvc.cpp:41

## ◆ fillRepRefs()

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 130 of file PersistencySvc.cpp.

130 {
131 return makeCall( FILL_REP_REFS, pAddr, pObj );
132 }
PersistencySvc::makeCall
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
Definition: PersistencySvc.cpp:50
FILL_REP_REFS
Definition: PersistencySvc.cpp:45

## ◆ finalize()

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

stop the service.

Definition at line 498 of file PersistencySvc.cpp.

498 {
499 // Release all workers
500 m_cnvServices.clear();
501 // Release references to this to avoid loops
502 m_addrCreator = nullptr;
503 return StatusCode::SUCCESS;
504 }
PersistencySvc::m_addrCreator
SmartIF< IAddressCreator > m_addrCreator
Pointer to the IAddressCreator interface of this, for addressCreator().
Definition: PersistencySvc.h:250
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
std::map::clear
T clear(T... args)
PersistencySvc::m_cnvServices
Services m_cnvServices
List of convermsion workers.
Definition: PersistencySvc.h:233

## ◆ getService() [1/2]

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

Retrieve conversion service identified by technology.

Definition at line 407 of file PersistencySvc.cpp.

407 {
408 refpSvc = service( service_type );
409 return refpSvc ? StatusCode::SUCCESS : StatusCode::FAILURE;
410 }
PersistencySvc::service
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
Definition: PersistencySvc.cpp:204
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86

## ◆ getService() [2/2]

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

Retrieve conversion service identified by technology.

Definition at line 413 of file PersistencySvc.cpp.

413 {
414 const char* imp = service_type.c_str();
415 long len = service_type.length();
416 if ( ::strncasecmp( imp, "SICB", len ) == 0 )
417 return getService( SICB_StorageType, refpSvc );
418 else if ( ::strncasecmp( imp, "ZEBRA", len ) == 0 )
419 return getService( SICB_StorageType, refpSvc );
420 else if ( ::strncasecmp( imp, "MS Access", len ) == 0 )
421 return getService( ACCESS_StorageType, refpSvc );
422 else if ( ::strncasecmp( imp, "Microsoft Access", strlen( "Microsoft Access" ) ) == 0 )
423 return getService( ACCESS_StorageType, refpSvc );
424 else if ( ::strncasecmp( imp, "SQL Server", len ) == 0 )
425 return getService( SQLSERVER_StorageType, refpSvc );
426 else if ( ::strncasecmp( imp, "Microsoft ODBC for Oracle", len ) == 0 )
427 return getService( ORACLE_StorageType, refpSvc );
428 else if ( ::strncasecmp( imp, "Oracle ODBC", strlen( "Oracle ODBC" ) ) == 0 )
429 return getService( ORACLE_StorageType, refpSvc );
430 else if ( ::strncasecmp( imp, "Oracle OCI", strlen( "Oracle OCI" ) ) == 0 )
431 return getService( ORACLE_StorageType, refpSvc );
432 else if ( ::strncasecmp( imp, "MySQL", len ) == 0 )
433 return getService( MYSQL_StorageType, refpSvc );
434 else if ( ::strncasecmp( imp, "ROOT", len ) == 0 )
435 return getService( ROOT_StorageType, refpSvc );
436 else if ( ::strncasecmp( imp, "OBJY", len ) == 0 )
437 return getService( OBJY_StorageType, refpSvc );
438 else if ( ::strncasecmp( imp, "OBJYECTI", 7 ) == 0 )
439 return getService( OBJY_StorageType, refpSvc );
440 else if ( ::strncasecmp( imp, "POOL_ROOTKEY", 12 ) == 0 )
441 return getService( POOL_ROOTKEY_StorageType, refpSvc );
442 else if ( ::strncasecmp( imp, "POOL_ROOTTREE", 12 ) == 0 )
443 return getService( POOL_ROOTTREE_StorageType, refpSvc );
444 else if ( ::strncasecmp( imp, "POOL_ROOT", 9 ) == 0 )
445 return getService( POOL_ROOT_StorageType, refpSvc );
446 else if ( ::strncasecmp( imp, "POOL_MySQL", 8 ) == 0 )
447 return getService( POOL_MYSQL_StorageType, refpSvc );
448 else if ( ::strncasecmp( imp, "POOL_ORACLE", 8 ) == 0 )
449 return getService( POOL_ORACLE_StorageType, refpSvc );
450 else if ( ::strncasecmp( imp, "POOL_ACCESS", 8 ) == 0 )
451 return getService( POOL_ACCESS_StorageType, refpSvc );
452 else if ( ::strncasecmp( imp, "POOL", 4 ) == 0 )
453 return getService( POOL_StorageType, refpSvc );
454
455 for ( const auto& i : m_cnvServices ) {
456 SmartIF<IService> svc( i.second.conversionSvc() );
457 if ( svc ) {
458 // Check wether this is already an active service: first check by service name
459 if ( svc->name() == service_type ) {
460 refpSvc = i.second.conversionSvc();
461 return StatusCode::SUCCESS;
462 }
463 // Check wether this is already an active service: now check by service type
464 auto instance = svc.get();
465 if ( System::typeinfoName( typeid( *instance ) ) == service_type ) {
466 refpSvc = i.second.conversionSvc();
467 return StatusCode::SUCCESS;
468 }
469 }
470 }
471 // if not, check if the service is in the list and may be requested
472 for ( const auto& i : m_svcNames.value() ) {
473 Gaudi::Utils::TypeNameString itm( i );
474 if ( itm.name() == service_type || itm.type() == service_type ) {
475 IConversionSvc* svc = service( i );
476 if ( svc ) {
477 refpSvc = svc;
478 return StatusCode::SUCCESS;
479 }
480 }
481 }
482 return StatusCode::FAILURE;
483 }
PersistencySvc::service
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
Definition: PersistencySvc.cpp:204
SmartIF< IService >
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:298
PersistencySvc::m_svcNames
Gaudi::Property< std::vector< std::string > > m_svcNames
Definition: PersistencySvc.h:237
ACCESS_StorageType
const long ACCESS_StorageType
Definition: ClassID.h:60
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
IConverter::conversionSvc
virtual SmartIF< IConversionSvc > & conversionSvc() const =0
Get conversion service the converter is connected to.
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:10
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:407
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:233
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
SQLSERVER_StorageType
const long SQLSERVER_StorageType
Definition: ClassID.h:63
OBJY_StorageType
const long OBJY_StorageType
Definition: ClassID.h:53
SICB_StorageType
const long SICB_StorageType
Definition: ClassID.h:51

## ◆ initialize()

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

Initialize the service.

Definition at line 489 of file PersistencySvc.cpp.

489 {
490 m_addrCreator = this; // initialize internal pointer to IAddressCreator interface
491 // Initialize basic service
492 StatusCode status = Service::initialize();
493 if ( UNLIKELY( !status.isSuccess() ) ) { error() << "Error initializing Service base class." << endmsg; }
494 return status;
495 }
PersistencySvc::m_addrCreator
SmartIF< IAddressCreator > m_addrCreator
Pointer to the IAddressCreator interface of this, for addressCreator().
Definition: PersistencySvc.h:250
UNLIKELY
#define UNLIKELY(x)
Definition: Kernel.h:96
Service::initialize
StatusCode initialize() override
Definition: Service.cpp:60
CommonMessagingBase::error
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
Definition: CommonMessaging.h:98
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
StatusCode::isSuccess
bool isSuccess() const
Definition: StatusCode.h:267
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192

## ◆ makeCall()

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

Implementation helper.

Definition at line 50 of file PersistencySvc.cpp.

50 {
51 if ( m_enable ) {
52 IConversionSvc* svc = nullptr;
53 switch ( typ ) {
54 case CREATE_REP:
55 case FILL_REP_REFS:
56 case UPDATE_REP:
57 case UPDATE_REP_REFS:
58 svc = m_cnvDefault;
59 break;
60 default:
61 if ( !pAddress ) return Status::INVALID_ADDRESS;
62 svc = service( pAddress->svcType() );
63 if ( !svc ) return Status::BAD_STORAGE_TYPE;
64 break;
65 }
66
67 StatusCode status( StatusCode::FAILURE, true );
68 switch ( typ ) {
69 case CREATE_OBJ:
70 pObject = nullptr;
71 status = svc->createObj( pAddress, pObject );
72 break;
73 case FILL_OBJ_REFS:
74 status = svc->fillObjRefs( pAddress, pObject );
75 break;
76 case UPDATE_OBJ:
77 status = svc->updateObj( pAddress, pObject );
78 break;
79 case UPDATE_OBJ_REFS:
80 status = svc->updateObjRefs( pAddress, pObject );
81 break;
82 case CREATE_REP:
83 status = svc->createRep( pObject, pAddress );
84 break;
85 case FILL_REP_REFS:
86 status = svc->fillRepRefs( pAddress, pObject );
87 break;
88 case UPDATE_REP:
89 status = svc->updateRep( pAddress, pObject );
90 break;
91 case UPDATE_REP_REFS:
92 status = svc->updateRepRefs( pAddress, pObject );
93 break;
94 default:
95 status = StatusCode::FAILURE;
96 break;
97 }
98 status.ignore();
99 return status;
100 }
101 return StatusCode::SUCCESS;
102 }
CREATE_OBJ
Definition: PersistencySvc.cpp:40
UPDATE_OBJ_REFS
Definition: PersistencySvc.cpp:43
PersistencySvc::service
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
Definition: PersistencySvc.cpp:204
IConverter::createObj
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)=0
Create the transient representation of an object.
IConversionSvc
Definition: IConversionSvc.h:37
PersistencySvc::m_enable
bool m_enable
Flag to indicate that the service is enabled.
Definition: PersistencySvc.h:247
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
FILL_OBJ_REFS
Definition: PersistencySvc.cpp:41
IConverter::createRep
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
IOpaqueAddress::svcType
virtual long svcType() const =0
Retrieve service type.
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:45
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
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:235
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.
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86
CREATE_REP
Definition: PersistencySvc.cpp:44
UPDATE_OBJ
Definition: PersistencySvc.cpp:42
IConverter::fillRepRefs
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
UPDATE_REP_REFS
Definition: PersistencySvc.cpp:47
UPDATE_REP
Definition: PersistencySvc.cpp:46

## ◆ objType()

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 486 of file PersistencySvc.cpp.

486 { return CLID_NULL; }

## ◆ removeCnvService()

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

Remove a Service.

Remove conversion service.

Definition at line 266 of file PersistencySvc.cpp.

266 {
267 auto it = m_cnvServices.find( svctype );
268 if ( it == m_cnvServices.end() ) return Status::BAD_STORAGE_TYPE;
269 it->second.service()->release();
270 it->second.addrCreator()->release();
271 m_cnvServices.erase( it );
272 return StatusCode::SUCCESS;
273 }
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
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:233
PersistencySvc::ServiceEntry::service
SmartIF< IService > & service() const
Definition: PersistencySvc.h:72

## ◆ removeConverter()

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

Remove converter object from conversion service (if present).

Definition at line 190 of file PersistencySvc.cpp.

190 {
191 // Remove converter type from all services
192 StatusCode status = Status::NO_CONVERTER, iret = StatusCode::SUCCESS;
193 for ( auto& i : m_cnvServices ) {
194 iret = i.second.conversionSvc()->removeConverter( clid );
195 if ( iret.isSuccess() ) status = iret;
196 }
197 return status;
198 }
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
PersistencySvc::m_cnvServices
Services m_cnvServices
List of convermsion workers.
Definition: PersistencySvc.h:233

## ◆ repSvcType()

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

Return default service type.

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

Definition at line 276 of file PersistencySvc.cpp.

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

## ◆ service() [1/2]

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

Retrieve conversion service by name.

Definition at line 204 of file PersistencySvc.cpp.

204 {
205 Gaudi::Utils::TypeNameString tn( nam );
206 auto it = std::find_if( m_cnvServices.begin(), m_cnvServices.end(),
207 [&]( Services::const_reference i ) { return i.second.service()->name() == tn.name(); } );
208 if ( it != m_cnvServices.end() ) return it->second.conversionSvc();
209
210 auto svc = Service::service<IConversionSvc>( nam, true );
211 if ( svc && addCnvService( svc.get() ).isSuccess() ) {
212 return service( nam ); // now it is in the list
213 }
214
215 info() << "Cannot access Conversion service:" << nam << endmsg;
216 static SmartIF<IConversionSvc> no_svc;
217 return no_svc;
218 }
PersistencySvc::service
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
Definition: PersistencySvc.cpp:204
SmartIF< IConversionSvc >
std::map::end
T end(T... args)
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition: CommonMessaging.h:104
Gaudi::Utils::TypeNameString
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:10
PersistencySvc::addCnvService
StatusCode addCnvService(IConversionSvc *service) override
Add a new Service.
Definition: PersistencySvc.cpp:235
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:233
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:192
PersistencySvc::ServiceEntry::service
SmartIF< IService > & service() const
Definition: PersistencySvc.h:72

## ◆ service() [2/2]

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

Retrieve conversion service from list.

Definition at line 221 of file PersistencySvc.cpp.

221 {
222 // Check wether this is already an active service
223 auto it = m_cnvServices.find( type );
224 if ( it != m_cnvServices.end() ) return it->second.conversionSvc();
225 // if not, check if the service is in the list and may be requested
226 for ( const auto& i : m_svcNames.value() ) {
227 auto& svc = service( i );
228 if ( svc && svc->repSvcType() == type ) return svc;
229 }
230 static SmartIF<IConversionSvc> no_svc;
231 return no_svc;
232 }
PersistencySvc::service
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
Definition: PersistencySvc.cpp:204
SmartIF< IConversionSvc >
PersistencySvc::m_svcNames
Gaudi::Property< std::vector< std::string > > m_svcNames
Definition: PersistencySvc.h:237
std::map::end
T end(T... args)
gaudirun.type
type
Definition: gaudirun.py:142
std::map::find
T find(T... args)
PersistencySvc::ServiceEntry::conversionSvc
SmartIF< IConversionSvc > & conversionSvc() const
Definition: PersistencySvc.h:73
PersistencySvc::m_cnvServices
Services m_cnvServices
List of convermsion workers.
Definition: PersistencySvc.h:233

## ◆ setAddressCreator()

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

Set address creator facility.

Definition at line 395 of file PersistencySvc.cpp.

395 {
396 // The persistency service is a address creation dispatcher istelf.
397 // The persistency service can NEVER create addresses itself.
398 // The entry point must only be provided in order to fulfill the needs of the
399 // implementing interfaces.
400 return StatusCode::FAILURE;
401 }
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition: StatusCode.h:86

## ◆ setConversionSvc()

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

Set conversion service the converter is connected to.

Definition at line 171 of file PersistencySvc.cpp.

171 {
172 m_cnvDefault = svc;
173 return StatusCode( StatusCode::SUCCESS, true );
174 }
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
PersistencySvc::m_cnvDefault
SmartIF< IConversionSvc > m_cnvDefault
Default output service.
Definition: PersistencySvc.h:235

## ◆ setDataProvider()

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

Define transient datastore.

Define transient data store.

Definition at line 161 of file PersistencySvc.cpp.

161 {
162 m_dataSvc = pDataSvc;
163 for ( auto& i : m_cnvServices ) { i.second.conversionSvc()->setDataProvider( m_dataSvc ).ignore(); }
164 return StatusCode( StatusCode::SUCCESS, true );
165 }
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
PersistencySvc::m_cnvServices
Services m_cnvServices
List of convermsion workers.
Definition: PersistencySvc.h:233
PersistencySvc::m_dataSvc
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to datma provider service.
Definition: PersistencySvc.h:231

## ◆ setDefaultCnvService()

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

Set default service type.

Set default conversion service.

Definition at line 279 of file PersistencySvc.cpp.

279 {
280 m_cnvDefault = service( type );
281 return StatusCode::SUCCESS;
282 }
PersistencySvc::service
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
Definition: PersistencySvc.cpp:204
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
gaudirun.type
type
Definition: gaudirun.py:142
PersistencySvc::m_cnvDefault
SmartIF< IConversionSvc > m_cnvDefault
Default output service.
Definition: PersistencySvc.h:235

## ◆ updateObj()

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 115 of file PersistencySvc.cpp.

115 {
116 return makeCall( UPDATE_OBJ, pAddr, pObj );
117 }
PersistencySvc::makeCall
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
Definition: PersistencySvc.cpp:50
UPDATE_OBJ
Definition: PersistencySvc.cpp:42

## ◆ updateObjRefs()

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 120 of file PersistencySvc.cpp.

120 {
121 return makeCall( UPDATE_OBJ_REFS, pAddr, pObj );
122 }
UPDATE_OBJ_REFS
Definition: PersistencySvc.cpp:43
PersistencySvc::makeCall
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
Definition: PersistencySvc.cpp:50

## ◆ updateRep()

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 135 of file PersistencySvc.cpp.

135 {
136 return makeCall( UPDATE_REP, pAddr, pObj );
137 }
PersistencySvc::makeCall
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
Definition: PersistencySvc.cpp:50
UPDATE_REP
Definition: PersistencySvc.cpp:46

## ◆ updateRepRefs()

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 140 of file PersistencySvc.cpp.

140 {
141 return makeCall( UPDATE_REP_REFS, pAddr, pObj );
142 }
PersistencySvc::makeCall
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
Definition: PersistencySvc.cpp:50
UPDATE_REP_REFS
Definition: PersistencySvc.cpp:47

## Member Data Documentation

## ◆ m_addrCreator

SmartIF<IAddressCreator> PersistencySvc::m_addrCreator
| mutable protected

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

Definition at line 250 of file PersistencySvc.h.

## ◆ m_cnvDefault

SmartIF<IConversionSvc> PersistencySvc::m_cnvDefault
| mutable protected

Default output service.

Definition at line 235 of file PersistencySvc.h.

## ◆ m_cnvDefType

long PersistencySvc::m_cnvDefType = TEST_StorageType
| protected

Default service type.

Definition at line 229 of file PersistencySvc.h.

## ◆ m_cnvServices

Services PersistencySvc::m_cnvServices
| protected

List of convermsion workers.

Definition at line 233 of file PersistencySvc.h.

## ◆ m_dataSvc

SmartIF<IDataProviderSvc> PersistencySvc::m_dataSvc
| mutable protected

Pointer to datma provider service.

Definition at line 231 of file PersistencySvc.h.

## ◆ m_enable

bool PersistencySvc::m_enable = true
| protected

Flag to indicate that the service is enabled.

Definition at line 247 of file PersistencySvc.h.

## ◆ m_svcNames

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

Initial value:
{
this,
"CnvServices",
{},
[this]( auto& p ) {
if ( this->msgLevel( MSG::DEBUG ) ) this->debug() << p << endmsg;
},
"Names of services to be requested from the service locator and added by default"}

Definition at line 237 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