| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

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

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

Data service base class. More...

`#include <GaudiKernel/DataSvc.h>`

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

## Public Types
typedef std::vector < DataStoreItem > | LoadItems
| Define set of load items.
Public Types inherited from extends2< Service, IDataProviderSvc, IDataManagerSvc >
typedef extends2 | base_class
| Typedef to this class.
typedef extend_interfaces2 < IDataProviderSvc, IDataManagerSvc > | extend_interfaces_base
| Typedef to the base of this class.
typedef extend_interfaces_base::ext_iids | interfaces
| MPL set of all the implemented interfaces.
Public Types inherited from Service
typedef Gaudi::PluginService::Factory2 < 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.
typedef extend_interfaces3 < IService, IProperty, IStateful > | extend_interfaces_base
| Typedef to the base of this class.
typedef extend_interfaces_base::ext_iids | interfaces
| MPL set of all the implemented interfaces.
Public Types inherited from extend_interfaces3< I1, I2, I3 >
typedef mpl::fold< typename I1::iid::iids::type, typename mpl::fold< typename I2::iid::iids::type, typename I3::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.
Public Types inherited from extend_interfaces2< I1, I2 >
typedef mpl::fold< typename I1::iid::iids::type, typename I2::iid::iids::type, mpl::insert< mpl::_1, mpl::_2 > >::type | ext_iids
| MPL set of interfaces extended by this one.

## Public Member Functions
virtual CLID | rootCLID () const
| IDataManagerSvc: Accessor for root event CLID.
virtual std::string | rootName () const
| IDataManagerSvc: Accessor for root event name.
virtual StatusCode | registerAddress (const std::string &fullPath, IOpaqueAddress *pAddress)
| IDataManagerSvc: Register object address with the data store.
virtual StatusCode | registerAddress (DataObject *parentObj, const std::string &objectPath, IOpaqueAddress *pAddress)
| IDataManagerSvc: Register object address with the data store.
virtual StatusCode | registerAddress (IRegistry *parentObj, const std::string &objectPath, IOpaqueAddress *pAddress)
| IDataManagerSvc: Register object address with the data store.
virtual StatusCode | unregisterAddress (const std::string &fullPath)
| IDataManagerSvc: Unregister object address from the data store.
virtual StatusCode | unregisterAddress (DataObject *pParent, const std::string &objPath)
| IDataManagerSvc: Unregister object address from the data store.
virtual StatusCode | unregisterAddress (IRegistry *pParent, const std::string &objPath)
| IDataManagerSvc: Unregister object address from the data store.
virtual StatusCode | objectLeaves (const DataObject *pObject, std::vector< IRegistry * > &refLeaves)
| IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.
virtual StatusCode | objectLeaves (const IRegistry *pRegistry, std::vector< IRegistry * > &refLeaves)
| IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.
virtual StatusCode | objectParent (const DataObject *pObject, IRegistry *&refpParent)
| IDataManagerSvc: Explore the object store: retrieve the object's parent.
virtual StatusCode | objectParent (const IRegistry *pRegistry, IRegistry *&refpParent)
| IDataManagerSvc: Explore the object store: retrieve the object's parent.
virtual StatusCode | clearSubTree (const std::string &sub_tree_path)
| IDataManagerSvc: Remove all data objects below the sub tree identified by its full path name.
virtual StatusCode | clearSubTree (DataObject *pObject)
| IDataManagerSvc: Remove all data objects below the sub tree identified by the object.
virtual StatusCode | clearStore ()
| IDataManagerSvc: Remove all data objects in the data store.
virtual StatusCode | traverseSubTree (const std::string &sub_tree_path, IDataStoreAgent *pAgent)
| IDataManagerSvc: Analyze by traversing all data objects below the sub tree identified by its full path name.
virtual StatusCode | traverseSubTree (DataObject *pObject, IDataStoreAgent *pAgent)
| IDataManagerSvc: Analyze by traversing all data objects below the sub tree.
virtual StatusCode | traverseTree (IDataStoreAgent *pAgent)
| IDataManagerSvc: Analyze by traversing all data objects in the data store.
virtual StatusCode | setRoot (const std::string &root_name, DataObject *pRootObj)
| Initialize data store for new event by giving new event path and root object.
virtual StatusCode | i_setRoot (const std::string &root_name, DataObject *pRootObj)
| Initialize data store for new event by giving new event path and root object.
virtual StatusCode | setRoot (const std::string &root_path, IOpaqueAddress *pRootAddr)
| Initialize data store for new event by giving new event path and address of root object.
virtual StatusCode | i_setRoot (const std::string &root_path, IOpaqueAddress *pRootAddr)
| Initialize data store for new event by giving new event path and address of root object.
virtual StatusCode | setDataLoader (IConversionSvc *svc)
| IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service.
virtual StatusCode | addPreLoadItem (const DataStoreItem &item)
| Add an item to the preload list.
virtual StatusCode | addPreLoadItem (const std::string &itemPath)
| Add an item to the preload list.
virtual StatusCode | removePreLoadItem (const DataStoreItem &item)
| Remove an item from the preload list.
virtual StatusCode | removePreLoadItem (const std::string &itemPath)
| Add an item to the preload list.
virtual StatusCode | resetPreLoad ()
| Clear the preload list.
virtual StatusCode | preLoad (int depth, int load_depth, DataObject *pObject)
| Execute one level of preloading and recursively load until the final level is reached.
virtual StatusCode | preLoad ()
| load all preload items of the list
virtual StatusCode | registerObject (const std::string &fullPath, DataObject *pObject)
| Register object with the data store.
virtual StatusCode | registerObject (const std::string &parentPath, const std::string &objPath, DataObject *pObject)
| Register object with the data store.
virtual StatusCode | registerObject (const std::string &parentPath, int item, DataObject *pObject)
| Register object with the data store.
virtual StatusCode | registerObject (DataObject *parentObj, const std::string &objPath, DataObject *pObject)
| Register object with the data store.
virtual StatusCode | registerObject (DataObject *parentObj, int item, DataObject *pObject)
| Register object with the data store.
virtual StatusCode | unregisterObject (const std::string &fullPath)
| Unregister object from the data store.
virtual StatusCode | unregisterObject (const std::string &parentPath, const std::string &objectPath)
| Unregister object from the data store.
virtual StatusCode | unregisterObject (const std::string &parentPath, int item)
| Unregister object from the data store.
virtual StatusCode | unregisterObject (DataObject *pObject)
| Unregister object from the data store.
virtual StatusCode | unregisterObject (DataObject *pObject, const std::string &objectPath)
| Unregister object from the data store.
virtual StatusCode | unregisterObject (DataObject *pObject, int item)
| Unregister object from the data store.
virtual StatusCode | retrieveObject (IRegistry *pDirectory, const std::string &path, DataObject *&pObject)
| Retrieve object from data store.
virtual StatusCode | retrieveObject (const std::string &fullPath, DataObject *&pObject)
| Retrieve object identified by its full path from the data store.
virtual StatusCode | retrieveObject (const std::string &parentPath, const std::string &objPath, DataObject *&pObject)
| Retrieve object from data store.
virtual StatusCode | retrieveObject (const std::string &parentPath, int item, DataObject *&pObject)
| Retrieve object from data store.
virtual StatusCode | retrieveObject (DataObject *parentObj, const std::string &objPath, DataObject *&pObject)
| Retrieve object from data store.
virtual StatusCode | retrieveObject (DataObject *parentObj, int item, DataObject *&pObject)
| Retrieve object from data store.
virtual StatusCode | findObject (const std::string &fullPath, DataObject *&pObject)
| Find object identified by its full path in the data store.
virtual StatusCode | findObject (IRegistry *pDirectory, const std::string &path, DataObject *&pObject)
| Find object identified by its full path in the data store.
virtual StatusCode | findObject (const std::string &parentPath, const std::string &objPath, DataObject *&pObject)
| Find object in the data store.
virtual StatusCode | findObject (const std::string &parentPath, int item, DataObject *&pObject)
| Find object in the data store.
virtual StatusCode | findObject (DataObject *parentObj, const std::string &objPath, DataObject *&pObject)
| Find object in the data store.
virtual StatusCode | findObject (DataObject *parentObj, int item, DataObject *&pObject)
| Find object in the data store.
virtual StatusCode | linkObject (IRegistry *from, const std::string &objPath, DataObject *to)
| Add a link to another object.
virtual StatusCode | linkObject (const std::string &fromPath, const std::string &objPath, DataObject *to)
| Add a link to another object.
virtual StatusCode | linkObject (DataObject *from, const std::string &objPath, DataObject *to)
| Add a link to another object.
virtual StatusCode | linkObject (const std::string &fullPath, DataObject *to)
| Add a link to another object.
virtual StatusCode | unlinkObject (IRegistry *from, const std::string &objPath)
| Remove a link to another object.
virtual StatusCode | unlinkObject (const std::string &fromPath, const std::string &objPath)
| Remove a link to another object.
virtual StatusCode | unlinkObject (DataObject *fromObj, const std::string &objPath)
| Remove a link to another object.
virtual StatusCode | unlinkObject (const std::string &fullPath)
| Remove a link to another object.
virtual StatusCode | updateObject (IRegistry *pDirectory)
| Update object identified by its directory entry.
virtual StatusCode | updateObject (const std::string &updatePath)
| Update object.
virtual StatusCode | updateObject (DataObject *toUpdate)
| Update object.
virtual StatusCode | updateObject (const std::string &parentPath, const std::string &updatePath)
| Update object.
virtual StatusCode | updateObject (DataObject *pParent, const std::string &updatePath)
| Update object.
virtual StatusCode | initialize ()
| Service initialization.
virtual StatusCode | reinitialize ()
| Service initialization.
virtual StatusCode | finalize ()
| Service initialization.
| DataSvc (const std::string &name, ISvcLocator *svc)
| Standard Constructor.
virtual | ~DataSvc ()
| Standard Destructor.
Public Member Functions inherited from extends2< Service, IDataProviderSvc, IDataManagerSvc >
| extends2 (A1 a1, A2 a2, A3 a3)
| Templated constructor with 3 arguments.
| extends2 (A1 a1, A2 a2)
| Templated constructor with 2 arguments.
| extends2 (A1 a1)
| Templated constructor with 1 argument.
| extends2 ()
| Default constructor.
virtual void * | i_cast (const InterfaceID &tid) const
| Implementation of IInterface::i_cast.
virtual StatusCode | queryInterface (const InterfaceID &ti, void **pp)
| Implementation of IInterface::queryInterface.
virtual std::vector< std::string > | getInterfaceNames () const
| Implementation of IInterface::getInterfaceNames.
virtual | ~extends2 ()
| Virtual destructor.
Public Member Functions inherited from Service
virtual unsigned long | release ()
| Release Interface instance.
virtual const std::string & | name () const
| Retrieve name of the service.
virtual StatusCode | configure ()
virtual StatusCode | start ()
virtual StatusCode | stop ()
virtual StatusCode | terminate ()
virtual Gaudi::StateMachine::State | FSMState () const
virtual Gaudi::StateMachine::State | targetFSMState () const
virtual StatusCode | restart ()
virtual StatusCode | sysInitialize ()
| Initialize Service.
virtual StatusCode | sysStart ()
| Initialize Service.
virtual StatusCode | sysStop ()
| Initialize Service.
virtual StatusCode | sysFinalize ()
| Finalize Service.
virtual StatusCode | sysReinitialize ()
| Re-initialize the Service.
virtual StatusCode | sysRestart ()
| Re-initialize the Service.
virtual StatusCode | setProperty (const Property &p)
virtual StatusCode | setProperty (const std::string &s)
virtual StatusCode | setProperty (const std::string &n, const std::string &v)
virtual StatusCode | getProperty (Property *p) const
virtual const Property & | getProperty (const std::string &name) const
virtual StatusCode | getProperty (const std::string &n, std::string &v) const
virtual const std::vector < Property * > & | getProperties () const
template<class TYPE >
StatusCode | setProperty (const std::string &name, const TYPE &value)
| set the property form the value
| Service (const std::string &name, ISvcLocator *svcloc)
| Standard Constructor.
SmartIF< ISvcLocator > & | serviceLocator () const
| Retrieve pointer to service locator.
StatusCode | setProperties ()
| Method for setting declared properties to the values specified for the job.
template<class T >
StatusCode | service (const std::string &name, const T *&psvc, bool createIf=true) const
| Access a service by name, creating it if it doesn't already exist.
template<class T >
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const
template<class T >
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const
| Access a service by name and type, creating it if it doesn't already exist.
template<class T >
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const
| Declare the named property.
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
| Declare remote named properties.
SmartIF< IAuditorSvc > & | auditorSvc () const
| The standard auditor service.May not be invoked before sysInitialize() has been invoked.
Public Member Functions inherited from CommonMessaging< implements3< IService, IProperty, IStateful > >
| CommonMessaging (const A1 &a1, const A2 &a2, const A3 &a3)
| Templated constructor with 3 arguments.
| CommonMessaging (const A1 &a1, const A2 &a2)
| Templated constructor with 2 arguments.
| CommonMessaging (const A1 &a1)
| Templated constructor with 1 argument.
| CommonMessaging ()
| Default constructor.
virtual | ~CommonMessaging ()
| Virtual destructor.
SmartIF< IMessageSvc > & | msgSvc () const
| The standard message service.
MsgStream & | msgStream () const
| Return an uninitialized MsgStream.
MsgStream & | msgStream (const MSG::Level level) const
| Predefined configurable message stream for the efficient printouts.
MsgStream & | always () const
| shortcut for the method msgStream(MSG::ALWAYS)
MsgStream & | fatal () const
| shortcut for the method msgStream(MSG::FATAL)
MsgStream & | err () const
| shortcut for the method msgStream(MSG::ERROR)
MsgStream & | error () const
| shortcut for the method msgStream(MSG::ERROR)
MsgStream & | warning () const
| shortcut for the method msgStream(MSG::WARNING)
MsgStream & | info () const
| shortcut for the method msgStream(MSG::INFO)
MsgStream & | debug () const
| shortcut for the method msgStream(MSG::DEBUG)
MsgStream & | verbose () const
| shortcut for the method msgStream(MSG::VERBOSE)
MsgStream & | msg () const
| shortcut for the method msgStream(MSG::INFO)
MSG::Level | msgLevel () const
| get the output level from the embedded MsgStream
bool | msgLevel (MSG::Level lvl) const
| get the output level from the embedded MsgStream
Public Member Functions inherited from extend_interfaces2< I1, I2 >
virtual | ~extend_interfaces2 ()
| Virtual destructor.

## Protected Member Functions
bool | checkRoot ()
| Check if root path is valid.
virtual IConversionSvc * | getDataLoader (IRegistry *pReg)
| Retrieve customizable data loader according to registry entry to be retrieved.
virtual DataObject * | createDefaultObject () const
| Create default objects in case forced creation of leaves is requested.
virtual StatusCode | loadObject (IRegistry *pNode)
| Invoke Persistency service to create transient object from its persistent representation.
virtual StatusCode | loadObject (IConversionSvc *pLoader, IRegistry *pNode)
| Invoke Persistency service to create transient object from its persistent representation.
StatusCode | retrieveEntry (DataSvcHelpers::RegistryEntry *pNode, const std::string &path, DataSvcHelpers::RegistryEntry *&pEntry)
| Retrieve registry entry from store.
DataObject * | handleDataFault (IRegistry *pReg, const std::string &path="")
| Invoke data fault handling if enabled.

## Protected Attributes
CLID | m_rootCLID
| Integer Property corresponding to CLID of root entry.
std::string | m_rootName
| Name of root event.
IConversionSvc * | m_dataLoader
| Pointer to data loader service.
IIncidentSvc * | m_incidentSvc
| Pointer to incident service.
LoadItems | m_preLoads
| Items to be pre-loaded.
bool | m_forceLeaves
| Allow forced creation of default leaves on registerObject.
bool | m_enableAccessHdlr
| Flag to enable interrupts on data access requests.
bool | m_enableFaultHdlr
| Flag to enable interrupts on data creation requests.
DataSvcHelpers::RegistryEntry * | m_root
| Pointer to root entry.
DataSvcHelpers::InhibitMap * | m_inhibitMap
| Map with object paths to be inhibited from loading.
std::vector< std::string > | m_inhibitPathes
| Property for the inhibited leaves.
std::string | m_accessName
| Name of the data access incident.
std::string | m_faultName
| Name of the data fault incident.

## Private Member Functions
| DataSvc (const DataSvc &)
| Fake copy constructor (never implemented).
DataSvc & | operator= (const DataSvc &)
| Fake assignment operator (never implemented).

## Detailed Description

Data service base class.

A data service manages the transient data stores and implements the IDataProviderSvc and IDataManagerSvc interfaces.

Author
  Markus Frank
  Sebastien Ponce

Version
  1.0

Definition at line 39 of file DataSvc.h.

## Member Typedef Documentation

typedef std::vector<DataStoreItem> DataSvc::LoadItems

Define set of load items.

Definition at line 43 of file DataSvc.h.

## Constructor & Destructor Documentation

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

Standard Constructor.

Definition at line 1371 of file DataSvc.cpp.

: base_class(name,svc), m_rootCLID( /*CLID_Event*/ 110),
m_rootName( "/Event"), m_root(0)
{
m_dataLoader = 0;
m_inhibitMap = 0;
m_incidentSvc = 0;
m_forceLeaves = false;
m_enableFaultHdlr = false;
m_enableAccessHdlr = false;
m_faultName = "DataFault";
m_accessName = "DataAccess";
declareProperty("RootCLID", m_rootCLID);
declareProperty("RootName", m_rootName);
declareProperty("ForceLeaves", m_forceLeaves);
declareProperty("InhibitPathes", m_inhibitPathes);
declareProperty("DataFaultName", m_faultName);
declareProperty("DataAccessName", m_accessName);
declareProperty("EnableFaultHandler", m_enableFaultHdlr);
declareProperty("EnableAccessHandler", m_enableAccessHdlr);
}

DataSvc::~DataSvc | ( |  | ) |
| virtual

Standard Destructor.

Definition at line 1394 of file DataSvc.cpp.

{
setDataLoader(0).ignore();
resetPreLoad().ignore();
clearStore().ignore();
}

DataSvc::DataSvc | ( | const DataSvc & |  | ) |
| private

Fake copy constructor (never implemented).

## Member Function Documentation

StatusCode DataSvc::addPreLoadItem | ( | const DataStoreItem & | item | ) |
| virtual

Add an item to the preload list.

Definition at line 1229 of file DataSvc.cpp.

{
LoadItems::iterator i = std::find(m_preLoads.begin(), m_preLoads.end(), item);
if ( i == m_preLoads.end() ) {
m_preLoads.push_back(item);
}
return StatusCode::SUCCESS;
}

StatusCode DataSvc::addPreLoadItem | ( | const std::string & | itemPath | ) |
| virtual

Add an item to the preload list.

Definition at line 1238 of file DataSvc.cpp.

{
return addPreLoadItem( DataStoreItem(itemPath,1) );
}

bool DataSvc::checkRoot | ( |  | ) |
| inline protected

Check if root path is valid.

Definition at line 384 of file DataSvc.h.

{
return 0 != m_root;
}

StatusCode DataSvc::clearStore | ( |  | ) |
| virtual

IDataManagerSvc: Remove all data objects in the data store.

Reimplemented in DetDataSvc.

Definition at line 108 of file DataSvc.cpp.

{
if ( checkRoot() ) {
m_root->release();
m_root = 0;
return SUCCESS;
}
return INVALID_ROOT;
}

StatusCode DataSvc::clearSubTree | ( | const std::string & | sub_tree_path | ) |
| virtual

IDataManagerSvc: Remove all data objects below the sub tree identified by its full path name.

Definition at line 70 of file DataSvc.cpp.

{
DataObject* pObject = 0;
StatusCode status = findObject(sub_tree_path, pObject);
if ( status.isSuccess() ) {
RegEntry* node_entry = CAST_REGENTRY(RegEntry*,pObject->registry());
if ( 0 != node_entry ) {
RegEntry* parent = node_entry->parentEntry();
if ( 0 != parent ) {
parent->remove(node_entry);
return StatusCode::SUCCESS;
}
return INVALID_PARENT;
}
return INVALID_OBJECT;
}
return status;
}

StatusCode DataSvc::clearSubTree | ( | DataObject * | pObject | ) |
| virtual

IDataManagerSvc: Remove all data objects below the sub tree identified by the object.

Definition at line 91 of file DataSvc.cpp.

{
if ( checkRoot() ) {
RegEntry* entry = CAST_REGENTRY(RegEntry*,pObject->registry());
if ( 0 != entry ) {
RegEntry* parent = entry->parentEntry();
if ( 0 != parent ) {
parent->remove(entry);
return SUCCESS;
}
return INVALID_PARENT;
}
return INVALID_OBJECT;
}
return INVALID_ROOT;
}

DataObject * DataSvc::createDefaultObject | ( |  | ) | const
| protected virtual

Create default objects in case forced creation of leaves is requested.

Definition at line 1359 of file DataSvc.cpp.

{
return new DataObject();
}

StatusCode DataSvc::finalize | ( |  | ) |
| virtual

Service initialization.

Service initialisation.

Reimplemented from Service.

Reimplemented in HistogramSvc, NTupleSvc, DetDataSvc, TagCollectionSvc, RecordDataSvc, and EvtDataSvc.

Definition at line 1336 of file DataSvc.cpp.

{
// Nothing to do: just call base class initialisation
setDataLoader(0).ignore();
resetPreLoad().ignore();
clearStore().ignore();
if ( m_incidentSvc ) {
m_incidentSvc->release();
m_incidentSvc = 0;
}
return Service::finalize();
}

StatusCode DataSvc::findObject | ( | const std::string & | fullPath,
|  | DataObject *& | pObject
| ) |  |
| virtual

Find object identified by its full path in the data store.

Definition at line 937 of file DataSvc.cpp.

{
pObject = 0;
if ( checkRoot() ) {
if ( path.length() == 0 || path == m_rootName ) {
pObject = m_root->object();
return (0 == pObject) ? OBJ_NOT_LOADED : IDataProviderSvc_NO_ERROR;
}
else if ( path[0] != SEPARATOR ) {
return findObject(m_rootName, path, pObject);
}
return findObject((IRegistry*)0, path, pObject);
}
return INVALID_ROOT;
}

StatusCode DataSvc::findObject | ( | IRegistry * | pDirectory,
|  | const std::string & | path,
|  | DataObject *& | pObject
| ) |  |
| virtual

Find object identified by its full path in the data store.

Retrieve object identified by its directory from the data store.

Definition at line 918 of file DataSvc.cpp.

{
pObject = 0;
IRegistry* pReg = (0==pRegistry) ? m_root : pRegistry;
RegEntry* root_entry = CAST_REGENTRY(RegEntry*, pReg);
if ( 0 != root_entry ) {
if ( path.length() > 0 ) {
pReg = root_entry->find(path);
}
if ( 0 == pReg ) {
return INVALID_OBJ_PATH;
}
pObject = pReg->object();
}
return (0 == pObject) ? OBJ_NOT_LOADED : IDataProviderSvc_NO_ERROR;
}

StatusCode DataSvc::findObject | ( | const std::string & | parentPath,
|  | const std::string & | objPath,
|  | DataObject *& | pObject
| ) |  |
| virtual

Find object in the data store.

Retrieve object identified by its full path from the data store.

Definition at line 954 of file DataSvc.cpp.

{
DataObject* parent = 0;
StatusCode status = findObject(parentPath, parent);
if ( status.isSuccess() ) {
status = findObject (parent, objectPath, pObject);
}
return status;
}

StatusCode DataSvc::findObject | ( | const std::string & | parentPath,
|  | int | item,
|  | DataObject *& | pObject
| ) |  |
| virtual

Find object in the data store.

Retrieve object identified by its full path from the data store.

Definition at line 966 of file DataSvc.cpp.

{
return findObject(parentPath, itemToPath(item), pObject);
}

StatusCode DataSvc::findObject | ( | DataObject * | parentObj,
|  | const std::string & | objPath,
|  | DataObject *& | pObject
| ) |  |
| virtual

Find object in the data store.

Find object identified by its full path in the data store.

Definition at line 979 of file DataSvc.cpp.

{
IRegistry* pDir = (0==parentObj) ? 0 : parentObj->registry();
return findObject(pDir, path, pObject);
}

StatusCode DataSvc::findObject | ( | DataObject * | parentObj,
|  | int | item,
|  | DataObject *& | pObject
| ) |  |
| virtual

Find object in the data store.

Find object identified by its full path in the data store.

Definition at line 972 of file DataSvc.cpp.

{
return findObject(parentObj, itemToPath(item), pObject);
}

IConversionSvc * DataSvc::getDataLoader | ( | IRegistry * | pReg | ) |
| protected virtual

Retrieve customizable data loader according to registry entry to be retrieved.

Reimplemented in NTupleSvc.

Definition at line 1366 of file DataSvc.cpp.

{
return m_dataLoader;
}

DataObject * DataSvc::handleDataFault | ( | IRegistry * | pReg,
|  | const std::string & | path = `""`
| ) |  |
| protected

Invoke data fault handling if enabled.

Parameters

  pReg | [IN] Pointer to missing registry entry
  path | [IN] Sub-path of requested object from pReg

Returns
  Object corresponding to the specified leaf

Definition at line 641 of file DataSvc.cpp.

{
if ( m_enableFaultHdlr ) {
IRegistry* pLeaf = 0;
if ( pReg && path.length() == 0 ) {
DataIncident incident(name(), m_faultName, pReg->identifier());
m_incidentSvc->fireIncident(incident);
return pReg->object();
}
else if ( pReg ) {
std::string p = pReg->identifier();
if (path[0] != SEPARATOR ) p += SEPARATOR;
p += path;
DataIncident incident(name(), m_faultName, p);
m_incidentSvc->fireIncident(incident);
pLeaf = m_root->findLeaf(p);
}
else {
std::string p = m_root->identifier();
if (path[0] != SEPARATOR ) p += SEPARATOR;
p += path;
DataIncident incident(name(), m_faultName, p);
m_incidentSvc->fireIncident(incident);
pLeaf = m_root->findLeaf(p);
}
if ( pLeaf ) {
return pLeaf->object();
}
}
return 0;
}

StatusCode DataSvc::i_setRoot | ( | const std::string & | root_path,
|  | DataObject * | pRootObj
| ) |  |
| virtual

Initialize data store for new event by giving new event path and root object.

Does not clear the store before reinitializing it. This could lead to errors and should be handle with care. Use setRoot if unsure

Definition at line 166 of file DataSvc.cpp.

{
if ( 0 != pRootObj ) {
m_root = new RegEntry(root_path);
m_root->makeHard(pRootObj);
m_root->setDataSvc(this);
preLoad().ignore();
}
return SUCCESS;
}

StatusCode DataSvc::i_setRoot | ( | const std::string & | root_path,
|  | IOpaqueAddress * | pRootAddr
| ) |  |
| virtual

Initialize data store for new event by giving new event path and address of root object.

Does not clear the store before reinitializing it. This could lead to errors and should be handle with care. Use setRoot if unsure

Definition at line 192 of file DataSvc.cpp.

{
if ( 0 != pRootAddr ) {
m_root = new RegEntry(root_path);
m_root->makeHard(pRootAddr);
m_root->setDataSvc(this);
preLoad().ignore();
}
return SUCCESS;
}

StatusCode DataSvc::initialize | ( |  | ) |
| virtual

Service initialization.

Reimplemented from Service.

Reimplemented in HistogramSvc, NTupleSvc, DetDataSvc, TagCollectionSvc, RecordDataSvc, and EvtDataSvc.

Definition at line 1295 of file DataSvc.cpp.

{
// Nothing to do: just call base class initialisation
StatusCode sc = Service::initialize();
if ( !sc.isSuccess() ) {
return sc;
}
sc = service("IncidentSvc", m_incidentSvc, true);
if ( UNLIKELY(!sc.isSuccess()) ) {
error() << "Failed to access incident service." << endmsg;
}
return sc;
}

StatusCode DataSvc::linkObject | ( | IRegistry * | from,
|  | const std::string & | objPath,
|  | DataObject * | to
| ) |  |
| virtual

Add a link to another object.

Definition at line 1084 of file DataSvc.cpp.

{
if ( checkRoot() ) {
try {
RegEntry* from_entry = CAST_REGENTRY(RegEntry*,from);
if ( 0 != from_entry ) {
// First check if both objects are already registered to the store
RegEntry* to_entry = m_root->findLeaf(to);
if ( 0 == to_entry ) {
return INVALID_OBJECT;
}
else {
std::string::size_type sep = objPath.rfind(SEPARATOR);
if ( sep > 0 && sep != std::string::npos ) { // in case the objPath is a sub-directory itself
DataObject* pO = 0;
std::string fromPath(objPath, 0, sep);
StatusCode sc = retrieveObject(from, fromPath, pO);
if ( sc.isSuccess() ) {
std::string toPath(objPath, sep, objPath.length());
sc = linkObject(pO->registry(), toPath, to);
}
return sc;
}
// Now register the soft link
StatusCode status = from_entry->add( objPath, to, true);
return status.isSuccess() ?
IDataProviderSvc_NO_ERROR : DOUBL_OBJ_PATH;
}
}
}
catch (...) {
}
return INVALID_PARENT;
}
return INVALID_ROOT;
}

StatusCode DataSvc::linkObject | ( | const std::string & | fromPath,
|  | const std::string & | objPath,
|  | DataObject * | to
| ) |  |
| virtual

Add a link to another object.

Definition at line 1137 of file DataSvc.cpp.

{
DataObject* pO = 0;
StatusCode status = retrieveObject(from, pO);
if ( status.isSuccess() ) {
return linkObject(pO->registry(), objPath, to);
}
return status;
}

StatusCode DataSvc::linkObject | ( | DataObject * | from,
|  | const std::string & | objPath,
|  | DataObject * | to
| ) |  |
| virtual

Add a link to another object.

Definition at line 1149 of file DataSvc.cpp.

{
if ( 0 != from ) {
IRegistry* from_entry = from->registry();
if ( 0 != from_entry ) {
return linkObject( from_entry, objPath, to);
}
}
return INVALID_PARENT;
}

StatusCode DataSvc::linkObject | ( | const std::string & | fullPath,
|  | DataObject * | to
| ) |  |
| virtual

Add a link to another object.

Definition at line 1122 of file DataSvc.cpp.

{
if ( fullPath.length() > 0 ) {
if ( fullPath[0] != SEPARATOR ) {
return linkObject(m_rootName, fullPath, to);
}
std::string::size_type sep = fullPath.rfind(SEPARATOR);
std::string objPath(fullPath, sep, fullPath.length());
std::string fromPath(fullPath, 0, sep);
return linkObject( fromPath, objPath, to);
}
return INVALID_OBJ_PATH;
}

StatusCode DataSvc::loadObject | ( | IRegistry * | pNode | ) |
| protected virtual

Invoke Persistency service to create transient object from its persistent representation.

Definition at line 676 of file DataSvc.cpp.

{
IConversionSvc* pLoader = getDataLoader(pRegistry);
return loadObject(pLoader, pRegistry);
}

StatusCode DataSvc::loadObject | ( | IConversionSvc * | pLoader,
|  | IRegistry * | pNode
| ) |  |
| protected virtual

Invoke Persistency service to create transient object from its persistent representation.

Definition at line 684 of file DataSvc.cpp.

{
StatusCode status = INVALID_OBJ_ADDR;
DataObject* pObject = 0;
if ( 0 == pLoader ) { // Precondition: Data loader must be present
if (handleDataFault(pRegistry) != 0) return SUCCESS;
else return NO_DATA_LOADER;
}
if ( 0 == pRegistry ) { // Precondition: Directory must be valid
if (handleDataFault(pRegistry) != 0) return SUCCESS;
else return INVALID_OBJ_ADDR;
}
VERMSG << "Requested object " << pRegistry->identifier() << endmsg;
if ( m_enableAccessHdlr ) {
// Fire data access incident
DataIncident incident(name(), m_accessName, pRegistry->identifier());
m_incidentSvc->fireIncident(incident);
}
if ( m_inhibitPathes.size() > 0 ) {
const std::string& ident = pRegistry->identifier();
std::vector<std::string>::iterator inhibit =
std::find(m_inhibitPathes.begin(), m_inhibitPathes.end(), ident);
if ( inhibit != m_inhibitPathes.end() ) {
return NO_ACCESS;
}
}
IOpaqueAddress* pAddress = pRegistry->address();
if ( 0 == pAddress ) { // Precondition:
return INVALID_OBJ_ADDR; // Address must be valid
}
try {
status = pLoader->createObj(pAddress, pObject); // Call data loader
if ( status.isSuccess() ) {
VERMSG << "Object " << pRegistry->identifier() << " created" << endmsg;
RegEntry *pEntry = CAST_REGENTRY(RegEntry*,pRegistry);
pEntry->setObject(pObject);
VERMSG << "Filling object " << pRegistry->identifier() << endmsg;
status = pLoader->fillObjRefs(pAddress, pObject);
}
}
catch( const GaudiException& exc ) {
if ( handleDataFault(pRegistry) != 0 ) {
return SUCCESS;
}
throw GaudiException("GaudiException in loadObject() " + pRegistry->identifier(),
name(), StatusCode::FAILURE, exc);
}
catch( const std::exception& x) {
if ( handleDataFault(pRegistry) != 0 ) {
return SUCCESS;
}
throw GaudiException("std::exception in loadObject() " + pRegistry->identifier() +
": " + System::typeinfoName(typeid(x)) + ", " + x.what(),
name(), StatusCode::FAILURE);
}
catch(...) {
if ( handleDataFault(pRegistry) != 0 ) {
return SUCCESS;
}
throw GaudiException("UNKN exception in loadObject() " + pRegistry->identifier(),
name(), StatusCode::FAILURE);
}
if ( !status.isSuccess() ) {
if ( handleDataFault(pRegistry) != 0 ) {
return StatusCode::SUCCESS;
}
}
ON_VERBOSE if ( status.isSuccess() ) {
verbose() << "Object " << pRegistry->identifier() << " successfully loaded" << endmsg;
}
return status;
}

StatusCode DataSvc::objectLeaves | ( | const DataObject * | pObject,
|  | std::vector< IRegistry * > & | refLeaves
| ) |  |
| virtual

IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.

IDataManagerSvc: Explore an object identified by its pointer.

Definition at line 237 of file DataSvc.cpp.

{
if ( pObject ) {
return objectLeaves(pObject->registry(), leaves);
}
return INVALID_OBJECT;
}

StatusCode DataSvc::objectLeaves | ( | const IRegistry * | pRegistry,
|  | std::vector< IRegistry * > & | refLeaves
| ) |  |
| virtual

IDataManagerSvc: Explore the object store: retrieve all leaves attached to the object.

IDataManagerSvc: Explore an object identified by the pointer to the registry entry.

Definition at line 248 of file DataSvc.cpp.

{
if ( checkRoot() ) {
const RegEntry* node_entry = CAST_REGENTRY(const RegEntry*,pRegistry);
if ( node_entry ) {
leaves = node_entry->leaves();
return StatusCode::SUCCESS;
}
return INVALID_OBJECT;
}
return INVALID_ROOT;
}

StatusCode DataSvc::objectParent | ( | const DataObject * | pObject,
|  | IRegistry *& | refpParent
| ) |  |
| virtual

IDataManagerSvc: Explore the object store: retrieve the object's parent.

Definition at line 215 of file DataSvc.cpp.

{
if ( pObject ) {
return objectParent(pObject->registry(), refpParent);
}
return INVALID_OBJECT;
}

StatusCode DataSvc::objectParent | ( | const IRegistry * | pRegistry,
|  | IRegistry *& | refpParent
| ) |  |
| virtual

IDataManagerSvc: Explore the object store: retrieve the object's parent.

Definition at line 223 of file DataSvc.cpp.

{
if ( checkRoot() ) {
const RegEntry* node_entry = CAST_REGENTRY(const RegEntry*,pRegistry);
if ( node_entry ) {
refpParent = node_entry->parent();
return StatusCode::SUCCESS;
}
return INVALID_OBJECT;
}
return INVALID_ROOT;
}

DataSvc& DataSvc::operator= | ( | const DataSvc & |  | ) |
| private

Fake assignment operator (never implemented).

StatusCode DataSvc::preLoad | ( | int | depth,
|  | int | load_depth,
|  | DataObject * | pObject
| ) |  |
| virtual

Execute one level of preloading and recursively load until the final level is reached.

Preload one level deep, then recursively call the next level.

Parameters

  depth | current level of loading from requested parent
  load_depth | maximum level of object loading
  pObject | pointer to next level root object

Returns
  Status code indicating success or failure.

Definition at line 1264 of file DataSvc.cpp.

{
//unused: StatusCode sc = StatusCode::FAILURE;
if ( 0 != pObject && depth++ < load_depth ) {
RegEntry* dir = CAST_REGENTRY(RegEntry*,pObject->registry());
if ( 0 != dir ) {
for (RegEntry::Iterator i = dir->begin(); i != dir->end(); i++ ) {
DataObject *pObj = 0;
StatusCode status = retrieveObject(pObject, (*i)->name(), pObj);
if ( status.isSuccess() && depth < load_depth ) {
preLoad(depth, load_depth, pObj).ignore();
}
}
}
}
return StatusCode::SUCCESS;
}

StatusCode DataSvc::preLoad | ( |  | ) |
| virtual

load all preload items of the list

Definition at line 1282 of file DataSvc.cpp.

{
DataObject* pObj = 0;
for (LoadItems::iterator i = m_preLoads.begin(); i != m_preLoads.end(); i++) {
StatusCode sc = retrieveObject( (*i).path(), pObj);
int load_depth = (*i).depth();
if ( sc.isSuccess() && load_depth > 1 ) {
preLoad(1, load_depth, pObj).ignore();
}
}
return StatusCode::SUCCESS;
}

StatusCode DataSvc::registerAddress | ( | const std::string & | fullPath,
|  | IOpaqueAddress * | pAddress
| ) |  |
| virtual

IDataManagerSvc: Register object address with the data store.

Definition at line 262 of file DataSvc.cpp.

{
if ( fullPath.length() > 0 ) {
if ( fullPath[0] != SEPARATOR ) {
return registerAddress(m_root, fullPath, pAddress);
}
IRegistry* pRegistry = 0;
return registerAddress(pRegistry, fullPath, pAddress);
}
return INVALID_OBJ_PATH;
}

StatusCode DataSvc::registerAddress | ( | DataObject * | parentObj,
|  | const std::string & | objectPath,
|  | IOpaqueAddress * | pAddress
| ) |  |
| virtual

IDataManagerSvc: Register object address with the data store.

Definition at line 275 of file DataSvc.cpp.

{
IRegistry* pRegistry = (0 == parentObj) ? 0 : parentObj->registry();
return registerAddress(pRegistry, objectPath, pAddress);
}

StatusCode DataSvc::registerAddress | ( | IRegistry * | parentObj,
|  | const std::string & | objectPath,
|  | IOpaqueAddress * | pAddress
| ) |  |
| virtual

IDataManagerSvc: Register object address with the data store.

Definition at line 283 of file DataSvc.cpp.

{
if ( checkRoot() ) {
if ( objPath.length() > 0 ) {
if ( 0 == parentObj ) {
if ( objPath[0] != SEPARATOR ) {
return registerAddress(m_root, objPath, pAddress);
}
std::string::size_type sep = objPath.find(SEPARATOR,1);
if ( sep != std::string::npos ) {
std::string p_path (objPath, 0, sep);
if ( p_path == m_rootName ) {
std::string o_path (objPath, sep, objPath.length());
return registerAddress(m_root, o_path, pAddress);
}
}
return INVALID_PARENT;
}
if ( objPath[0] != SEPARATOR ) {
std::string path;
path = SEPARATOR;
path += objPath;
return registerAddress(parentObj, path, pAddress);
}
RegEntry* par_entry = CAST_REGENTRY(RegEntry*,parentObj);
if ( 0 != par_entry ) {
std::string::size_type sep = objPath.rfind(SEPARATOR);
if ( sep > 0 && sep != std::string::npos ) {
std::string p_path (objPath, 0, sep);
std::string o_path (objPath, sep, objPath.length());
RegEntry* p_entry = par_entry->findLeaf(p_path);
// Create default object leafs if the
// intermediate nodes are not present
if ( 0 == p_entry && m_forceLeaves ) {
DataObject *pLeaf = createDefaultObject();
StatusCode sc = registerObject(par_entry->identifier(),
p_path,
pLeaf);
if ( ! sc.isSuccess() ) {
delete pLeaf;
}
p_entry = par_entry->findLeaf(p_path);
}
if ( 0 != p_entry ) {
return registerAddress(p_entry, o_path, pAddress);
}
return INVALID_PARENT;
}
StatusCode status = par_entry->add(objPath, pAddress);
if ( status.isSuccess() ) {
return status;
}
return DOUBL_OBJ_PATH;
}
return INVALID_PARENT;
}
return INVALID_OBJ_PATH;
}
return INVALID_ROOT;
}

StatusCode DataSvc::registerObject | ( | const std::string & | fullPath,
|  | DataObject * | pObject
| ) |  |
| virtual

Register object with the data store.

Definition at line 412 of file DataSvc.cpp.

{
return registerObject(0, fullPath, pObject);
}

StatusCode DataSvc::registerObject | ( | const std::string & | parentPath,
|  | const std::string & | objPath,
|  | DataObject * | pObject
| ) |  |
| virtual

Register object with the data store.

Definition at line 419 of file DataSvc.cpp.

{
DataObject* pO = 0;
StatusCode status = retrieveObject(parentPath, pO);
if ( !status.isSuccess() && m_forceLeaves ) {
pO = createDefaultObject();
status = registerObject(parentPath, pO);
if ( !status.isSuccess() ) {
pO->release();
}
}
if ( status.isSuccess() ) {
status = registerObject(pO, objPath, pObject);
}
return status;
}

StatusCode DataSvc::registerObject | ( | const std::string & | parentPath,
|  | int | item,
|  | DataObject * | pObject
| ) |  |
| virtual

Register object with the data store.

Definition at line 438 of file DataSvc.cpp.

{
return registerObject(parentPath, itemToPath(item), pObject);
}

StatusCode DataSvc::registerObject | ( | DataObject * | parentObj,
|  | const std::string & | objPath,
|  | DataObject * | pObject
| ) |  |
| virtual

Register object with the data store.

Definition at line 452 of file DataSvc.cpp.

{
if ( checkRoot() ) {
if ( 0 == parentObj ) {
if ( objPath.length() > 0 ) {
if ( objPath[0] == SEPARATOR ) {
std::string::size_type sep = objPath.find(SEPARATOR,1);
if ( sep != std::string::npos ) {
std::string p_path (objPath, 0, sep);
std::string o_path (objPath, sep, objPath.length());
return registerObject(p_path, o_path, pObject);
}
}
else {
return registerObject(m_rootName, objPath, pObject);
}
}
return INVALID_OBJ_PATH;
}
RegEntry* node_entry = CAST_REGENTRY(RegEntry*,parentObj->registry());
if ( 0 != node_entry ) {
StatusCode status = INVALID_PARENT;
std::string::size_type sep = objPath.find(SEPARATOR,1);
if ( sep != std::string::npos ) {
std::string p_path (objPath, 0, sep);
std::string o_path (objPath, sep, objPath.length());
RegEntry* par_entry = node_entry->findLeaf(p_path);
// Create default object leafs if the
// intermediate nodes are not present
if ( 0 == par_entry && m_forceLeaves ) {
DataObject *pLeaf = createDefaultObject();
StatusCode sc = registerObject(parentObj, p_path, pLeaf);
if ( ! sc.isSuccess() ) {
delete pLeaf;
}
par_entry = node_entry->findLeaf(p_path);
}
else if ( 0 != par_entry && par_entry->object() == 0 ) {
status = retrieveEntry( node_entry, p_path, par_entry);
if ( !status.isSuccess() && !par_entry->address() && m_forceLeaves ) {
DataObject *pLeaf = createDefaultObject();
StatusCode sc = registerObject(parentObj, p_path, pLeaf);
if ( ! sc.isSuccess() ) {
delete pLeaf;
}
par_entry = node_entry->findLeaf(p_path);
}
}
node_entry = par_entry;
if ( 0 != node_entry ) {
DataObject* obj = node_entry->object();
if ( 0 != obj ) {
status = registerObject( obj, o_path, pObject );
}
}
}
else {
RegEntry* leaf = node_entry->findLeaf(objPath);
if ( 0 == leaf ) {
status = node_entry->add( objPath, pObject );
}
else {
DataObject* obj = leaf->object();
if ( 0 == obj ) {
if (0 == pObject) {
error() << "registerObject: trying to register null DataObject" << endmsg;
return StatusCode::FAILURE;
}
else {
pObject->setRegistry(leaf);
}
leaf->setAddress(0);
leaf->setObject(pObject);
status = StatusCode::SUCCESS;
}
else {
status = DOUBL_OBJ_PATH;
}
}
}
return status;
}
return INVALID_PARENT;
}
return INVALID_ROOT;
}

StatusCode DataSvc::registerObject | ( | DataObject * | parentObj,
|  | int | item,
|  | DataObject * | pObject
| ) |  |
| virtual

Register object with the data store.

Definition at line 445 of file DataSvc.cpp.

{
return registerObject(parentObj, itemToPath(item), pObject);
}

StatusCode DataSvc::reinitialize | ( |  | ) |
| virtual

Service initialization.

Service reinitialization.

Reimplemented from Service.

Reimplemented in HistogramSvc, NTupleSvc, DetDataSvc, RecordDataSvc, and EvtDataSvc.

Definition at line 1309 of file DataSvc.cpp.

{
StatusCode sc;
// the finalize part is copied here
setDataLoader(0).ignore();
resetPreLoad().ignore();
clearStore().ignore();
if ( m_incidentSvc ) {
m_incidentSvc->release();
m_incidentSvc = 0;
}
// re-initialize the base class
sc = Service::reinitialize();
if ( UNLIKELY(!sc.isSuccess()) ) {
error() << "Unable to reinitialize base class" << endmsg;
return sc;
}
// the initialize part is copied here
sc = service("IncidentSvc", m_incidentSvc, true);
if ( UNLIKELY(!sc.isSuccess()) ) {
error() << "Failed to access incident service." << endmsg;
return sc;
}
// return
return StatusCode::SUCCESS;
}

StatusCode DataSvc::removePreLoadItem | ( | const DataStoreItem & | item | ) |
| virtual

Remove an item from the preload list.

Definition at line 1243 of file DataSvc.cpp.

{
LoadItems::iterator i =
std::remove(m_preLoads.begin(), m_preLoads.end(), item);
if ( i != m_preLoads.end() ) {
m_preLoads.erase(i, m_preLoads.end());
}
return StatusCode::SUCCESS;
}

StatusCode DataSvc::removePreLoadItem | ( | const std::string & | itemPath | ) |
| virtual

Add an item to the preload list.

Definition at line 1253 of file DataSvc.cpp.

{
return removePreLoadItem( DataStoreItem(itemPath,1) );
}

StatusCode DataSvc::resetPreLoad | ( |  | ) |
| virtual

Clear the preload list.

Definition at line 1258 of file DataSvc.cpp.

{
m_preLoads.erase(m_preLoads.begin(), m_preLoads.end());
return StatusCode::SUCCESS;
}

StatusCode DataSvc::retrieveEntry | ( | DataSvcHelpers::RegistryEntry * | pNode,
|  | const std::string & | path,
|  | DataSvcHelpers::RegistryEntry *& | pEntry
| ) |  |
| protected

Retrieve registry entry from store.

Definition at line 762 of file DataSvc.cpp.

{
std::string::size_type sep = path.find(SEPARATOR,1);
StatusCode status = StatusCode(INVALID_ROOT,true);
pEntry = 0;
// A.Valassi 16.08.2001 avoid core dump if store is empty
if ( checkRoot() ) {
if ( 0 == parentObj ) {
if ( path.length() == 0 || path == m_rootName ) {
return retrieveEntry(m_root, "", pEntry);
}
else if ( path[0] != SEPARATOR ) {
return retrieveEntry(m_root, path, pEntry);
}
else if ( sep != std::string::npos ) {
if ( m_root->object() == 0 ) {
RegEntry* r = 0;
status = retrieveEntry(m_root, "", r);
if ( !status.isSuccess() ) {
return status;
}
}
std::string o_path (path, sep, path.length());
return retrieveEntry(m_root, o_path, pEntry);
}
return INVALID_OBJ_PATH;
}
if ( sep != std::string::npos ) { // the string contains a separator (after pos 0)
std::string p_path (path,0,sep);
std::string o_path (path,sep,path.length());
if (!parentObj->object()) { // if the parent object has not been loaded yet, load it now
status = loadObject(parentObj);
if ( !status.isSuccess() ) {
return status;
}
}
RegEntry* root_entry = parentObj->findLeaf(p_path);
if ( !root_entry && m_enableFaultHdlr ) {
// If not even the parent is there, an incident
// to load the parent must be fired...
handleDataFault(parentObj, p_path);
root_entry = parentObj->findLeaf(p_path);
}
if ( root_entry ) {
DataObject* pO = root_entry->object();
if ( 0 == pO ) {
// Object is not loaded: load the object if at all possible
status = loadObject(root_entry);
if ( !status.isSuccess() ) {
return status;
}
}
if ( root_entry->isSoft() ) {
root_entry = CAST_REGENTRY(RegEntry*,pO->registry());
}
return retrieveEntry (root_entry, o_path, pEntry);
}
return status;
}
else if ( path.length() == 0 ) {
pEntry = parentObj;
}
else {
if (!parentObj->object()) { // if the parent object has not been loaded yet, load it now
status = loadObject(parentObj);
if ( !status.isSuccess() ) {
return status;
}
}
// last leave in search: find leaf and load
pEntry = parentObj->findLeaf(path);
// If no registry entry was found, trigger incident for action-on-demand
if ( !pEntry && m_enableFaultHdlr ) {
handleDataFault(parentObj, path);
pEntry = (0==path.length()) ? parentObj : parentObj->findLeaf(path);
}
}
// Check results and return
if ( 0 == pEntry ) {
status = INVALID_OBJ_PATH;
}
else if ( 0 == pEntry->object() ) {
status = loadObject(pEntry);
}
else if ( m_enableAccessHdlr ) {
// Fire data access incident
// I do not know if this is a good idea....
// This fires too often!
//
//DataIncident incident(name(), m_accessName, pEntry->identifier());
//m_incidentSvc->fireIncident(incident);
status = SUCCESS;
}
else {
status = SUCCESS;
}
}
return status;
}

StatusCode DataSvc::retrieveObject | ( | IRegistry * | pDirectory,
|  | const std::string & | path,
|  | DataObject *& | pObject
| ) |  |
| virtual

Retrieve object from data store.

Retrieve object identified by its directory from the data store.

Definition at line 864 of file DataSvc.cpp.

{
pObject = 0;
RegEntry *result = 0, *parent = CAST_REGENTRY(RegEntry*,pRegistry);
StatusCode status = retrieveEntry(parent, path, result);
if ( status.isSuccess() ) {
pObject = result->object();
}
return status;
}

StatusCode DataSvc::retrieveObject | ( | const std::string & | fullPath,
|  | DataObject *& | pObject
| ) |  |
| virtual

Retrieve object identified by its full path from the data store.

Definition at line 877 of file DataSvc.cpp.

{
IRegistry* nullDir = 0;
return retrieveObject(nullDir, fullPath, pObject);
}

StatusCode DataSvc::retrieveObject | ( | const std::string & | parentPath,
|  | const std::string & | objPath,
|  | DataObject *& | pObject
| ) |  |
| virtual

Retrieve object from data store.

Retrieve object identified by its full path from the data store.

Definition at line 884 of file DataSvc.cpp.

{
DataObject* parent = 0;
StatusCode status = retrieveObject(parentPath, parent);
if ( status.isSuccess() ) {
status = retrieveObject (parent, objectPath, pObject);
}
return status;
}

StatusCode DataSvc::retrieveObject | ( | const std::string & | parentPath,
|  | int | item,
|  | DataObject *& | pObject
| ) |  |
| virtual

Retrieve object from data store.

Retrieve object identified by its full path from the data store.

Definition at line 896 of file DataSvc.cpp.

{
return retrieveObject(parentPath, itemToPath(item), pObject);
}

StatusCode DataSvc::retrieveObject | ( | DataObject * | parentObj,
|  | const std::string & | objPath,
|  | DataObject *& | pObject
| ) |  |
| virtual

Retrieve object from data store.

Definition at line 903 of file DataSvc.cpp.

{
IRegistry* pRegistry = (0==parentObj) ? 0 : parentObj->registry();
return retrieveObject(pRegistry, path, pObject);
}

StatusCode DataSvc::retrieveObject | ( | DataObject * | parentObj,
|  | int | item,
|  | DataObject *& | pObject
| ) |  |
| virtual

Retrieve object from data store.

Retrieve registry entry from store.

Definition at line 911 of file DataSvc.cpp.

{
return retrieveObject(parentObj, itemToPath(item), pObject);
}

CLID DataSvc::rootCLID | ( |  | ) | const
| virtual

IDataManagerSvc: Accessor for root event CLID.

CLID for root Event.

Definition at line 1349 of file DataSvc.cpp.

{
return( (CLID)m_rootCLID );
}

std::string DataSvc::rootName | ( |  | ) | const
| virtual

IDataManagerSvc: Accessor for root event name.

Name for root Event.

Definition at line 1354 of file DataSvc.cpp.

{
return( m_rootName );
}

StatusCode DataSvc::setDataLoader | ( | IConversionSvc * | svc | ) |
| virtual

IDataManagerSvc: IDataManagerSvc: Pass a default data loader to the service.

IDataManagerSvc: Pass a default data loader to the service.

Definition at line 204 of file DataSvc.cpp.

{
if ( 0 != pDataLoader ) pDataLoader->addRef();
if ( 0 != m_dataLoader ) m_dataLoader->release();
if ( 0 != pDataLoader ) {
pDataLoader->setDataProvider(this).ignore();
}
m_dataLoader = pDataLoader;
return SUCCESS;
}

StatusCode DataSvc::setRoot | ( | const std::string & | root_path,
|  | DataObject * | pRootObj
| ) |  |
| virtual

Initialize data store for new event by giving new event path and root object.

Takes care to clear the store before reinitializing it

Definition at line 155 of file DataSvc.cpp.

{
clearStore().ignore();
return i_setRoot (root_path, pRootObj);
}

StatusCode DataSvc::setRoot | ( | const std::string & | root_path,
|  | IOpaqueAddress * | pRootAddr
| ) |  |
| virtual

Initialize data store for new event by giving new event path and address of root object.

Takes care to clear the store before reinitializing it

Definition at line 181 of file DataSvc.cpp.

{
clearStore().ignore();
return i_setRoot (root_path, pRootAddr);
}

StatusCode DataSvc::traverseSubTree | ( | const std::string & | sub_tree_path,
|  | IDataStoreAgent * | pAgent
| ) |  |
| virtual

IDataManagerSvc: Analyze by traversing all data objects below the sub tree identified by its full path name.

IDataManagerSvc: Analyse by traversing all data objects below the sub tree identified by its full path name.

Definition at line 120 of file DataSvc.cpp.

{
DataObject* pO = 0;
StatusCode status = findObject(sub_tree_path, pO);
if ( status.isSuccess() ) {
status = traverseSubTree(pO, pAgent);
}
return status;
}

StatusCode DataSvc::traverseSubTree | ( | DataObject * | pObject,
|  | IDataStoreAgent * | pAgent
| ) |  |
| virtual

IDataManagerSvc: Analyze by traversing all data objects below the sub tree.

IDataManagerSvc: Analyse by traversing all data objects below the sub tree.

Definition at line 131 of file DataSvc.cpp.

{
if ( checkRoot() ) {
RegEntry* entry = CAST_REGENTRY(RegEntry*,pObject->registry());
if ( 0 != entry ) {
return entry->traverseTree(pAgent);
}
return INVALID_OBJECT;
}
return INVALID_ROOT;
}

StatusCode DataSvc::traverseTree | ( | IDataStoreAgent * | pAgent | ) |
| virtual

IDataManagerSvc: Analyze by traversing all data objects in the data store.

IDataManagerSvc: Analyse by traversing all data objects in the data store.

Definition at line 144 of file DataSvc.cpp.

{
if ( checkRoot() ) {
return m_root->traverseTree(pAgent);
}
return INVALID_ROOT;
}

StatusCode DataSvc::unlinkObject | ( | IRegistry * | from,
|  | const std::string & | objPath
| ) |  |
| virtual

Remove a link to another object.

Definition at line 1162 of file DataSvc.cpp.

{
if ( checkRoot() ) {
try {
RegEntry* from_entry = CAST_REGENTRY(RegEntry*,from);
if ( 0 != from_entry ) {
std::string::size_type sep = objPath.rfind(SEPARATOR);
if ( sep > 0 && sep != std::string::npos ) { // in case the objPath is a sub-directory itself
DataObject* pO = 0;
std::string fromPath(objPath, 0, sep);
StatusCode sc = findObject(from, fromPath, pO);
if ( sc.isSuccess() ) {
std::string toPath(objPath, sep, objPath.length());
sc = unlinkObject(pO->registry(), toPath);
}
return sc;
}
StatusCode status = from_entry->remove( objPath );
if ( status.isSuccess() ) {
return status;
}
return INVALID_OBJ_PATH;
}
}
catch (...) {
}
return INVALID_PARENT;
}
return INVALID_ROOT;
}

StatusCode DataSvc::unlinkObject | ( | const std::string & | fromPath,
|  | const std::string & | objPath
| ) |  |
| virtual

Remove a link to another object.

Definition at line 1208 of file DataSvc.cpp.

{
DataObject* pObject = 0;
StatusCode status = findObject(from, pObject);
if ( status.isSuccess() ) {
status = unlinkObject(pObject->registry(), objPath);
}
return status;
}

StatusCode DataSvc::unlinkObject | ( | DataObject * | fromObj,
|  | const std::string & | objPath
| ) |  |
| virtual

Remove a link to another object.

Definition at line 1219 of file DataSvc.cpp.

{
if ( checkRoot() ) {
IRegistry* from_entry = m_root->findLeaf(from);
return unlinkObject(from_entry, objPath);
}
return INVALID_ROOT;
}

StatusCode DataSvc::unlinkObject | ( | const std::string & | fullPath | ) |
| virtual

Remove a link to another object.

Definition at line 1194 of file DataSvc.cpp.

{
if ( fullPath.length() > 0 ) {
if ( fullPath[0] != SEPARATOR ) {
return unlinkObject(m_rootName, fullPath);
}
std::string::size_type sep = fullPath.rfind(SEPARATOR);
std::string objPath(fullPath, sep, fullPath.length());
std::string fromPath(fullPath, 0, sep);
return unlinkObject(fromPath, objPath);
}
return INVALID_OBJ_PATH;
}

StatusCode DataSvc::unregisterAddress | ( | const std::string & | fullPath | ) |
| virtual

IDataManagerSvc: Unregister object address from the data store.

Definition at line 346 of file DataSvc.cpp.

{
if ( fullPath.length() > 0 ) {
IRegistry* pRegistry = 0;
if ( fullPath[0] != SEPARATOR ) {
return unregisterAddress(m_root, fullPath);
}
return unregisterAddress(pRegistry, fullPath);
}
return INVALID_OBJ_PATH;
}

StatusCode DataSvc::unregisterAddress | ( | DataObject * | pParent,
|  | const std::string & | objPath
| ) |  |
| virtual

IDataManagerSvc: Unregister object address from the data store.

Definition at line 358 of file DataSvc.cpp.

{
IRegistry* pRegistry = (0 == pParent) ? 0 : pParent->registry();
return unregisterAddress(pRegistry, objPath);
}

StatusCode DataSvc::unregisterAddress | ( | IRegistry * | pParent,
|  | const std::string & | objPath
| ) |  |
| virtual

IDataManagerSvc: Unregister object address from the data store.

Definition at line 365 of file DataSvc.cpp.

{
if ( checkRoot() ) {
if ( objPath.length() > 0 ) {
if ( 0 == pParent ) {
if ( objPath[0] != SEPARATOR ) {
return unregisterAddress(m_root, objPath);
}
std::string::size_type sep = objPath.find(SEPARATOR,1);
if ( sep != std::string::npos ) {
std::string p_path (objPath, 0, sep);
if ( p_path == m_rootName ) {
std::string o_path (objPath, sep, objPath.length());
return unregisterAddress(m_root, o_path);
}
}
return INVALID_PARENT;
}
if ( objPath[0] != SEPARATOR ) {
std::string path;
path = SEPARATOR;
path += objPath;
return unregisterAddress(pParent, path);
}
RegEntry* node_entry = CAST_REGENTRY(RegEntry*,pParent);
if ( 0 != node_entry ) {
RegEntry* leaf_entry = node_entry->findLeaf(objPath);
if ( 0 != leaf_entry ) {
std::string::size_type sep = objPath.rfind(SEPARATOR);
if ( sep > 0 && sep != std::string::npos ) {
std::string path = objPath.substr(sep);
return unregisterAddress(leaf_entry->parent(), path);
}
StatusCode status = node_entry->remove(objPath);
if ( status.isSuccess() ) {
return status;
}
}
}
return INVALID_PARENT;
}
return INVALID_OBJ_PATH;
}
return INVALID_ROOT;
}

StatusCode DataSvc::unregisterObject | ( | const std::string & | fullPath | ) |
| virtual

Unregister object from the data store.

Definition at line 541 of file DataSvc.cpp.

{
DataObject* pObject = 0;
StatusCode status = findObject(fullPath, pObject);
if ( status.isSuccess() ) {
RegEntry* pEntry = CAST_REGENTRY(RegEntry*,pObject->registry());
if ( 0 != pEntry ) {
if ( pEntry->isEmpty() ) {
RegEntry* pParent = pEntry->parentEntry();
if ( 0 != pParent ) {
if ( 0 != pObject ) {
pObject->addRef();
}
pParent->remove(pEntry);
return StatusCode::SUCCESS;
}
return INVALID_PARENT;
}
return DIR_NOT_EMPTY;
}
return INVALID_ROOT;
}
return status;
}

StatusCode DataSvc::unregisterObject | ( | const std::string & | parentPath,
|  | const std::string & | objectPath
| ) |  |
| virtual

Unregister object from the data store.

Definition at line 566 of file DataSvc.cpp.

{
DataObject* pO = 0;
StatusCode status = findObject(parentPath, pO);
if ( status.isSuccess() ) {
status = unregisterObject(pO, objPath);
}
return status;
}

StatusCode DataSvc::unregisterObject | ( | const std::string & | parentPath,
|  | int | item
| ) |  |
| virtual

Unregister object from the data store.

Definition at line 577 of file DataSvc.cpp.

{
return unregisterObject(parentPath, itemToPath(item));
}

StatusCode DataSvc::unregisterObject | ( | DataObject * | pObject | ) |
| virtual

Unregister object from the data store.

Definition at line 582 of file DataSvc.cpp.

{
if ( checkRoot() ) {
RegEntry* entry = m_root->findLeaf(pObject);
if ( 0 != entry ) {
RegEntry* parent = entry->parentEntry();
if ( 0 != parent ) {
if ( entry->isEmpty() ) {
if ( 0 != entry->object() ) {
entry->object()->addRef();
}
if ( 0 != parent ) {
parent->remove(entry);
}
return SUCCESS;
}
return INVALID_PARENT;
}
return DIR_NOT_EMPTY;
}
return INVALID_OBJECT;
}
return INVALID_ROOT;
}

StatusCode DataSvc::unregisterObject | ( | DataObject * | pObject,
|  | const std::string & | objectPath
| ) |  |
| virtual

Unregister object from the data store.

Definition at line 607 of file DataSvc.cpp.

{
if ( checkRoot() ) {
try {
RegEntry* parent = CAST_REGENTRY(RegEntry*,pParentObj->registry());
if ( 0 != parent ) {
RegEntry* entry = parent->findLeaf(objectPath);
if ( 0 != entry ) {
if ( entry->isEmpty() ) {
if ( 0 != entry->object() ) {
entry->object()->addRef();
}
parent->remove(entry);
return SUCCESS;
}
return DIR_NOT_EMPTY;
}
return INVALID_OBJECT;
}
}
catch(...) {
}
return INVALID_PARENT;
}
return INVALID_ROOT;
}

StatusCode DataSvc::unregisterObject | ( | DataObject * | pObject,
|  | int | item
| ) |  |
| virtual

Unregister object from the data store.

Definition at line 635 of file DataSvc.cpp.

{
return unregisterObject(pParentObj, itemToPath(item));
}

StatusCode DataSvc::updateObject | ( | IRegistry * | pDirectory | ) |
| virtual

Update object identified by its directory entry.

Update object.

Definition at line 997 of file DataSvc.cpp.

{
if ( 0 == pRegistry ) { // Precondition:
return INVALID_OBJ_ADDR; // Addres must be valid
}
DataObject* toUpdate = pRegistry->object();
if ( 0 == toUpdate ) { // Try first to load
return loadObject(pRegistry);
}
return updateObject(toUpdate);
}

StatusCode DataSvc::updateObject | ( | const std::string & | updatePath | ) |
| virtual

Update object.

Definition at line 987 of file DataSvc.cpp.

{
DataObject* pO = 0;
StatusCode status = findObject(updatePath, pO);
if ( status.isSuccess() ) {
return updateObject(pO);
}
return retrieveObject(updatePath, pO);
}

StatusCode DataSvc::updateObject | ( | DataObject * | toUpdate | ) |
| virtual

Update object.

Reimplemented in DetDataSvc.

Definition at line 1009 of file DataSvc.cpp.

{
StatusCode status = INVALID_OBJ_ADDR;
if ( 0 == toUpdate ) { // Precondition:
return INVALID_OBJECT; // Address must be valid
}
IRegistry* pRegistry = toUpdate->registry(); // Precondition:
if ( 0 == pRegistry ) { // Need valid registry
return INVALID_OBJECT;
}
IOpaqueAddress* pAddress = pRegistry->address(); // Precondition:
if ( 0 == pAddress ) { // Need valid address
return INVALID_OBJ_ADDR;
}
IConversionSvc* pLoader = getDataLoader(pRegistry);
if ( 0 == pLoader ) { // Precondition:
return NO_DATA_LOADER; // Data loader must be present
}
if ( m_inhibitPathes.size() > 0 ) {
const std::string& ident = pRegistry->identifier();
std::vector<std::string>::iterator inhibit =
std::find(m_inhibitPathes.begin(), m_inhibitPathes.end(), ident);
if ( inhibit != m_inhibitPathes.end() ) {
return NO_ACCESS;
}
}
try {
status = pLoader->updateObj(pAddress, toUpdate); // Call data loader
if ( status.isSuccess() ) {
status = pLoader->updateObjRefs(pAddress, toUpdate);
}
}
catch( const GaudiException& exc ) {
throw GaudiException("GaudiException in updateObject() " +
pRegistry->name(),
name(),
StatusCode::FAILURE, exc);
}
catch( const std::exception& x) {
throw GaudiException("std::exception in updateObject() " +
pRegistry->name() + ": " +
System::typeinfoName(typeid(x)) + ", " +
x.what(),
name(), StatusCode::FAILURE);
}
catch(...) {
throw GaudiException("UNKN exception in updateObject() " +
pRegistry->name(),
name(), StatusCode::FAILURE);
}
return status;
}

StatusCode DataSvc::updateObject | ( | const std::string & | parentPath,
|  | const std::string & | updatePath
| ) |  |
| virtual

Update object.

Definition at line 1062 of file DataSvc.cpp.

{
DataObject* pParent = 0;
StatusCode status = findObject(parentPath, pParent);
if ( status.isSuccess() ) {
status = updateObject( pParent, updatePath);
}
return status;
}

StatusCode DataSvc::updateObject | ( | DataObject * | pParent,
|  | const std::string & | updatePath
| ) |  |
| virtual

Update object.

Definition at line 1073 of file DataSvc.cpp.

{
DataObject* pObject = 0;
StatusCode status = findObject(parent, updatePath, pObject);
if ( status.isSuccess() ) {
status = updateObject(pObject);
}
return status;
}

## Member Data Documentation

std::string DataSvc::m_accessName
| protected

Name of the data access incident.

Definition at line 69 of file DataSvc.h.

IConversionSvc* DataSvc::m_dataLoader
| protected

Pointer to data loader service.

Definition at line 51 of file DataSvc.h.

bool DataSvc::m_enableAccessHdlr
| protected

Flag to enable interrupts on data access requests.

Definition at line 59 of file DataSvc.h.

bool DataSvc::m_enableFaultHdlr
| protected

Flag to enable interrupts on data creation requests.

Definition at line 61 of file DataSvc.h.

std::string DataSvc::m_faultName
| protected

Name of the data fault incident.

Definition at line 71 of file DataSvc.h.

bool DataSvc::m_forceLeaves
| protected

Allow forced creation of default leaves on registerObject.

Definition at line 57 of file DataSvc.h.

IIncidentSvc* DataSvc::m_incidentSvc
| protected

Pointer to incident service.

Definition at line 53 of file DataSvc.h.

DataSvcHelpers::InhibitMap* DataSvc::m_inhibitMap
| protected

Map with object paths to be inhibited from loading.

Definition at line 65 of file DataSvc.h.

std::vector<std::string> DataSvc::m_inhibitPathes
| protected

Property for the inhibited leaves.

Definition at line 67 of file DataSvc.h.

LoadItems DataSvc::m_preLoads
| protected

Items to be pre-loaded.

Definition at line 55 of file DataSvc.h.

DataSvcHelpers::RegistryEntry* DataSvc::m_root
| protected

Pointer to root entry.

Definition at line 63 of file DataSvc.h.

CLID DataSvc::m_rootCLID
| protected

Integer Property corresponding to CLID of root entry.

Definition at line 47 of file DataSvc.h.

std::string DataSvc::m_rootName
| protected

Name of root event.

Definition at line 49 of file DataSvc.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiKernel/GaudiKernel/DataSvc.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiKernel/src/Lib/DataSvc.cpp