|
Gaudi Framework, version v22r2 |
| Home | Generated: Tue May 10 2011 |
PersistencySvc class implementation definition. More...
#include <PersistencySvc.h>


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. | |
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(). | |
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. | |
PersistencySvc class implementation definition.
System: The LHCb Offline System
Package: PersistencySvc
Dependencies:
History:
+---------+----------------------------------------------+---------+
| Date | Comment | Who |
+---------+----------------------------------------------+---------+
| 3/11/98 | Initial version | M.Frank |
+---------+----------------------------------------------+---------+
Definition at line 53 of file PersistencySvc.h.
typedef std::map<long,ServiceEntry> PersistencySvc::Services [protected] |
Definition at line 106 of file PersistencySvc.h.
| PersistencySvc::PersistencySvc | ( | const std::string & | name, |
| ISvcLocator * | svc | ||
| ) |
Standard Constructor.
Definition at line 623 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] |
| StatusCode PersistencySvc::addCnvService | ( | IConversionSvc * | service ) | [virtual] |
Add a new Service.
Add data service.
Definition at line 280 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 ) {
MsgStream log( msgSvc(), name() );
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 ) {
log << MSG::INFO << "Added successfully Conversion service:" << isvc->name() << endmsg;
servc->addRef();
servc->setAddressCreator(this).ignore();
servc->setDataProvider(m_dataSvc).ignore();
return StatusCode::SUCCESS;
}
log << MSG::INFO << "Cannot add Conversion service of type " << isvc->name() << endmsg;
isvc->release();
icr->release();
return StatusCode::FAILURE;
}
icr->release();
}
log << MSG::INFO << "Cannot add Conversion service of type " << type << endmsg;
return StatusCode::FAILURE;
}
else {
return StatusCode::SUCCESS;
}
}
return BAD_STORAGE_TYPE;
}
| StatusCode PersistencySvc::addConverter | ( | const CLID & | clid ) | [virtual] |
Add converter object to conversion service.
Definition at line 199 of file PersistencySvc.cpp.
{
return StatusCode::FAILURE;
}
| StatusCode PersistencySvc::addConverter | ( | IConverter * | pConverter ) | [virtual] |
Add converter object to conversion service.
Definition at line 204 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;
}
| SmartIF< IAddressCreator > & PersistencySvc::addressCreator | ( | ) | const [virtual] |
Retrieve address creator facility.
Definition at line 500 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 156 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 365 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 354 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 360 of file PersistencySvc.cpp.
{
return StatusCode::SUCCESS;
}
| SmartIF< IConversionSvc > & PersistencySvc::conversionSvc | ( | ) | const [virtual] |
Get conversion service the converter is connected to.
Definition at line 194 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 385 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] |
| 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 370 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 413 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 116 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 136 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 183 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 447 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.str(address.substr(pos, end-pos)); // reuse the istringstream
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 615 of file PersistencySvc.cpp.
| void PersistencySvc::encodeAddrHdr | ( | long | service_type, |
| const CLID & | clid, | ||
| std::string & | address | ||
| ) | const [protected] |
Retrieve string from storage type and clid.
Definition at line 434 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 121 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 141 of file PersistencySvc.cpp.
{
return makeCall(FILL_REP_REFS, pAddr, pObj);
}
| StatusCode PersistencySvc::finalize | ( | void | ) | [virtual] |
stop the service.
Reimplemented from Service.
Reimplemented in DetPersistencySvc, EvtPersistencySvc, and HistogramPersistencySvc.
Definition at line 601 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 | ( | const std::string & | service_type, |
| IConversionSvc *& | refpSvc | ||
| ) | [virtual] |
Retrieve conversion service identified by technology.
Definition at line 511 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::getService | ( | long | service_type, |
| IConversionSvc *& | refpSvc | ||
| ) | [virtual] |
Retrieve conversion service identified by technology.
Definition at line 505 of file PersistencySvc.cpp.
{
refpSvc = service(service_type);
return (0==refpSvc) ? StatusCode::FAILURE : StatusCode::SUCCESS;
}
| StatusCode PersistencySvc::initialize | ( | ) | [virtual] |
Initialize the service.
Reimplemented from Service.
Reimplemented in DetPersistencySvc, EvtPersistencySvc, and HistogramPersistencySvc.
Definition at line 589 of file PersistencySvc.cpp.
{
m_addrCreator = this; // initialize internal pointer to IAddressCreator interface
// Initialize basic service
StatusCode status = Service::initialize();
if ( !status.isSuccess() ) {
MsgStream log( msgSvc(), name() ); // Service MUST be initialized BEFORE!
log << MSG::ERROR << "Error initializing Service base class." << endmsg;
}
return status;
}
| StatusCode PersistencySvc::makeCall | ( | int | typ, |
| IOpaqueAddress *& | pAddress, | ||
| DataObject *& | pObject | ||
| ) | [protected] |
Implementation helper.
Definition at line 52 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 584 of file PersistencySvc.cpp.
{
return CLID_NULL;
}
| StatusCode PersistencySvc::removeCnvService | ( | long | type ) | [virtual] |
Remove a Service.
Remove conversion service.
Definition at line 330 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 217 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 342 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 235 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
}
}
MsgStream log( msgSvc(), name() );
log << MSG::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 257 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 491 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 188 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 174 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 348 of file PersistencySvc.cpp.
{
m_cnvDefault = service(type);
return StatusCode::SUCCESS;
}
| void PersistencySvc::svcNamesHandler | ( | Property & | theProp ) | [protected] |
| 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 126 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 131 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 146 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 151 of file PersistencySvc.cpp.
{
return makeCall(UPDATE_REP_REFS, pAddr, pObj);
}
friend class Factory< PersistencySvc, IService *(std::string, ISvcLocator *)> [friend] |
Definition at line 59 of file PersistencySvc.h.
friend class SvcFactory< PersistencySvc > [friend] |
Definition at line 58 of file PersistencySvc.h.
SmartIF<IAddressCreator> PersistencySvc::m_addrCreator [mutable, protected] |
Pointer to the IAddressCreator interface of this, for addressCreator().
Definition at line 295 of file PersistencySvc.h.
SmartIF<IConversionSvc> PersistencySvc::m_cnvDefault [mutable, protected] |
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 [mutable, protected] |
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.