All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PersistencySvc Class Reference

PersistencySvc class implementation definition. More...

#include <src/PersistencySvc/PersistencySvc.h>

Inheritance diagram for PersistencySvc:
Collaboration diagram for PersistencySvc:

Classes

class  ServiceEntry
 

Public Member Functions

IPersistencySvc Interface implementation
long repSvcType () const
 Return default service type. More...
 
const CLIDobjType () const
 Retrieve the class type of objects the converter produces. (DUMMY) More...
 
virtual StatusCode createObj (IOpaqueAddress *pAddress, DataObject *&refpObject)
 Implementation of IConverter: Create the transient representation of an object. More...
 
virtual StatusCode fillObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Implementation of IConverter: Resolve the references of the created transient object. More...
 
virtual StatusCode updateObj (IOpaqueAddress *pAddress, DataObject *refpObject)
 Implementation of IConverter: Update the transient object from the other representation. More...
 
virtual StatusCode updateObjRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Implementation of IConverter: Update the references of an updated transient object. More...
 
virtual StatusCode createRep (DataObject *pObject, IOpaqueAddress *&refpAddress)
 Implementation of IConverter: Convert the transient object to the requested representation. More...
 
virtual StatusCode fillRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Implementation of IConverter: Resolve the references of the converted object. More...
 
virtual StatusCode updateRep (IOpaqueAddress *pAddress, DataObject *pObject)
 Implementation of IConverter: Update the converted representation of a transient object. More...
 
virtual StatusCode updateRepRefs (IOpaqueAddress *pAddress, DataObject *pObject)
 Implementation of IConverter: Update the references of an already converted object. More...
 
virtual StatusCode setDataProvider (IDataProviderSvc *pStore)
 Define transient datastore. More...
 
virtual SmartIF
< IDataProviderSvc > & 
dataProvider () const
 Access reference to transient datastore. More...
 
virtual StatusCode setConversionSvc (IConversionSvc *svc)
 Set conversion service the converter is connected to. More...
 
virtual SmartIF< IConversionSvc > & conversionSvc () const
 Get conversion service the converter is connected to. More...
 
virtual StatusCode setAddressCreator (IAddressCreator *creator)
 Set address creator facility. More...
 
virtual SmartIF
< IAddressCreator > & 
addressCreator () const
 Retrieve address creator facility. More...
 
virtual StatusCode addConverter (IConverter *pConverter)
 Add converter object to conversion service. More...
 
virtual StatusCode addConverter (const CLID &clid)
 Add converter object to conversion service. More...
 
virtual IConverterconverter (const CLID &clid)
 Retrieve converter from list. More...
 
virtual StatusCode removeConverter (const CLID &clid)
 Remove converter object from conversion service (if present). More...
 
virtual StatusCode connectOutput (const std::string &outputFile, const std::string &openMode)
 Connect the output file to the service with open mode. More...
 
virtual StatusCode connectOutput (const std::string &outputFile)
 Connect the output file to the service. More...
 
virtual StatusCode commitOutput (const std::string &output, bool do_commit)
 Commit pending output. More...
 
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. More...
 
virtual StatusCode convertAddress (const IOpaqueAddress *pAddress, std::string &refAddress)
 Convert an address to string form. More...
 
virtual StatusCode createAddress (long svc_type, const CLID &clid, const std::string &refAddress, IOpaqueAddress *&refpAddress)
 Convert an address in string form to object form. More...
 
: IPersistencySvc implementation
virtual StatusCode addCnvService (IConversionSvc *service)
 Add a new Service. More...
 
virtual StatusCode removeCnvService (long type)
 Remove a Service. More...
 
virtual StatusCode setDefaultCnvService (long type)
 Set default service type. More...
 
virtual StatusCode getService (long service_type, IConversionSvc *&refpSvc)
 Retrieve conversion service identified by technology. More...
 
virtual StatusCode getService (const std::string &service_type, IConversionSvc *&refpSvc)
 Retrieve conversion service identified by technology. More...
 
: IService implementation
virtual StatusCode initialize ()
 Initialize the service. More...
 
virtual StatusCode finalize ()
 stop the service. More...
 
- Public Member Functions inherited from extends3< Service, IConversionSvc, IPersistencySvc, IAddressCreator >
 extends3 (A1 a1, A2 a2, A3 a3)
 Templated constructor with 3 arguments. More...
 
 extends3 (A1 a1, A2 a2)
 Templated constructor with 2 arguments. More...
 
 extends3 (A1 a1)
 Templated constructor with 1 argument. More...
 
 extends3 ()
 Default constructor. More...
 
virtual void * i_cast (const InterfaceID &tid) const
 Implementation of IInterface::i_cast. More...
 
virtual StatusCode queryInterface (const InterfaceID &ti, void **pp)
 Implementation of IInterface::queryInterface. More...
 
virtual std::vector< std::string > getInterfaceNames () const
 Implementation of IInterface::getInterfaceNames. More...
 
virtual ~extends3 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from Service
virtual unsigned long release ()
 Release Interface instance. More...
 
virtual const std::string & name () const
 Retrieve name of the service. More...
 
virtual StatusCode configure ()
 Configuration (from OFFLINE to CONFIGURED). More...
 
virtual StatusCode start ()
 Start (from INITIALIZED to RUNNING). More...
 
virtual StatusCode stop ()
 Stop (from RUNNING to INITIALIZED). More...
 
virtual StatusCode terminate ()
 Initialization (from CONFIGURED to OFFLINE). More...
 
virtual Gaudi::StateMachine::State FSMState () const
 Get the current state. More...
 
virtual Gaudi::StateMachine::State targetFSMState () const
 When we are in the middle of a transition, get the state where the transition is leading us. More...
 
virtual StatusCode reinitialize ()
 Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED). More...
 
virtual StatusCode restart ()
 Initialization (from RUNNING to RUNNING, via INITIALIZED). More...
 
virtual StatusCode sysInitialize ()
 Initialize Service. More...
 
virtual StatusCode sysStart ()
 Initialize Service. More...
 
virtual StatusCode sysStop ()
 Initialize Service. More...
 
virtual StatusCode sysFinalize ()
 Finalize Service. More...
 
virtual StatusCode sysReinitialize ()
 Re-initialize the Service. More...
 
virtual StatusCode sysRestart ()
 Re-initialize the Service. More...
 
virtual StatusCode setProperty (const Property &p)
 Set the property by property. More...
 
virtual StatusCode setProperty (const std::string &s)
 Set the property by string. More...
 
virtual StatusCode setProperty (const std::string &n, const std::string &v)
 Set the property by std::string. More...
 
virtual StatusCode getProperty (Property *p) const
 Get the property by property. More...
 
virtual const PropertygetProperty (const std::string &name) const
 Get the property by name. More...
 
virtual StatusCode getProperty (const std::string &n, std::string &v) const
 Get the property by std::string. More...
 
virtual const std::vector
< Property * > & 
getProperties () const
 Get list of properties. More...
 
template<class TYPE >
StatusCode setProperty (const std::string &name, const TYPE &value)
 set the property form the value More...
 
 Service (const std::string &name, ISvcLocator *svcloc)
 Standard Constructor. More...
 
SmartIF< ISvcLocator > & serviceLocator () const
 Retrieve pointer to service locator. More...
 
StatusCode setProperties ()
 Method for setting declared properties to the values specified for the job. More...
 
template<class T >
StatusCode service (const std::string &name, const T *&psvc, bool createIf=true) const
 Access a service by name, creating it if it doesn't already exist. More...
 
template<class T >
StatusCode service (const std::string &name, T *&psvc, bool createIf=true) const
 
template<class T >
StatusCode service (const std::string &svcType, const std::string &svcName, T *&psvc) const
 Access a service by name and type, creating it if it doesn't already exist. More...
 
template<class T >
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
 Declare the named property. More...
 
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
 Declare remote named properties. More...
 
SmartIF< IAuditorSvc > & auditorSvc () const
 The standard auditor service.May not be invoked before sysInitialize() has been invoked. More...
 
- 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. More...
 
 CommonMessaging (const A1 &a1, const A2 &a2)
 Templated constructor with 2 arguments. More...
 
 CommonMessaging (const A1 &a1)
 Templated constructor with 1 argument. More...
 
 CommonMessaging ()
 Default constructor. More...
 
virtual ~CommonMessaging ()
 Virtual destructor. More...
 
SmartIF< IMessageSvc > & msgSvc () const
 The standard message service. More...
 
MsgStreammsgStream () const
 Return an uninitialized MsgStream. More...
 
MsgStreammsgStream (const MSG::Level level) const
 Predefined configurable message stream for the efficient printouts. More...
 
MsgStreamalways () const
 shortcut for the method msgStream(MSG::ALWAYS) More...
 
MsgStreamfatal () const
 shortcut for the method msgStream(MSG::FATAL) More...
 
MsgStreamerr () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamerror () const
 shortcut for the method msgStream(MSG::ERROR) More...
 
MsgStreamwarning () const
 shortcut for the method msgStream(MSG::WARNING) More...
 
MsgStreaminfo () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MsgStreamdebug () const
 shortcut for the method msgStream(MSG::DEBUG) More...
 
MsgStreamverbose () const
 shortcut for the method msgStream(MSG::VERBOSE) More...
 
MsgStreammsg () const
 shortcut for the method msgStream(MSG::INFO) More...
 
MSG::Level msgLevel () const
 get the output level from the embedded MsgStream More...
 
bool msgLevel (MSG::Level lvl) const
 get the output level from the embedded MsgStream More...
 
- Public Member Functions inherited from extend_interfaces3< IService, IProperty, IStateful >
virtual ~extend_interfaces3 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IService
 DeclareInterfaceID (IService, 3, 0)
 InterfaceID. More...
 
virtual ~IService ()
 virtual destructor More...
 
- Public Member Functions inherited from INamedInterface
 DeclareInterfaceID (INamedInterface, 1, 0)
 InterfaceID. More...
 
virtual ~INamedInterface ()
 Virtual destructor (always needed for abstract classes). More...
 
- Public Member Functions inherited from IInterface
virtual unsigned long addRef ()=0
 Increment the reference count of Interface instance. More...
 
virtual unsigned long refCount () const =0
 Current reference count. More...
 
virtual ~IInterface ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IProperty
 DeclareInterfaceID (IProperty, 2, 0)
 InterfaceID. More...
 
- Public Member Functions inherited from IStateful
 DeclareInterfaceID (IStateful, 1, 0)
 InterfaceID. More...
 
virtual ~IStateful ()
 
- Public Member Functions inherited from extend_interfaces3< IConversionSvc, IPersistencySvc, IAddressCreator >
virtual ~extend_interfaces3 ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IConversionSvc
 DeclareInterfaceID (IConversionSvc, 4, 0)
 InterfaceID. More...
 
virtual ~IConversionSvc ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IConverter
 DeclareInterfaceID (IConverter, 3, 0)
 InterfaceID. More...
 
virtual ~IConverter ()
 Virtual destructor. More...
 
- Public Member Functions inherited from IPersistencySvc
 DeclareInterfaceID (IPersistencySvc, 2, 0)
 InterfaceID. More...
 
- Public Member Functions inherited from IAddressCreator
 DeclareInterfaceID (IAddressCreator, 3, 0)
 InterfaceID. More...
 

Protected Types

typedef std::map< long,
ServiceEntry
Services
 

Protected Member Functions

void svcNamesHandler (Property &theProp)
 Handlers for Service Names Property. More...
 
- Protected Member Functions inherited from Service
virtual ~Service ()
 Standard Destructor. More...
 
int outputLevel () const
 get the Service's output level More...
 
- Protected Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
void updateMsgStreamOutputLevel (int level)
 Update the output level of the cached MsgStream. More...
 

Protected Attributes

long m_cnvDefType
 Default service type. More...
 
SmartIF< IDataProviderSvcm_dataSvc
 Pointer to datma provider service. More...
 
Services m_cnvServices
 List of convermsion workers. More...
 
SmartIF< IConversionSvcm_cnvDefault
 Default output service. More...
 
StringArrayProperty m_svcNames
 Names of services to be requested from the service locator and added by default. More...
 
bool m_enable
 Flag to indicate that the service is enabled. More...
 
SmartIF< IAddressCreatorm_addrCreator
 Pointer to the IAddressCreator interface of this, for addressCreator(). More...
 
- Protected Attributes inherited from Service
IntegerProperty m_outputLevel
 Service output level. More...
 
Gaudi::StateMachine::State m_state
 Service state. More...
 
Gaudi::StateMachine::State m_targetState
 Service state. More...
 
- Protected Attributes inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
SmartIF< IMessageSvcm_msgsvc
 Pointer to the message service;. More...
 
std::auto_ptr< MsgStreamm_msgStream
 The predefined message stream. More...
 
bool m_streamWithService
 Flag to create a new MsgStream if it was created without the message service. More...
 

: Object implementation

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

Additional Inherited Members

- Public Types inherited from extends3< Service, IConversionSvc, IPersistencySvc, IAddressCreator >
typedef extends3 base_class
 Typedef to this class. More...
 
typedef extend_interfaces3
< IConversionSvc,
IPersistencySvc,
IAddressCreator
extend_interfaces_base
 Typedef to the base of this class. More...
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from Service
typedef
Gaudi::PluginService::Factory
< IService *, const
std::string &, ISvcLocator * > 
Factory
 
- Public Types inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
typedef CommonMessaging base_class
 
- Public Types inherited from implements3< IService, IProperty, IStateful >
typedef implements3 base_class
 Typedef to this class. More...
 
typedef extend_interfaces3
< IService, IProperty,
IStateful
extend_interfaces_base
 Typedef to the base of this class. More...
 
typedef
extend_interfaces_base::ext_iids 
interfaces
 MPL set of all the implemented interfaces. More...
 
- Public Types inherited from extend_interfaces3< IService, IProperty, IStateful >
typedef mpl::fold< typename
IService::iid::iids::type,
typename mpl::fold< typename
IProperty::iid::iids::type,
typename
IStateful::iid::iids::type,
mpl::insert< mpl::_1, mpl::_2 >
>::type, mpl::insert< mpl::_1,
mpl::_2 > >::type 
ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IInterface
enum  Status { SUCCESS = 1, NO_INTERFACE, VERSMISMATCH, LAST_ERROR }
 Return status. More...
 
typedef Gaudi::InterfaceId
< IInterface, 0, 0 > 
iid
 Interface ID. More...
 
typedef mpl::set1< iidext_iids
 Extra interfaces. More...
 
- Public Types inherited from extend_interfaces3< IConversionSvc, IPersistencySvc, IAddressCreator >
typedef mpl::fold< typename
IConversionSvc::iid::iids::type,
typename mpl::fold< typename
IPersistencySvc::iid::iids::type,
typename
IAddressCreator::iid::iids::type,
mpl::insert< mpl::_1, mpl::_2 >
>::type, mpl::insert< mpl::_1,
mpl::_2 > >::type 
ext_iids
 MPL set of interfaces extended by this one. More...
 
- Public Types inherited from IConversionSvc
enum  Status { CONVERSIONSVC_NO_ERROR = ICONVERSIONSVC_LAST_ERROR+1, NO_CONVERTER }
 Status code definitions. More...
 
- Public Types inherited from IConverter
enum  Status {
  INVALID_ADDRESS = IInterface::LAST_ERROR+1, INVALID_OBJECT, NO_MEMORY, BAD_STORAGE_TYPE,
  NO_SOURCE_OBJECT, ICONVERSIONSVC_LAST_ERROR
}
 Status code. More...
 
- Static Public Member Functions inherited from IInterface
static const InterfaceIDinterfaceID ()
 Return an instance of InterfaceID identifying the interface. More...
 

Detailed Description

PersistencySvc class implementation definition.

System: The LHCb Offline System

Package: PersistencySvc

Dependencies:

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

History:

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

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

625 : base_class(name, svc),
627  m_enable(true)
628 {
629  declareProperty("CnvServices", m_svcNames);
631 }
const long TEST_StorageType
Definition: ClassID.h:50
long m_cnvDefType
Default service type.
bool m_enable
Flag to indicate that the service is enabled.
StringArrayProperty m_svcNames
Names of services to be requested from the service locator and added by default.
virtual void declareUpdateHandler(PropertyCallbackFunctor *pf)
set new callback for update
Definition: Property.cpp:141
void svcNamesHandler(Property &theProp)
Handlers for Service Names Property.
virtual const std::string & name() const
Retrieve name of the service.
Definition: Service.cpp:331
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
Definition: Service.h:211
PersistencySvc::~PersistencySvc ( )
virtual

Standard Destructor.

Definition at line 634 of file PersistencySvc.cpp.

634  {
635 }

Member Function Documentation

StatusCode PersistencySvc::addCnvService ( IConversionSvc service)
virtual

Add a new Service.

Add data service.

Implements IPersistencySvc.

Definition at line 283 of file PersistencySvc.cpp.

283  {
284  if ( 0 != servc ) {
285  long type = servc->repSvcType();
286  long def_typ = (m_cnvDefault) ? m_cnvDefault->repSvcType() : 0;
287  Services::iterator it = m_cnvServices.find( type );
288  IConversionSvc* cnv_svc = 0;
289  if ( it != m_cnvServices.end() ) {
290  cnv_svc = (*it).second.conversionSvc();
291  }
292  if ( type == def_typ ) {
293  m_cnvDefault = servc;
294  }
295  if ( cnv_svc != servc ) {
296  IAddressCreator* icr = 0;
297  StatusCode status = servc->queryInterface(IAddressCreator::interfaceID(), pp_cast<void>(&icr));
298  if ( status.isSuccess() ) {
299  IService* isvc = 0;
300  status = servc->queryInterface(IService::interfaceID(), pp_cast<void>(&isvc));
301  if ( status.isSuccess() ) {
302  if ( 0 != cnv_svc ) {
303  removeCnvService (type).ignore();
304  }
305  std::pair<Services::iterator, bool> p =
306  m_cnvServices.insert( Services::value_type( type, ServiceEntry(type, isvc, servc, icr)));
307  if( p.second ) {
308  info() << "Added successfully Conversion service:" << isvc->name() << endmsg;
309  servc->addRef();
310  servc->setAddressCreator(this).ignore();
311  servc->setDataProvider(m_dataSvc).ignore();
312  return StatusCode::SUCCESS;
313  }
314  info() << "Cannot add Conversion service of type " << isvc->name() << endmsg;
315  isvc->release();
316  icr->release();
317  return StatusCode::FAILURE;
318  }
319  icr->release();
320  }
321  info() << "Cannot add Conversion service of type " << type << endmsg;
322  return StatusCode::FAILURE;
323  }
324  else {
325  return StatusCode::SUCCESS;
326  }
327  }
328  return BAD_STORAGE_TYPE;
329 }
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
virtual StatusCode removeCnvService(long type)
Remove a Service.
IAddressCreator interface definition.
virtual SmartIF< IConversionSvc > & conversionSvc() const =0
Get conversion service the converter is connected to.
Invalid storage type.
Definition: IConverter.h:211
virtual const std::string & name() const =0
Retrieve the name of the instance.
string type
Definition: gaudirun.py:126
General service interface definition.
Definition: IService.h:19
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
SmartIF< IConversionSvc > m_cnvDefault
Default output service.
virtual unsigned long release()=0
Release Interface instance.
Services m_cnvServices
List of convermsion workers.
void ignore() const
Definition: StatusCode.h:107
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
static const InterfaceID & interfaceID()
Return an instance of InterfaceID identifying the interface.
Definition: IInterface.h:171
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to datma provider service.
StatusCode PersistencySvc::addConverter ( IConverter pConverter)
virtual

Add converter object to conversion service.

Implements IConversionSvc.

Definition at line 208 of file PersistencySvc.cpp.

208  {
209  if ( 0 != pConverter ) {
210  long typ = pConverter->repSvcType();
211  IConversionSvc* svc = service(typ);
212  if ( 0 != svc ) {
213  return svc->addConverter(pConverter);
214  }
215  return BAD_STORAGE_TYPE;
216  }
217  return NO_CONVERTER;
218 }
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
virtual StatusCode addConverter(IConverter *pConverter)=0
Add converter object to conversion service.
Invalid storage type.
Definition: IConverter.h:211
virtual long repSvcType() const =0
Retrieve the class type of the data store the converter uses.
No proper converter is available to the service.
StatusCode PersistencySvc::addConverter ( const CLID clid)
virtual

Add converter object to conversion service.

Implements IConversionSvc.

Definition at line 203 of file PersistencySvc.cpp.

203  {
204  return StatusCode::FAILURE;
205 }
SmartIF< IAddressCreator > & PersistencySvc::addressCreator ( ) const
virtual

Retrieve address creator facility.

Implements IConverter.

Definition at line 503 of file PersistencySvc.cpp.

503  {
504  return m_addrCreator;
505 }
SmartIF< IAddressCreator > m_addrCreator
Pointer to the IAddressCreator interface of this, for addressCreator().
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.

160  {
161  long typ = type;
162  Services::iterator it = m_cnvServices.find( typ );
163  if( it == m_cnvServices.end() ) {
165  if ( s ) {
166  it = m_cnvServices.find( typ );
167  if ( it != m_cnvServices.end() ) {
168  return (*it).second.addrCreator();
169  }
170  }
171  static SmartIF<IAddressCreator> no_creator;
172  return no_creator;
173  }
174  return (*it).second.addrCreator();
175 }
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
string type
Definition: gaudirun.py:126
Services m_cnvServices
List of convermsion workers.
string s
Definition: gaudirun.py:210
StatusCode PersistencySvc::commitOutput ( const std::string &  output,
bool  do_commit 
)
virtual

Commit pending output.

Implements IConversionSvc.

Definition at line 367 of file PersistencySvc.cpp.

367  {
368  return StatusCode::SUCCESS;
369 }
StatusCode PersistencySvc::connectOutput ( const std::string &  outputFile,
const std::string &  openMode 
)
virtual

Connect the output file to the service with open mode.

Implements IConversionSvc.

Definition at line 356 of file PersistencySvc.cpp.

357  {
358  return connectOutput(outputFile);
359 }
virtual StatusCode connectOutput(const std::string &outputFile, const std::string &openMode)
Connect the output file to the service with open mode.
StatusCode PersistencySvc::connectOutput ( const std::string &  outputFile)
virtual

Connect the output file to the service.

Implements IConversionSvc.

Definition at line 362 of file PersistencySvc.cpp.

362  {
363  return StatusCode::SUCCESS;
364 }
SmartIF< IConversionSvc > & PersistencySvc::conversionSvc ( ) const
virtual

Get conversion service the converter is connected to.

Implements IConverter.

Definition at line 198 of file PersistencySvc.cpp.

198  {
199  return m_cnvDefault;
200 }
SmartIF< IConversionSvc > m_cnvDefault
Default output service.
StatusCode PersistencySvc::convertAddress ( const IOpaqueAddress pAddress,
std::string &  refAddress 
)
virtual

Convert an address to string form.

Implements IAddressCreator.

Definition at line 387 of file PersistencySvc.cpp.

389 {
390  // Assumuption is that the Persistency service prepends a header
391  // and requests the conversion service refered to by the service
392  // type to encode the rest
393  long svc_type = 0;
394  CLID clid = 0;
395  if ( 0 != pAddress ) {
396  svc_type = pAddress->svcType();
397  clid = pAddress->clID();
398  }
399  IAddressCreator* svc = addressCreator(svc_type);
400  StatusCode status = BAD_STORAGE_TYPE; // Preset error
401  refAddress = "";
402 
403  if ( 0 != svc ) {
404  // Found service, set header
405  encodeAddrHdr(svc_type, clid, refAddress);
406  std::string address;
407  // Get rest of address from conversion service
408  status = svc->convertAddress(pAddress, address);
409  refAddress += address;
410  }
411  return status;
412 }
IAddressCreator interface definition.
virtual long svcType() const =0
Retrieve service type.
Invalid storage type.
Definition: IConverter.h:211
virtual SmartIF< IAddressCreator > & addressCreator() const
Retrieve address creator facility.
virtual const CLID & clID() const =0
Retrieve class information from link.
void encodeAddrHdr(long service_type, const CLID &clid, std::string &address) const
Retrieve string from storage type and clid.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
unsigned int CLID
Class ID definition.
Definition: ClassID.h:9
virtual StatusCode convertAddress(const IOpaqueAddress *pAddress, std::string &refAddress)=0
Convert an address to string form.
IConverter * PersistencySvc::converter ( const CLID clid)
virtual

Retrieve converter from list.

Implements IConversionSvc.

Definition at line 234 of file PersistencySvc.cpp.

234  {
235  return 0;
236 }
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.

Implements IAddressCreator.

Definition at line 372 of file PersistencySvc.cpp.

376  {
377  IAddressCreator* svc = addressCreator(svc_type);
378  StatusCode status = BAD_STORAGE_TYPE; // Preset error
379  refpAddress = 0;
380  if ( 0 != svc ) {
381  status = svc->createAddress(svc_type, clid, pars, ipars, refpAddress);
382  }
383  return status;
384 }
virtual StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ipar, IOpaqueAddress *&refpAddress)=0
Create a Generic address using explicit arguments to identify a single object.
IAddressCreator interface definition.
Invalid storage type.
Definition: IConverter.h:211
virtual SmartIF< IAddressCreator > & addressCreator() const
Retrieve address creator facility.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
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.

Implements IAddressCreator.

Definition at line 415 of file PersistencySvc.cpp.

419 {
420  // Assumption is that the Persistency service decodes that header
421  // and requests the conversion service referred to by the service
422  // type to decode the rest
423  long new_svc_type = 0;
424  CLID new_clid = 0;
425  std::string address_trailer;
426  decodeAddrHdr(refAddress, new_svc_type, new_clid, address_trailer);
427  IAddressCreator* svc = addressCreator(new_svc_type);
428  StatusCode status = BAD_STORAGE_TYPE; // Preset error
429  if ( 0 != svc ) {
430  status = svc->createAddress( new_svc_type, new_clid, address_trailer, refpAddress);
431  }
432  return status;
433 }
virtual StatusCode createAddress(long svc_type, const CLID &clid, const std::string *par, const unsigned long *ipar, IOpaqueAddress *&refpAddress)=0
Create a Generic address using explicit arguments to identify a single object.
IAddressCreator interface definition.
Invalid storage type.
Definition: IConverter.h:211
virtual SmartIF< IAddressCreator > & addressCreator() const
Retrieve address creator facility.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
unsigned int CLID
Class ID definition.
Definition: ClassID.h:9
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 PersistencySvc::createObj ( IOpaqueAddress pAddress,
DataObject *&  refpObject 
)
virtual

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

Create the transient representation of an object.

Implements IConverter.

Definition at line 120 of file PersistencySvc.cpp.

120  {
121  return makeCall(CREATE_OBJ, pAddr, refpObj);
122 }
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
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.

Implements IConverter.

Reimplemented in HistogramPersistencySvc.

Definition at line 140 of file PersistencySvc.cpp.

140  {
141  return makeCall(CREATE_REP, refpAddr, pObj);
142 }
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
SmartIF< IDataProviderSvc > & PersistencySvc::dataProvider ( ) const
virtual

Access reference to transient datastore.

Access the dataprovider service.

Implements IConverter.

Definition at line 187 of file PersistencySvc.cpp.

187  {
188  return m_dataSvc;
189 }
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to datma provider service.
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.

453 {
454  // For address header, use xml-style format of
455  // <address_header service_type="xxx" clid="yyy" />
456  service_type = 0;
457  clid = 0;
458  address_trailer = "";
459 
460  // Check for address_header tag
461  size_t pos = address.find("<address_header");
462  if (std::string::npos != pos) {
463  // Get service_type
464  pos = address.find("service_type=\"");
465  if (std::string::npos != pos) {
466  pos += 14;
467  size_t end = address.find('"', pos);
468  if (std::string::npos != end) {
469  std::istringstream str(address.substr(pos, end-pos));
470  str >> service_type;
471  // Get clid
472  pos = address.find("clid=\"");
473  if (std::string::npos != pos) {
474  pos += 6;
475  end = address.find('\"', pos);
476  if (std::string::npos != end) {
477  str.clear(); // reuse the istringstream (the error flags must be explicitly cleared)
478  str.str(address.substr(pos, end-pos));
479  str >> clid;
480  // Get trailer_address
481  pos = address.find('>');
482  if (pos < (address.size()-2)) { // this means that '>' was found (pos != npos)
483  // it is before the last char
484  address_trailer = address.substr(pos+1);
485  }
486  }
487  }
488  }
489  }
490  }
491 }
tuple end
Definition: IOTest.py:101
bool PersistencySvc::enable ( bool  value)
protected

Set enabled flag.

Definition at line 616 of file PersistencySvc.cpp.

617 {
618  bool old = m_enable;
619  m_enable = value;
620  return old;
621 }
bool m_enable
Flag to indicate that the service is enabled.
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.

439 {
440  // For address header, use xml-style format of
441  // <addrhdr service_type="xxx" clid="yyy" />
442  std::stringstream stream;
443  int svctyp = service_type; // must put int into stream, not char
444  stream << "<address_header service_type=\"" << svctyp << "\" clid=\"" << clid << "\" /> ";
445  address = stream.str();
446 }
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.

Implements IConverter.

Definition at line 125 of file PersistencySvc.cpp.

125  {
126  return makeCall(FILL_OBJ_REFS, pAddr, pObj);
127 }
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
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.

Implements IConverter.

Definition at line 145 of file PersistencySvc.cpp.

145  {
146  return makeCall(FILL_REP_REFS, pAddr, pObj);
147 }
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
StatusCode PersistencySvc::finalize ( )
virtual

stop the service.

Reimplemented from Service.

Reimplemented in HistogramPersistencySvc, EvtPersistencySvc, and DetPersistencySvc.

Definition at line 603 of file PersistencySvc.cpp.

603  {
604  // Release all workers
605  m_cnvServices.clear();
606  // Release references to this to avoid loops
607  m_addrCreator = 0;
608  return StatusCode::SUCCESS;
609 }
SmartIF< IAddressCreator > m_addrCreator
Pointer to the IAddressCreator interface of this, for addressCreator().
Services m_cnvServices
List of convermsion workers.
StatusCode PersistencySvc::getService ( long  service_type,
IConversionSvc *&  refpSvc 
)
virtual

Retrieve conversion service identified by technology.

Implements IPersistencySvc.

Definition at line 508 of file PersistencySvc.cpp.

508  {
509  refpSvc = service(service_type);
510  return (0==refpSvc) ? StatusCode::FAILURE : StatusCode::SUCCESS;
511 }
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
StatusCode PersistencySvc::getService ( const std::string &  service_type,
IConversionSvc *&  refpSvc 
)
virtual

Retrieve conversion service identified by technology.

Implements IPersistencySvc.

Definition at line 514 of file PersistencySvc.cpp.

514  {
515  const char* imp = service_type.c_str();
516  long len = service_type.length();
517  if ( ::strncasecmp(imp,"SICB", len) == 0 )
518  return getService(SICB_StorageType, refpSvc);
519  else if ( ::strncasecmp(imp,"ZEBRA", len) == 0 )
520  return getService(SICB_StorageType, refpSvc);
521  else if ( ::strncasecmp(imp,"MS Access", len) == 0 )
522  return getService(ACCESS_StorageType, refpSvc);
523  else if ( ::strncasecmp(imp,"Microsoft Access", strlen("Microsoft Access")) == 0 )
524  return getService(ACCESS_StorageType, refpSvc);
525  else if ( ::strncasecmp(imp,"SQL Server", len) == 0 )
526  return getService(SQLSERVER_StorageType, refpSvc);
527  else if ( ::strncasecmp(imp,"Microsoft ODBC for Oracle", len) == 0 )
528  return getService(ORACLE_StorageType, refpSvc);
529  else if ( ::strncasecmp(imp,"Oracle ODBC", strlen("Oracle ODBC")) == 0 )
530  return getService(ORACLE_StorageType, refpSvc);
531  else if ( ::strncasecmp(imp,"Oracle OCI", strlen("Oracle OCI")) == 0 )
532  return getService(ORACLE_StorageType, refpSvc);
533  else if ( ::strncasecmp(imp,"MySQL", len) == 0 )
534  return getService(MYSQL_StorageType, refpSvc);
535  else if ( ::strncasecmp(imp,"ROOT", len) == 0 )
536  return getService(ROOT_StorageType, refpSvc);
537  else if ( ::strncasecmp(imp,"OBJY", len) == 0 )
538  return getService(OBJY_StorageType, refpSvc);
539  else if ( ::strncasecmp(imp,"OBJYECTI", 7) == 0 )
540  return getService(OBJY_StorageType, refpSvc);
541  else if ( ::strncasecmp(imp,"POOL_ROOTKEY", 12) == 0 )
542  return getService(POOL_ROOTKEY_StorageType, refpSvc);
543  else if ( ::strncasecmp(imp,"POOL_ROOTTREE", 12) == 0 )
544  return getService(POOL_ROOTTREE_StorageType, refpSvc);
545  else if ( ::strncasecmp(imp,"POOL_ROOT", 9) == 0 )
546  return getService(POOL_ROOT_StorageType, refpSvc);
547  else if ( ::strncasecmp(imp,"POOL_MySQL", 8) == 0 )
548  return getService(POOL_MYSQL_StorageType, refpSvc);
549  else if ( ::strncasecmp(imp,"POOL_ORACLE", 8) == 0 )
550  return getService(POOL_ORACLE_StorageType, refpSvc);
551  else if ( ::strncasecmp(imp,"POOL_ACCESS", 8) == 0 )
552  return getService(POOL_ACCESS_StorageType, refpSvc);
553  else if ( ::strncasecmp(imp,"POOL", 4) == 0 )
554  return getService(POOL_StorageType, refpSvc);
555 
556  for(Services::const_iterator i=m_cnvServices.begin(); i != m_cnvServices.end();++i) {
557  SmartIF<IService> svc((*i).second.conversionSvc());
558  if ( svc ) {
559  // Check wether this is already an active service: first check by service name
560  if ( svc->name() == service_type ) {
561  refpSvc = (*i).second.conversionSvc();
562  return StatusCode::SUCCESS;
563  }
564  // Check wether this is already an active service: now check by service type
565  if ( System::typeinfoName(typeid(*(svc.get()))) == service_type ) {
566  refpSvc = (*i).second.conversionSvc();
567  return StatusCode::SUCCESS;
568  }
569  }
570  }
571  const std::vector<std::string>& names = m_svcNames;
572  // if not, check if the service is in the list and may be requested
573  for(std::vector<std::string>::const_iterator i=names.begin(); i != names.end(); i++) {
575  if ( itm.name() == service_type || itm.type() == service_type ) {
576  IConversionSvc* svc = service(*i);
577  if ( svc ) {
578  refpSvc = svc;
579  return StatusCode::SUCCESS;
580  }
581  }
582  }
583  return StatusCode::FAILURE;
584 }
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
tuple itm
Definition: ana.py:57
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition: System.cpp:298
const long ACCESS_StorageType
Definition: ClassID.h:61
virtual SmartIF< IConversionSvc > & conversionSvc() const =0
Get conversion service the converter is connected to.
std::string names[100]
Definition: Node.cpp:19
StringArrayProperty m_svcNames
Names of services to be requested from the service locator and added by default.
const long MYSQL_StorageType
Definition: ClassID.h:65
const long POOL_MYSQL_StorageType
Definition: ClassID.h:73
virtual StatusCode getService(long service_type, IConversionSvc *&refpSvc)
Retrieve conversion service identified by technology.
const long POOL_ROOTKEY_StorageType
Definition: ClassID.h:70
const long POOL_ACCESS_StorageType
Definition: ClassID.h:72
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
const long POOL_ORACLE_StorageType
Definition: ClassID.h:74
const long ROOT_StorageType
Definition: ClassID.h:53
const long ORACLE_StorageType
Definition: ClassID.h:66
const long POOL_ROOT_StorageType
Definition: ClassID.h:69
const long POOL_StorageType
Definition: ClassID.h:68
const long POOL_ROOTTREE_StorageType
Definition: ClassID.h:71
Services m_cnvServices
List of convermsion workers.
const long SQLSERVER_StorageType
Definition: ClassID.h:64
const long OBJY_StorageType
Definition: ClassID.h:54
const long SICB_StorageType
Definition: ClassID.h:52
list i
Definition: ana.py:128
StatusCode PersistencySvc::initialize ( )
virtual

Initialize the service.

Reimplemented from Service.

Reimplemented in HistogramPersistencySvc, EvtPersistencySvc, and DetPersistencySvc.

Definition at line 592 of file PersistencySvc.cpp.

592  {
593  m_addrCreator = this; // initialize internal pointer to IAddressCreator interface
594  // Initialize basic service
595  StatusCode status = Service::initialize();
596  if ( UNLIKELY(!status.isSuccess()) ) {
597  error() << "Error initializing Service base class." << endmsg;
598  }
599  return status;
600 }
SmartIF< IAddressCreator > m_addrCreator
Pointer to the IAddressCreator interface of this, for addressCreator().
#define UNLIKELY(x)
Definition: Kernel.h:127
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual StatusCode initialize()
Initialization (from CONFIGURED to INITIALIZED).
Definition: Service.cpp:74
MsgStream & error() const
shortcut for the method msgStream(MSG::ERROR)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode PersistencySvc::makeCall ( int  typ,
IOpaqueAddress *&  pAddress,
DataObject *&  pObject 
)
protected

Implementation helper.

Definition at line 56 of file PersistencySvc.cpp.

58  {
59  if ( m_enable ) {
60  IConversionSvc* svc = 0;
61  switch(typ) {
62  case CREATE_REP:
63  case FILL_REP_REFS:
64  case UPDATE_REP:
65  case UPDATE_REP_REFS:
66  svc = m_cnvDefault;
67  break;
68  default:
69  if ( 0 != pAddress ) {
70  long svc_type = pAddress->svcType();
71  svc = service(svc_type);
72  if ( 0 == svc ) {
73  return BAD_STORAGE_TYPE;
74  }
75  }
76  else {
77  return INVALID_ADDRESS;
78  }
79  break;
80  }
81 
82  StatusCode status(StatusCode::FAILURE,true);
83  switch( typ ) {
84  case CREATE_OBJ:
85  pObject = 0;
86  status = svc->createObj(pAddress, pObject);
87  break;
88  case FILL_OBJ_REFS:
89  status = svc->fillObjRefs(pAddress, pObject);
90  break;
91  case UPDATE_OBJ:
92  status = svc->updateObj(pAddress, pObject);
93  break;
94  case UPDATE_OBJ_REFS:
95  status = svc->updateObjRefs(pAddress, pObject);
96  break;
97  case CREATE_REP:
98  status = svc->createRep(pObject, pAddress);
99  break;
100  case FILL_REP_REFS:
101  status = svc->fillRepRefs(pAddress, pObject);
102  break;
103  case UPDATE_REP:
104  status = svc->updateRep(pAddress, pObject);
105  break;
106  case UPDATE_REP_REFS:
107  status = svc->updateRepRefs(pAddress, pObject);
108  break;
109  default:
110  status = StatusCode::FAILURE;
111  break;
112  }
113  status.ignore();
114  return status;
115  }
116  return StatusCode::SUCCESS;
117 }
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
virtual StatusCode createObj(IOpaqueAddress *pAddress, DataObject *&refpObject)=0
Create the transient representation of an object.
Invalid address information.
Definition: IConverter.h:205
bool m_enable
Flag to indicate that the service is enabled.
virtual StatusCode createRep(DataObject *pObject, IOpaqueAddress *&refpAddress)=0
Convert the transient object to the requested representation.
virtual long svcType() const =0
Retrieve service type.
virtual StatusCode updateRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an already converted object.
Invalid storage type.
Definition: IConverter.h:211
virtual StatusCode updateObj(IOpaqueAddress *pAddress, DataObject *refpObject)=0
Update the transient object from the other representation.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual StatusCode updateObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the references of an updated transient object.
SmartIF< IConversionSvc > m_cnvDefault
Default output service.
virtual StatusCode updateRep(IOpaqueAddress *pAddress, DataObject *pObject)=0
Update the converted representation of a transient object.
virtual StatusCode fillObjRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the created transient object.
virtual StatusCode fillRepRefs(IOpaqueAddress *pAddress, DataObject *pObject)=0
Resolve the references of the converted object.
const CLID & PersistencySvc::objType ( ) const
virtual

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

Retrieve the class type of objects the converter produces.

Implements IConverter.

Definition at line 587 of file PersistencySvc.cpp.

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

Remove a Service.

Remove conversion service.

Implements IPersistencySvc.

Definition at line 332 of file PersistencySvc.cpp.

332  {
333  Services::iterator it = m_cnvServices.find( svctype );
334  if( it != m_cnvServices.end() ) {
335  (*it).second.service()->release();
336  (*it).second.addrCreator()->release();
337  m_cnvServices.erase(it);
338  return StatusCode::SUCCESS;
339  }
340  return BAD_STORAGE_TYPE;
341 }
Invalid storage type.
Definition: IConverter.h:211
Services m_cnvServices
List of convermsion workers.
StatusCode PersistencySvc::removeConverter ( const CLID clid)
virtual

Remove converter object from conversion service (if present).

Implements IConversionSvc.

Definition at line 221 of file PersistencySvc.cpp.

221  {
222  // Remove converter type from all services
224  for ( Services::iterator i = m_cnvServices.begin(); i != m_cnvServices.end(); i++ ) {
225  iret = (*i).second.conversionSvc()->removeConverter(clid);
226  if ( iret.isSuccess() ) {
227  status = iret;
228  }
229  }
230  return status;
231 }
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
No proper converter is available to the service.
Services m_cnvServices
List of convermsion workers.
list i
Definition: ana.py:128
long PersistencySvc::repSvcType ( ) const
virtual

Return default service type.

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

Implements IConverter.

Definition at line 344 of file PersistencySvc.cpp.

344  {
345  long typ = (m_cnvDefault) ? m_cnvDefault->repSvcType() : 0;
346  return typ;
347 }
SmartIF< IConversionSvc > m_cnvDefault
Default output service.
SmartIF< IConversionSvc > & PersistencySvc::service ( const std::string &  nam)
protected

Retrieve conversion service by name.

Definition at line 239 of file PersistencySvc.cpp.

239  {
241  IConversionSvc* svc = 0;
242  for ( Services::iterator it = m_cnvServices.begin(); it != m_cnvServices.end(); it++ ) {
243  if ( (*it).second.service()->name() == tn.name() ) {
244  return (*it).second.conversionSvc();
245  }
246  }
247  StatusCode status = Service::service(nam, svc, true);
248  if ( status.isSuccess() ) {
249  if ( addCnvService(svc).isSuccess() ) {
250  svc->release(); // Do not double-reference count
251  return service(nam); // now it is in the list
252  }
253  }
254  info() << "Cannot access Conversion service:" << nam << endmsg;
255  static SmartIF<IConversionSvc> no_svc;
256  return no_svc;
257 }
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
bool isSuccess() const
Test for a status code of SUCCESS.
Definition: StatusCode.h:75
virtual StatusCode addCnvService(IConversionSvc *service)
Add a new Service.
virtual SmartIF< IConversionSvc > & conversionSvc() const =0
Get conversion service the converter is connected to.
Helper class to parse a string of format "type/name".
Definition: TypeNameString.h:9
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
virtual unsigned long release()=0
Release Interface instance.
Services m_cnvServices
List of convermsion workers.
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.
Definition: Service.h:142
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
SmartIF< IConversionSvc > & PersistencySvc::service ( long  service_type)
protected

Retrieve conversion service from list.

Definition at line 260 of file PersistencySvc.cpp.

260  {
261  typedef std::vector<std::string> SvcNames;
262  // Check wether this is already an active service
263  Services::iterator it = m_cnvServices.find( type );
264  if( it != m_cnvServices.end() ) {
265  return (*it).second.conversionSvc();
266  }
267  // if not, check if the service is in the list and may be requested
268  const SvcNames& theNames = m_svcNames.value();
269  for ( SvcNames::const_iterator i = theNames.begin(); i != theNames.end(); i++ ) {
271  if ( svc != 0 ) {
272  long typ = svc->repSvcType();
273  if ( typ == type ) {
274  return svc;
275  }
276  }
277  }
278  static SmartIF<IConversionSvc> no_svc;
279  return no_svc;
280 }
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
StringArrayProperty m_svcNames
Names of services to be requested from the service locator and added by default.
string type
Definition: gaudirun.py:126
const TYPE & value() const
explicit conversion
Definition: Property.h:355
Services m_cnvServices
List of convermsion workers.
list i
Definition: ana.py:128
StatusCode PersistencySvc::setAddressCreator ( IAddressCreator creator)
virtual

Set address creator facility.

Implements IConverter.

Definition at line 494 of file PersistencySvc.cpp.

494  {
495  // The persistency service is a address creation dispatcher istelf.
496  // The persistency service can NEVER create addresses itself.
497  // The entry point must only be provided in order to fulfill the needs of the
498  // implementing interfaces.
499  return StatusCode::FAILURE;
500 }
StatusCode PersistencySvc::setConversionSvc ( IConversionSvc svc)
virtual

Set conversion service the converter is connected to.

Implements IConverter.

Definition at line 192 of file PersistencySvc.cpp.

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

Define transient datastore.

Define transient data store.

Implements IConverter.

Definition at line 178 of file PersistencySvc.cpp.

178  {
179  m_dataSvc = pDataSvc;
180  for ( Services::iterator i = m_cnvServices.begin(); i != m_cnvServices.end(); i++ ) {
181  (*i).second.conversionSvc()->setDataProvider(m_dataSvc).ignore();
182  }
183  return StatusCode(StatusCode::SUCCESS,true);
184 }
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:30
Services m_cnvServices
List of convermsion workers.
list i
Definition: ana.py:128
SmartIF< IDataProviderSvc > m_dataSvc
Pointer to datma provider service.
StatusCode PersistencySvc::setDefaultCnvService ( long  type)
virtual

Set default service type.

Set default conversion service.

Implements IPersistencySvc.

Definition at line 350 of file PersistencySvc.cpp.

350  {
352  return StatusCode::SUCCESS;
353 }
SmartIF< IConversionSvc > & service(const std::string &nam)
Retrieve conversion service by name.
string type
Definition: gaudirun.py:126
SmartIF< IConversionSvc > m_cnvDefault
Default output service.
void PersistencySvc::svcNamesHandler ( Property theProp)
protected

Handlers for Service Names Property.

Definition at line 611 of file PersistencySvc.cpp.

611  {
612  DEBMSG << p << endmsg;
613 }
#define DEBMSG
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition: MsgStream.h:244
StatusCode PersistencySvc::updateObj ( IOpaqueAddress pAddress,
DataObject refpObject 
)
virtual

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

Update the transient object from the other representation.

Implements IConverter.

Definition at line 130 of file PersistencySvc.cpp.

130  {
131  return makeCall(UPDATE_OBJ, pAddr, pObj);
132 }
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
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.

Implements IConverter.

Definition at line 135 of file PersistencySvc.cpp.

135  {
136  return makeCall(UPDATE_OBJ_REFS, pAddr, pObj);
137 }
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
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.

Implements IConverter.

Definition at line 150 of file PersistencySvc.cpp.

150  {
151  return makeCall(UPDATE_REP, pAddr, pObj);
152 }
StatusCode makeCall(int typ, IOpaqueAddress *&pAddress, DataObject *&pObject)
Implementation helper.
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.

Implements IConverter.

Definition at line 155 of file PersistencySvc.cpp.

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

Member Data Documentation

SmartIF<IAddressCreator> PersistencySvc::m_addrCreator
mutableprotected

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

Definition at line 289 of file PersistencySvc.h.

SmartIF<IConversionSvc> PersistencySvc::m_cnvDefault
mutableprotected

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
mutableprotected

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: