| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Protected Types | Protected Member Functions | Protected Attributes | List of all members
PersistencySvc Class Reference

PersistencySvc class implementation definition. More...

`#include <PersistencySvc.h>`

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

## Classes
class | ServiceEntry

## Public Member Functions
IPersistencySvc Interface implementation
long | repSvcType () const
| Return default service type.
const CLID & | objType () const
| Retrieve the class type of objects the converter produces. (DUMMY)
virtual StatusCode | createObj (IOpaqueAddress *pAddress, DataObject *&refpObject)
| Implementation of IConverter: Create the transient representation of an object.
virtual StatusCode | fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
| Implementation of IConverter: Resolve the references of the created transient object.
virtual StatusCode | updateObj (IOpaqueAddress *pAddress, DataObject *refpObject)
| Implementation of IConverter: Update the transient object from the other representation.
virtual StatusCode | updateObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
| Implementation of IConverter: Update the references of an updated transient object.
virtual StatusCode | createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
| Implementation of IConverter: Convert the transient object to the requested representation.
virtual StatusCode | fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
| Implementation of IConverter: Resolve the references of the converted object.
virtual StatusCode | updateRep (IOpaqueAddress *pAddress, DataObject *pObject)
| Implementation of IConverter: Update the converted representation of a transient object.
virtual StatusCode | updateRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
| Implementation of IConverter: Update the references of an already converted object.
virtual StatusCode | setDataProvider (IDataProviderSvc *pStore)
| Define transient datastore.
virtual SmartIF < IDataProviderSvc > & | dataProvider () const
| Access reference to transient datastore.
virtual StatusCode | setConversionSvc (IConversionSvc *svc)
| Set conversion service the converter is connected to.
virtual SmartIF< IConversionSvc > & | conversionSvc () const
| Get conversion service the converter is connected to.
virtual StatusCode | setAddressCreator (IAddressCreator *creator)
| Set address creator facility.
virtual SmartIF < IAddressCreator > & | addressCreator () const
| Retrieve address creator facility.
virtual StatusCode | addConverter (IConverter *pConverter)
| Add converter object to conversion service.
virtual StatusCode | addConverter (const CLID &clid)
| Add converter object to conversion service.
virtual IConverter * | converter (const CLID &clid)
| Retrieve converter from list.
virtual StatusCode | removeConverter (const CLID &clid)
| Remove converter object from conversion service (if present).
virtual StatusCode | connectOutput (const std::string &outputFile, const std::string &openMode)
| Connect the output file to the service with open mode.
virtual StatusCode | connectOutput (const std::string &outputFile)
| Connect the output file to the service.
virtual StatusCode | commitOutput (const std::string &output, bool do_commit)
| Commit pending output.
virtual StatusCode | createAddress (long svc_type, const CLID &clid, const std::string *pars, const unsigned long *ipars, IOpaqueAddress *&refpAddress)
| Create a Generic address using explicit arguments to identify a single object.
virtual StatusCode | convertAddress (const IOpaqueAddress *pAddress, std::string &refAddress)
| Convert an address to string form.
virtual StatusCode | createAddress (long svc_type, const CLID &clid, const std::string &refAddress, IOpaqueAddress *&refpAddress)
| Convert an address in string form to object form.
: IPersistencySvc implementation
virtual StatusCode | addCnvService (IConversionSvc *service)
| Add a new Service.
virtual StatusCode | removeCnvService (long type)
| Remove a Service.
virtual StatusCode | setDefaultCnvService (long type)
| Set default service type.
virtual StatusCode | getService (long service_type, IConversionSvc *&refpSvc)
| Retrieve conversion service identified by technology.
virtual StatusCode | getService (const std::string &service_type, IConversionSvc *&refpSvc)
| Retrieve conversion service identified by technology.
: IService implementation
virtual StatusCode | initialize ()
| Initialize the service.
virtual StatusCode | finalize ()
| stop the service.
Public Member Functions inherited from extends3< Service, IConversionSvc, IPersistencySvc, IAddressCreator >
| extends3 (A1 a1, A2 a2, A3 a3)
| Templated constructor with 3 arguments.
| extends3 (A1 a1, A2 a2)
| Templated constructor with 2 arguments.
| extends3 (A1 a1)
| Templated constructor with 1 argument.
| extends3 ()
| Default constructor.
virtual void * | i_cast (const InterfaceID &tid) const
| Implementation of IInterface::i_cast.
virtual StatusCode | queryInterface (const InterfaceID &ti, void **pp)
| Implementation of IInterface::queryInterface.
virtual std::vector< std::string > | getInterfaceNames () const
| Implementation of IInterface::getInterfaceNames.
virtual | ~extends3 ()
| Virtual destructor.
Public Member Functions inherited from Service
virtual unsigned long | release ()
| Release Interface instance.
virtual const std::string & | name () const
| Retrieve name of the service.
virtual StatusCode | configure ()
virtual StatusCode | start ()
virtual StatusCode | stop ()
virtual StatusCode | terminate ()
virtual Gaudi::StateMachine::State | FSMState () const
virtual Gaudi::StateMachine::State | targetFSMState () const
virtual StatusCode | reinitialize ()
virtual StatusCode | restart ()
virtual StatusCode | sysInitialize ()
| Initialize Service.
virtual StatusCode | sysStart ()
| Initialize Service.
virtual StatusCode | sysStop ()
| Initialize Service.
virtual StatusCode | sysFinalize ()
| Finalize Service.
virtual StatusCode | sysReinitialize ()
| Re-initialize the Service.
virtual StatusCode | sysRestart ()
| Re-initialize the Service.
virtual StatusCode | setProperty (const Property &p)
virtual StatusCode | setProperty (const std::string &s)
virtual StatusCode | setProperty (const std::string &n, const std::string &v)
virtual StatusCode | getProperty (Property *p) const
virtual const Property & | getProperty (const std::string &name) const
virtual StatusCode | getProperty (const std::string &n, std::string &v) const
virtual const std::vector < Property * > & | getProperties () const
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value
| Service (const std::string &name, ISvcLocator *svcloc)
| Standard Constructor.
SmartIF< ISvcLocator > & | serviceLocator () const
| Retrieve pointer to service locator.
StatusCode | setProperties ()
| Method for setting declared properties to the values specified for the job.
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.
template<class T >
StatusCode | service (const std::string &name, T *&psvc, 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.
template<class T >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property.
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
| Declare remote named properties.
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked.
Public Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
| CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
| Templated constructor with 3 arguments.
| CommonMessaging (const A1 &a1, const A2 &a2)
| Templated constructor with 2 arguments.
| CommonMessaging (const A1 &a1)
| Templated constructor with 1 argument.
| CommonMessaging ()
| Default constructor.
virtual | ~CommonMessaging ()
| Virtual destructor.
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service.
MsgStream & | msgStream () const
| Return an uninitialized MsgStream.
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts.
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS)
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL)
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR)
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR)
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING)
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO)
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG)
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE)
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO)
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream
Public Member Functions inherited from extend_interfaces3< I1, I2, I3 >
virtual | ~extend_interfaces3 ()
| Virtual destructor.

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

## Protected Member Functions
void | svcNamesHandler (Property &theProp)
| Handlers for Service Names Property.

## Protected Attributes
long | m_cnvDefType
| Default service type.
SmartIF< IDataProviderSvc > | m_dataSvc
| Pointer to datma provider service.
Services | m_cnvServices
| List of convermsion workers.
SmartIF< IConversionSvc > | m_cnvDefault
| Default output service.
StringArrayProperty | m_svcNames
| Names of services to be requested from the service locator and added by default.
bool | m_enable
| Flag to indicate that the service is enabled.
SmartIF< IAddressCreator > | m_addrCreator
| Pointer to the IAddressCreator interface of this, for addressCreator().

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

## Additional Inherited Members
Public Types inherited from extends3< Service, IConversionSvc, IPersistencySvc, IAddressCreator >
typedef extends3 | base_class
| Typedef to this class.
typedef extend_interfaces3 < IConversionSvc, IPersistencySvc, IAddressCreator > | extend_interfaces_base
| Typedef to the base of this class.
typedef extend_interfaces_base::ext_iids | interfaces
| MPL set of all the implemented interfaces.

## 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 49 of file PersistencySvc.h.

## Member Typedef Documentation

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

Definition at line 100 of file PersistencySvc.h.

## Constructor & Destructor Documentation

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

Standard Constructor.

Definition at line 624 of file PersistencySvc.cpp.

: base_class(name, svc),
m_cnvDefType(TEST_StorageType),
m_enable(true)
{
declareProperty("CnvServices", m_svcNames);
m_svcNames.declareUpdateHandler( &PersistencySvc::svcNamesHandler, this );
}

PersistencySvc::~PersistencySvc | ( |  | ) |
| virtual

Standard Destructor.

Definition at line 634 of file PersistencySvc.cpp.

{
}

## Member Function Documentation

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

Add a new Service.

Add data service.

Definition at line 283 of file PersistencySvc.cpp.

{
if ( 0 != servc ) {
long type = servc->repSvcType();
long def_typ = (m_cnvDefault) ? m_cnvDefault->repSvcType() : 0;
Services::iterator it = m_cnvServices.find( type );
IConversionSvc* cnv_svc = 0;
if ( it != m_cnvServices.end() ) {
cnv_svc = (*it).second.conversionSvc();
}
if ( type == def_typ ) {
m_cnvDefault = servc;
}
if ( cnv_svc != servc ) {
IAddressCreator* icr = 0;
StatusCode status = servc->queryInterface(IAddressCreator::interfaceID(), pp_cast<void>(&icr));
if ( status.isSuccess() ) {
IService* isvc = 0;
status = servc->queryInterface(IService::interfaceID(), pp_cast<void>(&isvc));
if ( status.isSuccess() ) {
if ( 0 != cnv_svc ) {
removeCnvService (type).ignore();
}
std::pair<Services::iterator, bool> p =
m_cnvServices.insert( Services::value_type( type, ServiceEntry(type, isvc, servc, icr)));
if( p.second ) {
info() << "Added successfully Conversion service:" << isvc->name() << endmsg;
servc->addRef();
servc->setAddressCreator(this).ignore();
servc->setDataProvider(m_dataSvc).ignore();
return StatusCode::SUCCESS;
}
info() << "Cannot add Conversion service of type " << isvc->name() << endmsg;
isvc->release();
icr->release();
return StatusCode::FAILURE;
}
icr->release();
}
info() << "Cannot add Conversion service of type " << type << endmsg;
return StatusCode::FAILURE;
}
else {
return StatusCode::SUCCESS;
}
}
return BAD_STORAGE_TYPE;
}

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

Add converter object to conversion service.

Definition at line 208 of file PersistencySvc.cpp.

{
if ( 0 != pConverter ) {
long typ = pConverter->repSvcType();
IConversionSvc* svc = service(typ);
if ( 0 != svc ) {
return svc->addConverter(pConverter);
}
return BAD_STORAGE_TYPE;
}
return NO_CONVERTER;
}

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

Add converter object to conversion service.

Definition at line 203 of file PersistencySvc.cpp.

{
return StatusCode::FAILURE;
}

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

Retrieve address creator facility.

Definition at line 503 of file PersistencySvc.cpp.

{
return m_addrCreator;
}

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.

{
long typ = type;
Services::iterator it = m_cnvServices.find( typ );
if( it == m_cnvServices.end() ) {
IConversionSvc* s = service(type);
if ( s ) {
it = m_cnvServices.find( typ );
if ( it != m_cnvServices.end() ) {
return (*it).second.addrCreator();
}
}
static SmartIF<IAddressCreator> no_creator;
return no_creator;
}
return (*it).second.addrCreator();
}

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

Commit pending output.

Definition at line 367 of file PersistencySvc.cpp.

{
return StatusCode::SUCCESS;
}

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

Connect the output file to the service with open mode.

Definition at line 356 of file PersistencySvc.cpp.

{
return connectOutput(outputFile);
}

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

Connect the output file to the service.

Definition at line 362 of file PersistencySvc.cpp.

{
return StatusCode::SUCCESS;
}

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

Get conversion service the converter is connected to.

Definition at line 198 of file PersistencySvc.cpp.

{
return m_cnvDefault;
}

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

Convert an address to string form.

Definition at line 387 of file PersistencySvc.cpp.

{
// Assumuption is that the Persistency service prepends a header
// and requests the conversion service refered to by the service
// type to encode the rest
long svc_type = 0;
CLID clid = 0;
if ( 0 != pAddress ) {
svc_type = pAddress->svcType();
clid = pAddress->clID();
}
IAddressCreator* svc = addressCreator(svc_type);
StatusCode status = BAD_STORAGE_TYPE; // Preset error
refAddress = "";
if ( 0 != svc ) {
// Found service, set header
encodeAddrHdr(svc_type, clid, refAddress);
std::string address;
// Get rest of address from conversion service
status = svc->convertAddress(pAddress, address);
refAddress += address;
}
return status;
}

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

Retrieve converter from list.

Definition at line 234 of file PersistencySvc.cpp.

{
return 0;
}

StatusCode PersistencySvc::createAddress | ( | long | svc_type,
|  | const CLID & | clid,
|  | const std::string * | pars,
|  | const unsigned long * | ipars,
|  | IOpaqueAddress *& | refpAddress
| ) |  |
| virtual

Create a Generic address using explicit arguments to identify a single object.

Definition at line 372 of file PersistencySvc.cpp.

{
IAddressCreator* svc = addressCreator(svc_type);
StatusCode status = BAD_STORAGE_TYPE; // Preset error
refpAddress = 0;
if ( 0 != svc ) {
status = svc->createAddress(svc_type, clid, pars, ipars, refpAddress);
}
return status;
}

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

Convert an address in string form to object form.

Definition at line 415 of file PersistencySvc.cpp.

{
// Assumption is that the Persistency service decodes that header
// and requests the conversion service referred to by the service
// type to decode the rest
long new_svc_type = 0;
CLID new_clid = 0;
std::string address_trailer;
decodeAddrHdr(refAddress, new_svc_type, new_clid, address_trailer);
IAddressCreator* svc = addressCreator(new_svc_type);
StatusCode status = BAD_STORAGE_TYPE; // Preset error
if ( 0 != svc ) {
status = svc->createAddress( new_svc_type, new_clid, address_trailer, refpAddress);
}
return status;
}

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

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

Create the transient representation of an object.

Definition at line 120 of file PersistencySvc.cpp.

{
return makeCall(CREATE_OBJ, pAddr, refpObj);
}

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

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

Convert the transient object to the requested representation.

Reimplemented in HistogramPersistencySvc.

Definition at line 140 of file PersistencySvc.cpp.

{
return makeCall(CREATE_REP, refpAddr, pObj);
}

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

Access reference to transient datastore.

Access the dataprovider service.

Definition at line 187 of file PersistencySvc.cpp.

{
return m_dataSvc;
}

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

{
// For address header, use xml-style format of
// <address_header service_type="xxx" clid="yyy" />
service_type = 0;
clid = 0;
address_trailer = "";
// Check for address_header tag
size_t pos = address.find("<address_header");
if (std::string::npos != pos) {
// Get service_type
pos = address.find("service_type=\"");
if (std::string::npos != pos) {
pos += 14;
size_t end = address.find('"', pos);
if (std::string::npos != end) {
std::istringstream str(address.substr(pos, end-pos));
str >> service_type;
// Get clid
pos = address.find("clid=\"");
if (std::string::npos != pos) {
pos += 6;
end = address.find('\"', pos);
if (std::string::npos != end) {
str.clear(); // reuse the istringstream (the error flags must be explicitly cleared)
str.str(address.substr(pos, end-pos));
str >> clid;
// Get trailer_address
pos = address.find('>');
if (pos < (address.size()-2)) { // this means that '>' was found (pos != npos)
// it is before the last char
address_trailer = address.substr(pos+1);
}
}
}
}
}
}
}

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

Set enabled flag.

Definition at line 616 of file PersistencySvc.cpp.

{
bool old = m_enable;
m_enable = value;
return old;
}

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

Retrieve string from storage type and clid.

Definition at line 436 of file PersistencySvc.cpp.

{
// For address header, use xml-style format of
// <addrhdr service_type="xxx" clid="yyy" />
std::stringstream stream;
int svctyp = service_type; // must put int into stream, not char
stream << "<address_header service_type=\"" << svctyp << "\" clid=\"" << clid << "\" /> ";
address = stream.str();
}

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

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

Resolve the references of the created transient object.

Definition at line 125 of file PersistencySvc.cpp.

{
return makeCall(FILL_OBJ_REFS, pAddr, pObj);
}

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

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

Resolve the references of the converted object.

Definition at line 145 of file PersistencySvc.cpp.

{
return makeCall(FILL_REP_REFS, pAddr, pObj);
}

StatusCode PersistencySvc::finalize | ( |  | ) |
| virtual

stop the service.

Reimplemented from Service.

Reimplemented in HistogramPersistencySvc, EvtPersistencySvc, and DetPersistencySvc.

Definition at line 603 of file PersistencySvc.cpp.

{
// Release all workers
m_cnvServices.clear();
// Release references to this to avoid loops
m_addrCreator = 0;
return StatusCode::SUCCESS;
}

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

Retrieve conversion service identified by technology.

Definition at line 508 of file PersistencySvc.cpp.

{
refpSvc = service(service_type);
return (0==refpSvc) ? StatusCode::FAILURE : StatusCode::SUCCESS;
}

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

Retrieve conversion service identified by technology.

Definition at line 514 of file PersistencySvc.cpp.

{
const char* imp = service_type.c_str();
long len = service_type.length();
if ( ::strncasecmp(imp,"SICB", len) == 0 )
return getService(SICB_StorageType, refpSvc);
else if ( ::strncasecmp(imp,"ZEBRA", len) == 0 )
return getService(SICB_StorageType, refpSvc);
else if ( ::strncasecmp(imp,"MS Access", len) == 0 )
return getService(ACCESS_StorageType, refpSvc);
else if ( ::strncasecmp(imp,"Microsoft Access", strlen("Microsoft Access")) == 0 )
return getService(ACCESS_StorageType, refpSvc);
else if ( ::strncasecmp(imp,"SQL Server", len) == 0 )
return getService(SQLSERVER_StorageType, refpSvc);
else if ( ::strncasecmp(imp,"Microsoft ODBC for Oracle", len) == 0 )
return getService(ORACLE_StorageType, refpSvc);
else if ( ::strncasecmp(imp,"Oracle ODBC", strlen("Oracle ODBC")) == 0 )
return getService(ORACLE_StorageType, refpSvc);
else if ( ::strncasecmp(imp,"Oracle OCI", strlen("Oracle OCI")) == 0 )
return getService(ORACLE_StorageType, refpSvc);
else if ( ::strncasecmp(imp,"MySQL", len) == 0 )
return getService(MYSQL_StorageType, refpSvc);
else if ( ::strncasecmp(imp,"ROOT", len) == 0 )
return getService(ROOT_StorageType, refpSvc);
else if ( ::strncasecmp(imp,"OBJY", len) == 0 )
return getService(OBJY_StorageType, refpSvc);
else if ( ::strncasecmp(imp,"OBJYECTI", 7) == 0 )
return getService(OBJY_StorageType, refpSvc);
else if ( ::strncasecmp(imp,"POOL_ROOTKEY", 12) == 0 )
return getService(POOL_ROOTKEY_StorageType, refpSvc);
else if ( ::strncasecmp(imp,"POOL_ROOTTREE", 12) == 0 )
return getService(POOL_ROOTTREE_StorageType, refpSvc);
else if ( ::strncasecmp(imp,"POOL_ROOT", 9) == 0 )
return getService(POOL_ROOT_StorageType, refpSvc);
else if ( ::strncasecmp(imp,"POOL_MySQL", 8) == 0 )
return getService(POOL_MYSQL_StorageType, refpSvc);
else if ( ::strncasecmp(imp,"POOL_ORACLE", 8) == 0 )
return getService(POOL_ORACLE_StorageType, refpSvc);
else if ( ::strncasecmp(imp,"POOL_ACCESS", 8) == 0 )
return getService(POOL_ACCESS_StorageType, refpSvc);
else if ( ::strncasecmp(imp,"POOL", 4) == 0 )
return getService(POOL_StorageType, refpSvc);
for(Services::const_iterator i=m_cnvServices.begin(); i != m_cnvServices.end();++i) {
SmartIF<IService> svc((*i).second.conversionSvc());
if ( svc ) {
// Check wether this is already an active service: first check by service name
if ( svc->name() == service_type ) {
refpSvc = (*i).second.conversionSvc();
return StatusCode::SUCCESS;
}
// Check wether this is already an active service: now check by service type
if ( System::typeinfoName(typeid(*(svc.get()))) == service_type ) {
refpSvc = (*i).second.conversionSvc();
return StatusCode::SUCCESS;
}
}
}
const std::vector<std::string>& names = m_svcNames;
// if not, check if the service is in the list and may be requested
for(std::vector<std::string>::const_iterator i=names.begin(); i != names.end(); i++) {
Gaudi::Utils::TypeNameString itm(*i);
if ( itm.name() == service_type || itm.type() == service_type ) {
IConversionSvc* svc = service(*i);
if ( svc ) {
refpSvc = svc;
return StatusCode::SUCCESS;
}
}
}
return StatusCode::FAILURE;
}

StatusCode PersistencySvc::initialize | ( |  | ) |
| virtual

Initialize the service.

Reimplemented from Service.

Reimplemented in HistogramPersistencySvc, EvtPersistencySvc, and DetPersistencySvc.

Definition at line 592 of file PersistencySvc.cpp.

{
m_addrCreator = this; // initialize internal pointer to IAddressCreator interface
// Initialize basic service
StatusCode status = Service::initialize();
if ( UNLIKELY(!status.isSuccess()) ) {
error() << "Error initializing Service base class." << endmsg;
}
return status;
}

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

Implementation helper.

Definition at line 56 of file PersistencySvc.cpp.

{
if ( m_enable ) {
IConversionSvc* svc = 0;
switch(typ) {
case CREATE_REP:
case FILL_REP_REFS:
case UPDATE_REP:
case UPDATE_REP_REFS:
svc = m_cnvDefault;
break;
default:
if ( 0 != pAddress ) {
long svc_type = pAddress->svcType();
svc = service(svc_type);
if ( 0 == svc ) {
return BAD_STORAGE_TYPE;
}
}
else {
return INVALID_ADDRESS;
}
break;
}
StatusCode status(StatusCode::FAILURE,true);
switch( typ ) {
case CREATE_OBJ:
pObject = 0;
status = svc->createObj(pAddress, pObject);
break;
case FILL_OBJ_REFS:
status = svc->fillObjRefs(pAddress, pObject);
break;
case UPDATE_OBJ:
status = svc->updateObj(pAddress, pObject);
break;
case UPDATE_OBJ_REFS:
status = svc->updateObjRefs(pAddress, pObject);
break;
case CREATE_REP:
status = svc->createRep(pObject, pAddress);
break;
case FILL_REP_REFS:
status = svc->fillRepRefs(pAddress, pObject);
break;
case UPDATE_REP:
status = svc->updateRep(pAddress, pObject);
break;
case UPDATE_REP_REFS:
status = svc->updateRepRefs(pAddress, pObject);
break;
default:
status = StatusCode::FAILURE;
break;
}
status.ignore();
return status;
}
return StatusCode::SUCCESS;
}

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

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

Retrieve the class type of objects the converter produces.

Definition at line 587 of file PersistencySvc.cpp.

{
return CLID_NULL;
}

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

Remove a Service.

Remove conversion service.

Definition at line 332 of file PersistencySvc.cpp.

{
Services::iterator it = m_cnvServices.find( svctype );
if( it != m_cnvServices.end() ) {
(*it).second.service()->release();
(*it).second.addrCreator()->release();
m_cnvServices.erase(it);
return StatusCode::SUCCESS;
}
return BAD_STORAGE_TYPE;
}

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

Remove converter object from conversion service (if present).

Definition at line 221 of file PersistencySvc.cpp.

{
// Remove converter type from all services
StatusCode status = NO_CONVERTER, iret = StatusCode::SUCCESS;
for ( Services::iterator i = m_cnvServices.begin(); i != m_cnvServices.end(); i++ ) {
iret = (*i).second.conversionSvc()->removeConverter(clid);
if ( iret.isSuccess() ) {
status = iret;
}
}
return status;
}

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

Return default service type.

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

Definition at line 344 of file PersistencySvc.cpp.

{
long typ = (m_cnvDefault) ? m_cnvDefault->repSvcType() : 0;
return typ;
}

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

Retrieve conversion service by name.

Definition at line 239 of file PersistencySvc.cpp.

{
Gaudi::Utils::TypeNameString tn(nam);
IConversionSvc* svc = 0;
for ( Services::iterator it = m_cnvServices.begin(); it != m_cnvServices.end(); it++ ) {
if ( (*it).second.service()->name() == tn.name() ) {
return (*it).second.conversionSvc();
}
}
StatusCode status = Service::service(nam, svc, true);
if ( status.isSuccess() ) {
if ( addCnvService(svc).isSuccess() ) {
svc->release(); // Do not double-reference count
return service(nam); // now it is in the list
}
}
info() << "Cannot access Conversion service:" << nam << endmsg;
static SmartIF<IConversionSvc> no_svc;
return no_svc;
}

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

Retrieve conversion service from list.

Definition at line 260 of file PersistencySvc.cpp.

{
typedef std::vector<std::string> SvcNames;
// Check wether this is already an active service
Services::iterator it = m_cnvServices.find( type );
if( it != m_cnvServices.end() ) {
return (*it).second.conversionSvc();
}
// if not, check if the service is in the list and may be requested
const SvcNames& theNames = m_svcNames.value();
for ( SvcNames::const_iterator i = theNames.begin(); i != theNames.end(); i++ ) {
SmartIF<IConversionSvc>& svc = service(*i);
if ( svc != 0 ) {
long typ = svc->repSvcType();
if ( typ == type ) {
return svc;
}
}
}
static SmartIF<IConversionSvc> no_svc;
return no_svc;
}

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

Set address creator facility.

Definition at line 494 of file PersistencySvc.cpp.

{
// The persistency service is a address creation dispatcher istelf.
// The persistency service can NEVER create addresses itself.
// The entry point must only be provided in order to fulfill the needs of the
// implementing interfaces.
return StatusCode::FAILURE;
}

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

Set conversion service the converter is connected to.

Definition at line 192 of file PersistencySvc.cpp.

{
m_cnvDefault = svc;
return StatusCode(StatusCode::SUCCESS,true);
}

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

Define transient datastore.

Define transient data store.

Definition at line 178 of file PersistencySvc.cpp.

{
m_dataSvc = pDataSvc;
for ( Services::iterator i = m_cnvServices.begin(); i != m_cnvServices.end(); i++ ) {
(*i).second.conversionSvc()->setDataProvider(m_dataSvc).ignore();
}
return StatusCode(StatusCode::SUCCESS,true);
}

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

Set default service type.

Set default conversion service.

Definition at line 350 of file PersistencySvc.cpp.

{
m_cnvDefault = service(type);
return StatusCode::SUCCESS;
}

void PersistencySvc::svcNamesHandler | ( | Property & | theProp | ) |
| protected

Handlers for Service Names Property.

Definition at line 611 of file PersistencySvc.cpp.

{
DEBMSG << p << endmsg;
}

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

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

Update the transient object from the other representation.

Definition at line 130 of file PersistencySvc.cpp.

{
return makeCall(UPDATE_OBJ, pAddr, pObj);
}

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

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

Update the references of an updated transient object.

Definition at line 135 of file PersistencySvc.cpp.

{
return makeCall(UPDATE_OBJ_REFS, pAddr, pObj);
}

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

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

Update the converted representation of a transient object.

Definition at line 150 of file PersistencySvc.cpp.

{
return makeCall(UPDATE_REP, pAddr, pObj);
}

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

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

Update the references of an already converted object.

Definition at line 155 of file PersistencySvc.cpp.

{
return makeCall(UPDATE_REP_REFS, pAddr, pObj);
}

## Member Data Documentation

SmartIF<IAddressCreator> PersistencySvc::m_addrCreator
| mutable protected

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

Definition at line 289 of file PersistencySvc.h.

SmartIF<IConversionSvc> PersistencySvc::m_cnvDefault
| mutable protected

Default output service.

Definition at line 280 of file PersistencySvc.h.

long PersistencySvc::m_cnvDefType
| protected

Default service type.

Definition at line 274 of file PersistencySvc.h.

Services PersistencySvc::m_cnvServices
| protected

List of convermsion workers.

Definition at line 278 of file PersistencySvc.h.

SmartIF<IDataProviderSvc> PersistencySvc::m_dataSvc
| mutable protected

Pointer to datma provider service.

Definition at line 276 of file PersistencySvc.h.

bool PersistencySvc::m_enable
| protected

Flag to indicate that the service is enabled.

Definition at line 286 of file PersistencySvc.h.

StringArrayProperty PersistencySvc::m_svcNames
| protected

Names of services to be requested from the service locator and added by default.

Definition at line 284 of file PersistencySvc.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiCommonSvc/src/PersistencySvc/PersistencySvc.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiCommonSvc/src/PersistencySvc/PersistencySvc.cpp