Gaudi Framework, version v24r2

Home   Generated: Wed Dec 4 2013
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
PersistencySvc Class Reference

PersistencySvc class implementation definition. More...

#include <PersistencySvc.h>

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

Classes

class  ServiceEntry
 

Public Member Functions

IPersistencySvc Interface implementation
long repSvcType () const
 Return default service type.
 
const CLIDobjType () 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 IConverterconverter (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::stringgetInterfaceNames () 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::stringname () 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 PropertygetProperty (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 >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property.
 
PropertydeclareRemoteProperty (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.
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream.
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts.
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS)
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL)
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR)
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING)
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO)
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG)
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE)
 
MsgStreammsg () 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< IDataProviderSvcm_dataSvc
 Pointer to datma provider service.
 
Services m_cnvServices
 List of convermsion workers.
 
SmartIF< IConversionSvcm_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< IAddressCreatorm_addrCreator
 Pointer to the IAddressCreator interface of this, for addressCreator().
 

Friends

class SvcFactory< PersistencySvc >
 
class Factory< PersistencySvc, IService *(std::string, ISvcLocator *)>
 

: 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:

History:

 +---------+----------------------------------------------+---------+
 |    Date |                 Comment                      | Who     |
 +---------+----------------------------------------------+---------+
 | 3/11/98 | Initial version                              | M.Frank |
 +---------+----------------------------------------------+---------+
 
Author
Markus Frank
Version
1.0

Definition at line 53 of file PersistencySvc.h.

Member Typedef Documentation

Definition at line 106 of file PersistencySvc.h.

Constructor & Destructor Documentation

PersistencySvc::PersistencySvc ( const std::string name,
ISvcLocator svc 
)

Standard Constructor.

Definition at line 626 of file PersistencySvc.cpp.

PersistencySvc::~PersistencySvc ( )
virtual

Standard Destructor.

Definition at line 636 of file PersistencySvc.cpp.

{
}

Member Function Documentation

StatusCode PersistencySvc::addCnvService ( IConversionSvc service)
virtual

Add a new Service.

Add data service.

Definition at line 285 of file PersistencySvc.cpp.

{
if ( 0 != servc ) {
long type = servc->repSvcType();
long def_typ = (m_cnvDefault) ? m_cnvDefault->repSvcType() : 0;
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 ) {
}
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();
}
info() << "Cannot add Conversion service of type " << isvc->name() << endmsg;
isvc->release();
icr->release();
}
icr->release();
}
info() << "Cannot add Conversion service of type " << type << endmsg;
}
else {
}
}
return BAD_STORAGE_TYPE;
}
StatusCode PersistencySvc::addConverter ( IConverter pConverter)
virtual

Add converter object to conversion service.

Definition at line 210 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 205 of file PersistencySvc.cpp.

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

Retrieve address creator facility.

Definition at line 505 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 162 of file PersistencySvc.cpp.

{
long typ = type;
if( it == m_cnvServices.end() ) {
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 369 of file PersistencySvc.cpp.

{
}
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 358 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 364 of file PersistencySvc.cpp.

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

Get conversion service the converter is connected to.

Definition at line 200 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 389 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 236 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 374 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 417 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 122 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 142 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 189 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 451 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 618 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 438 of file PersistencySvc.cpp.

{
// For address header, use xml-style format of
// <addrhdr service_type="xxx" clid="yyy" />
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 127 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 147 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 605 of file PersistencySvc.cpp.

{
// Release all workers
// Release references to this to avoid loops
}
StatusCode PersistencySvc::getService ( long  service_type,
IConversionSvc *&  refpSvc 
)
virtual

Retrieve conversion service identified by technology.

Definition at line 510 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 516 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 )
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 )
else if ( ::strncasecmp(imp,"POOL_ROOTTREE", 12) == 0 )
else if ( ::strncasecmp(imp,"POOL_ROOT", 9) == 0 )
else if ( ::strncasecmp(imp,"POOL_MySQL", 8) == 0 )
else if ( ::strncasecmp(imp,"POOL_ORACLE", 8) == 0 )
else if ( ::strncasecmp(imp,"POOL_ACCESS", 8) == 0 )
else if ( ::strncasecmp(imp,"POOL", 4) == 0 )
return getService(POOL_StorageType, refpSvc);
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();
}
// 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();
}
}
}
// 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 ) {
if ( svc ) {
refpSvc = svc;
}
}
}
}
StatusCode PersistencySvc::initialize ( )
virtual

Initialize the service.

Reimplemented from Service.

Reimplemented in HistogramPersistencySvc, EvtPersistencySvc, and DetPersistencySvc.

Definition at line 594 of file PersistencySvc.cpp.

{
m_addrCreator = this; // initialize internal pointer to IAddressCreator interface
// Initialize basic service
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 58 of file PersistencySvc.cpp.

{
if ( m_enable ) {
IConversionSvc* svc = 0;
switch(typ) {
case CREATE_REP:
case UPDATE_REP:
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;
}
switch( typ ) {
case CREATE_OBJ:
pObject = 0;
status = svc->createObj(pAddress, pObject);
break;
status = svc->fillObjRefs(pAddress, pObject);
break;
case UPDATE_OBJ:
status = svc->updateObj(pAddress, pObject);
break;
status = svc->updateObjRefs(pAddress, pObject);
break;
case CREATE_REP:
status = svc->createRep(pObject, pAddress);
break;
status = svc->fillRepRefs(pAddress, pObject);
break;
case UPDATE_REP:
status = svc->updateRep(pAddress, pObject);
break;
status = svc->updateRepRefs(pAddress, pObject);
break;
default:
break;
}
status.ignore();
return status;
}
}
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 589 of file PersistencySvc.cpp.

{
return CLID_NULL;
}
StatusCode PersistencySvc::removeCnvService ( long  type)
virtual

Remove a Service.

Remove conversion service.

Definition at line 334 of file PersistencySvc.cpp.

{
if( it != m_cnvServices.end() ) {
(*it).second.service()->release();
(*it).second.addrCreator()->release();
}
return BAD_STORAGE_TYPE;
}
StatusCode PersistencySvc::removeConverter ( const CLID clid)
virtual

Remove converter object from conversion service (if present).

Definition at line 223 of file PersistencySvc.cpp.

{
// Remove converter type from all services
StatusCode status = NO_CONVERTER, iret = StatusCode::SUCCESS;
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 346 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 241 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 262 of file PersistencySvc.cpp.

{
typedef std::vector<std::string> SvcNames;
// Check wether this is already an active service
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++ ) {
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 496 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.
}
StatusCode PersistencySvc::setConversionSvc ( IConversionSvc svc)
virtual

Set conversion service the converter is connected to.

Definition at line 194 of file PersistencySvc.cpp.

{
m_cnvDefault = svc;
}
StatusCode PersistencySvc::setDataProvider ( IDataProviderSvc pStore)
virtual

Define transient datastore.

Define transient data store.

Definition at line 180 of file PersistencySvc.cpp.

{
m_dataSvc = pDataSvc;
(*i).second.conversionSvc()->setDataProvider(m_dataSvc).ignore();
}
}
StatusCode PersistencySvc::setDefaultCnvService ( long  type)
virtual

Set default service type.

Set default conversion service.

Definition at line 352 of file PersistencySvc.cpp.

void PersistencySvc::svcNamesHandler ( Property theProp)
protected

Handlers for Service Names Property.

Definition at line 613 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 132 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 137 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 152 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 157 of file PersistencySvc.cpp.

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

Friends And Related Function Documentation

Definition at line 59 of file PersistencySvc.h.

friend class SvcFactory< PersistencySvc >
friend

Definition at line 58 of file PersistencySvc.h.

Member Data Documentation

SmartIF<IAddressCreator> PersistencySvc::m_addrCreator
mutableprotected

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

Definition at line 295 of file PersistencySvc.h.

SmartIF<IConversionSvc> PersistencySvc::m_cnvDefault
mutableprotected

Default output service.

Definition at line 286 of file PersistencySvc.h.

long PersistencySvc::m_cnvDefType
protected

Default service type.

Definition at line 280 of file PersistencySvc.h.

Services PersistencySvc::m_cnvServices
protected

List of convermsion workers.

Definition at line 284 of file PersistencySvc.h.

SmartIF<IDataProviderSvc> PersistencySvc::m_dataSvc
mutableprotected

Pointer to datma provider service.

Definition at line 282 of file PersistencySvc.h.

bool PersistencySvc::m_enable
protected

Flag to indicate that the service is enabled.

Definition at line 292 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 290 of file PersistencySvc.h.


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

Generated at Wed Dec 4 2013 14:33:18 for Gaudi Framework, version v24r2 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004