Gaudi Framework, version v21r8

Home   Generated: 17 Mar 2010

DataSvc Class Reference

Data service base class. More...

#include <GaudiKernel/DataSvc.h>

Inheritance diagram for DataSvc:

Inheritance graph
[legend]
Collaboration diagram for DataSvc:

Collaboration graph
[legend]

List of all members.

Public Types

typedef std::vector
< DataStoreItem
LoadItems
 Define set of load items.

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.

Protected Member Functions

bool checkRoot ()
 Check if root path is valid.
virtual IConversionSvcgetDataLoader (IRegistry *pReg)
 Retrieve customizable data loader according to registry entry to be retrieved.
virtual DataObjectcreateDefaultObject () 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.
DataObjecthandleDataFault (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.
IConversionSvcm_dataLoader
 Pointer to data loader service.
IIncidentSvcm_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::RegistryEntrym_root
 Pointer to root entry.
DataSvcHelpers::InhibitMap * m_inhibitMap
 Map with object paths to be inhibited from loading.
std::vector< std::stringm_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).
DataSvcoperator= (const DataSvc &)
 Fake assignment operator (never implemented).

Friends

class SvcFactory< DataSvc >
 The class creator is of course a friend!


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 42 of file DataSvc.h.


Member Typedef Documentation

Define set of load items.

Definition at line 49 of file DataSvc.h.


Constructor & Destructor Documentation

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

Standard Constructor.

Definition at line 1378 of file DataSvc.cpp.

01379 : base_class(name,svc), m_rootCLID( /*CLID_Event*/ 110),
01380   m_rootName( "/Event"), m_root(0)
01381 {
01382   m_dataLoader = 0;
01383   m_inhibitMap = 0;
01384   m_incidentSvc = 0;
01385   m_forceLeaves = false;
01386   m_enableFaultHdlr = false;
01387   m_enableAccessHdlr = false;
01388   m_faultName  = "DataFault";
01389   m_accessName = "DataAccess";
01390   declareProperty("RootCLID",            m_rootCLID);
01391   declareProperty("RootName",            m_rootName);
01392   declareProperty("ForceLeaves",         m_forceLeaves);
01393   declareProperty("InhibitPathes",       m_inhibitPathes);
01394   declareProperty("DataFaultName",       m_faultName);
01395   declareProperty("DataAccessName",      m_accessName);
01396   declareProperty("EnableFaultHandler",  m_enableFaultHdlr);
01397   declareProperty("EnableAccessHandler", m_enableAccessHdlr);
01398 }

DataSvc::~DataSvc (  )  [virtual]

Standard Destructor.

Definition at line 1401 of file DataSvc.cpp.

01401                    {
01402   setDataLoader(0).ignore();
01403   resetPreLoad().ignore();
01404   clearStore().ignore();
01405 }

DataSvc::DataSvc ( const DataSvc  )  [private]

Fake copy constructor (never implemented).


Member Function Documentation

CLID DataSvc::rootCLID (  )  const [virtual]

IDataManagerSvc: Accessor for root event CLID.

CLID for root Event.

Definition at line 1356 of file DataSvc.cpp.

01356                              {
01357   return( (CLID)m_rootCLID );
01358 }

std::string DataSvc::rootName (  )  const [virtual]

IDataManagerSvc: Accessor for root event name.

Name for root Event.

Definition at line 1361 of file DataSvc.cpp.

01361                                   {
01362   return( m_rootName );
01363 }

StatusCode DataSvc::registerAddress ( const std::string fullPath,
IOpaqueAddress pAddress 
) [virtual]

IDataManagerSvc: Register object address with the data store.

Definition at line 247 of file DataSvc.cpp.

00248                                                                 {
00249   if ( fullPath.length() > 0 )    {
00250     if ( fullPath[0] != SEPARATOR )   {
00251       return registerAddress(m_root, fullPath, pAddress);
00252     }
00253     IRegistry* pRegistry = 0;
00254     return registerAddress(pRegistry, fullPath, pAddress);
00255   }
00256   return INVALID_OBJ_PATH;
00257 }

StatusCode DataSvc::registerAddress ( DataObject parentObj,
const std::string objectPath,
IOpaqueAddress pAddress 
) [virtual]

IDataManagerSvc: Register object address with the data store.

Definition at line 260 of file DataSvc.cpp.

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

StatusCode DataSvc::registerAddress ( IRegistry parentObj,
const std::string objectPath,
IOpaqueAddress pAddress 
) [virtual]

IDataManagerSvc: Register object address with the data store.

Definition at line 268 of file DataSvc.cpp.

00270                                                                 {
00271   if ( checkRoot() )  {
00272     if ( objPath.length() > 0 )   {
00273       if ( 0 == parentObj )   {
00274         if ( objPath[0] != SEPARATOR )    {
00275           return registerAddress(m_root, objPath, pAddress);
00276         }
00277         std::string::size_type sep = objPath.find(SEPARATOR,1);
00278         if ( sep != std::string::npos )    {
00279           std::string p_path (objPath, 0, sep);
00280           if ( p_path == m_rootName )   {
00281             std::string o_path (objPath, sep, objPath.length());
00282             return registerAddress(m_root, o_path, pAddress);
00283           }
00284         }
00285         return INVALID_PARENT;
00286       }
00287       if ( objPath[0] != SEPARATOR )    {
00288         std::string path;
00289         path  = SEPARATOR;
00290         path += objPath;
00291         return registerAddress(parentObj, path, pAddress);
00292       }
00293       RegEntry* par_entry = CAST_REGENTRY(RegEntry*,parentObj);
00294       if ( 0 != par_entry )   {
00295         std::string::size_type sep = objPath.rfind(SEPARATOR);
00296         if ( sep > 0 && sep != std::string::npos )    {
00297           std::string p_path (objPath, 0, sep);
00298           std::string o_path (objPath, sep, objPath.length());
00299           RegEntry* p_entry = par_entry->findLeaf(p_path);
00300           // Create default object leafs if the
00301           // intermediate nodes are not present
00302           if ( 0 == p_entry && m_forceLeaves )    {
00303             DataObject *pLeaf = createDefaultObject();
00304             StatusCode sc = registerObject(par_entry->identifier(),
00305                                            p_path,
00306                                            pLeaf);
00307             if ( ! sc.isSuccess() )   {
00308               delete pLeaf;
00309             }
00310             p_entry = par_entry->findLeaf(p_path);
00311           }
00312           if ( 0 != p_entry )  {
00313             return registerAddress(p_entry, o_path, pAddress);
00314           }
00315           return INVALID_PARENT;
00316         }
00317         StatusCode status = par_entry->add(objPath, pAddress);
00318         if ( status.isSuccess() )   {
00319           return status;
00320         }
00321         return DOUBL_OBJ_PATH;
00322       }
00323       return INVALID_PARENT;
00324     }
00325     return INVALID_OBJ_PATH;
00326   }
00327   return INVALID_ROOT;
00328 }

StatusCode DataSvc::unregisterAddress ( const std::string fullPath  )  [virtual]

IDataManagerSvc: Unregister object address from the data store.

Definition at line 331 of file DataSvc.cpp.

00331                                                                   {
00332   if ( fullPath.length() > 0 )    {
00333     IRegistry* pRegistry = 0;
00334     if ( fullPath[0] != SEPARATOR )   {
00335       return unregisterAddress(m_root, fullPath);
00336     }
00337     return unregisterAddress(pRegistry, fullPath);
00338   }
00339   return INVALID_OBJ_PATH;
00340 }

StatusCode DataSvc::unregisterAddress ( DataObject pParent,
const std::string objPath 
) [virtual]

IDataManagerSvc: Unregister object address from the data store.

Definition at line 343 of file DataSvc.cpp.

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

StatusCode DataSvc::unregisterAddress ( IRegistry pParent,
const std::string objPath 
) [virtual]

IDataManagerSvc: Unregister object address from the data store.

Definition at line 350 of file DataSvc.cpp.

00351                                                                   {
00352   if ( checkRoot() )  {
00353     if ( objPath.length() > 0 )   {
00354       if ( 0 == pParent )   {
00355         if ( objPath[0] != SEPARATOR )    {
00356           return unregisterAddress(m_root, objPath);
00357         }
00358         std::string::size_type sep = objPath.find(SEPARATOR,1);
00359         if ( sep != std::string::npos )    {
00360           std::string p_path (objPath, 0, sep);
00361           if ( p_path == m_rootName )   {
00362             std::string o_path (objPath, sep, objPath.length());
00363             return unregisterAddress(m_root, o_path);
00364           }
00365         }
00366         return INVALID_PARENT;
00367       }
00368       if ( objPath[0] != SEPARATOR )    {
00369         std::string path;
00370         path  = SEPARATOR;
00371         path += objPath;
00372         return unregisterAddress(pParent, path);
00373       }
00374       RegEntry* node_entry = CAST_REGENTRY(RegEntry*,pParent);
00375       if ( 0 != node_entry )   {
00376         RegEntry* leaf_entry = node_entry->findLeaf(objPath);
00377         if ( 0 != leaf_entry )    {
00378           std::string::size_type sep = objPath.rfind(SEPARATOR);
00379           if ( sep > 0 && sep != std::string::npos )    {
00380             std::string path = objPath.substr(sep);
00381             return unregisterAddress(leaf_entry->parent(), path);
00382           }
00383           StatusCode status = node_entry->remove(objPath);
00384           if ( status.isSuccess() )   {
00385             return status;
00386           }
00387         }
00388       }
00389       return INVALID_PARENT;
00390     }
00391     return INVALID_OBJ_PATH;
00392   }
00393   return INVALID_ROOT;
00394 }

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 222 of file DataSvc.cpp.

00223                                                                   {
00224   if ( pObject )    {
00225     return objectLeaves(pObject->registry(), leaves);
00226   }
00227   return INVALID_OBJECT;
00228 }

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 233 of file DataSvc.cpp.

00234                                                                   {
00235   if ( checkRoot() )    {
00236     const RegEntry* node_entry = CAST_REGENTRY(const RegEntry*,pRegistry);
00237     if ( node_entry )   {
00238       leaves = node_entry->leaves();
00239       return StatusCode::SUCCESS;
00240     }
00241     return INVALID_OBJECT;
00242   }
00243   return INVALID_ROOT;
00244 }

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

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

Definition at line 200 of file DataSvc.cpp.

00201                                                            {
00202   if ( pObject )    {
00203     return objectParent(pObject->registry(), refpParent);
00204   }
00205   return INVALID_OBJECT;
00206 }

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

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

Definition at line 208 of file DataSvc.cpp.

00209                                                           {
00210   if ( checkRoot() )    {
00211     const RegEntry* node_entry = CAST_REGENTRY(const RegEntry*,pRegistry);
00212     if ( node_entry )   {
00213       refpParent = node_entry->parent();
00214       return StatusCode::SUCCESS;
00215     }
00216     return INVALID_OBJECT;
00217   }
00218   return INVALID_ROOT;
00219 }

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.

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

Definition at line 55 of file DataSvc.cpp.

00055                                                                   {
00056   DataObject* pObject = 0;
00057   StatusCode status = findObject(sub_tree_path, pObject);
00058   if ( status.isSuccess() )   {
00059     RegEntry* node_entry = CAST_REGENTRY(RegEntry*,pObject->registry());
00060     if ( 0 != node_entry )   {
00061       RegEntry* parent = node_entry->parentEntry();
00062       if ( 0 != parent )  {
00063         parent->remove(node_entry);
00064         return StatusCode::SUCCESS;
00065       }
00066       return INVALID_PARENT;
00067     }
00068     return INVALID_OBJECT;
00069   }
00070   return status;
00071 }

StatusCode DataSvc::clearSubTree ( DataObject pObject  )  [virtual]

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

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

Definition at line 76 of file DataSvc.cpp.

00076                                                        {
00077   if ( checkRoot() )  {
00078     RegEntry* entry = CAST_REGENTRY(RegEntry*,pObject->registry());
00079     if ( 0 != entry )   {
00080       RegEntry* parent = entry->parentEntry();
00081       if ( 0 != parent )  {
00082         parent->remove(entry);
00083         return SUCCESS;
00084       }
00085       return INVALID_PARENT;
00086     }
00087     return INVALID_OBJECT;
00088   }
00089   return INVALID_ROOT;
00090 }

StatusCode DataSvc::clearStore (  )  [virtual]

IDataManagerSvc: Remove all data objects in the data store.

Reimplemented in DetDataSvc.

Definition at line 93 of file DataSvc.cpp.

00093                                  {
00094   if ( checkRoot() )    {
00095     m_root->release();
00096     m_root = 0;
00097     return SUCCESS;
00098   }
00099   return INVALID_ROOT;
00100 }

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 105 of file DataSvc.cpp.

00106                                                                {
00107   DataObject* pO = 0;
00108   StatusCode status = findObject(sub_tree_path, pO);
00109   if ( status.isSuccess() )   {
00110     status = traverseSubTree(pO, pAgent);
00111   }
00112   return status;
00113 }

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 116 of file DataSvc.cpp.

00117                                                                  {
00118   if ( checkRoot() )    {
00119     RegEntry* entry = CAST_REGENTRY(RegEntry*,pObject->registry());
00120     if ( 0 != entry )   {
00121       return entry->traverseTree(pAgent);
00122     }
00123     return INVALID_OBJECT;
00124   }
00125   return INVALID_ROOT;
00126 }

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 129 of file DataSvc.cpp.

00129                                                           {
00130   if ( checkRoot() )    {
00131     return m_root->traverseTree(pAgent);
00132   }
00133   return INVALID_ROOT;
00134 }

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.

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

Takes care to clear the store before reinitializing it

Takes care to clear the store before reinitializing it

Definition at line 140 of file DataSvc.cpp.

00141                                                      {
00142   clearStore().ignore();
00143   return i_setRoot (root_path, pRootObj);
00144 }

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.

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

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 151 of file DataSvc.cpp.

00152                                                        {
00153   if ( 0 != pRootObj )  {
00154     m_root = new RegEntry(root_path);
00155     m_root->makeHard(pRootObj);
00156     m_root->setDataSvc(this);
00157     preLoad().ignore();
00158   }
00159   return SUCCESS;
00160 }

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.

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

Takes care to clear the store before reinitializing it

Definition at line 166 of file DataSvc.cpp.

00167                                                           {
00168   clearStore().ignore();
00169   return i_setRoot (root_path, pRootAddr);
00170 }

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.

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

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 177 of file DataSvc.cpp.

00178                                                             {
00179   if ( 0 != pRootAddr )  {
00180     m_root = new RegEntry(root_path);
00181     m_root->makeHard(pRootAddr);
00182     m_root->setDataSvc(this);
00183     preLoad().ignore();
00184   }
00185   return SUCCESS;
00186 }

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 189 of file DataSvc.cpp.

00189                                                                 {
00190   if ( 0 != pDataLoader  ) pDataLoader->addRef();
00191   if ( 0 != m_dataLoader ) m_dataLoader->release();
00192   if ( 0 != pDataLoader  )    {
00193     pDataLoader->setDataProvider(this).ignore();
00194   }
00195   m_dataLoader = pDataLoader;
00196   return SUCCESS;
00197 }

StatusCode DataSvc::addPreLoadItem ( const DataStoreItem item  )  [virtual]

Add an item to the preload list.

Definition at line 1233 of file DataSvc.cpp.

01233                                                                {
01234   LoadItems::iterator i = std::find(m_preLoads.begin(), m_preLoads.end(), item);
01235   if ( i == m_preLoads.end() )    {
01236     m_preLoads.push_back(item);
01237   }
01238   return StatusCode::SUCCESS;
01239 }

StatusCode DataSvc::addPreLoadItem ( const std::string itemPath  )  [virtual]

Add an item to the preload list.

Definition at line 1242 of file DataSvc.cpp.

01242                                                                {
01243   return addPreLoadItem( DataStoreItem(itemPath,1) );
01244 }

StatusCode DataSvc::removePreLoadItem ( const DataStoreItem item  )  [virtual]

Remove an item from the preload list.

Definition at line 1247 of file DataSvc.cpp.

01247                                                                  {
01248   LoadItems::iterator i =
01249     std::remove(m_preLoads.begin(), m_preLoads.end(), item);
01250   if ( i != m_preLoads.end() )  {
01251     m_preLoads.erase(i, m_preLoads.end());
01252   }
01253   return StatusCode::SUCCESS;
01254 }

StatusCode DataSvc::removePreLoadItem ( const std::string itemPath  )  [virtual]

Add an item to the preload list.

Definition at line 1257 of file DataSvc.cpp.

01257                                                                   {
01258   return removePreLoadItem( DataStoreItem(itemPath,1) );
01259 }

StatusCode DataSvc::resetPreLoad (  )  [virtual]

Clear the preload list.

Definition at line 1262 of file DataSvc.cpp.

01262                                     {
01263   m_preLoads.erase(m_preLoads.begin(), m_preLoads.end());
01264   return StatusCode::SUCCESS;
01265 }

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 1268 of file DataSvc.cpp.

01268                                                                              {
01269   //unused:  StatusCode sc = StatusCode::FAILURE;
01270   if ( 0 != pObject && depth++ < load_depth )    {
01271     RegEntry* dir = CAST_REGENTRY(RegEntry*,pObject->registry());
01272     if ( 0 != dir )   {
01273       for (RegEntry::Iterator i = dir->begin(); i != dir->end(); i++ )    {
01274         DataObject *pObj = 0;
01275         StatusCode status = retrieveObject(pObject, (*i)->name(), pObj);
01276         if ( status.isSuccess() && depth < load_depth )   {
01277           preLoad(depth, load_depth, pObj).ignore();
01278         }
01279       }
01280     }
01281   }
01282   return StatusCode::SUCCESS;
01283 }

StatusCode DataSvc::preLoad (  )  [virtual]

load all preload items of the list

Definition at line 1286 of file DataSvc.cpp.

01286                               {
01287   DataObject* pObj = 0;
01288   for (LoadItems::iterator i = m_preLoads.begin(); i != m_preLoads.end(); i++) {
01289     StatusCode sc = retrieveObject( (*i).path(), pObj);
01290     int load_depth = (*i).depth();
01291     if ( sc.isSuccess() && load_depth > 1 )   {
01292       preLoad(1, load_depth, pObj).ignore();
01293     }
01294   }
01295   return StatusCode::SUCCESS;
01296 }

StatusCode DataSvc::registerObject ( const std::string fullPath,
DataObject pObject 
) [virtual]

Register object with the data store.

Definition at line 397 of file DataSvc.cpp.

00398                                                            {
00399   return registerObject(0, fullPath, pObject);
00400 }

StatusCode DataSvc::registerObject ( const std::string parentPath,
const std::string objPath,
DataObject pObject 
) [virtual]

Register object with the data store.

Definition at line 404 of file DataSvc.cpp.

00406                                                            {
00407   DataObject* pO = 0;
00408   StatusCode status = retrieveObject(parentPath, pO);
00409   if ( !status.isSuccess() && m_forceLeaves )   {
00410     pO = createDefaultObject();
00411     status = registerObject(parentPath, pO);
00412     if ( !status.isSuccess() )   {
00413       pO->release();
00414     }
00415   }
00416   if ( status.isSuccess() )   {
00417     status = registerObject(pO, objPath, pObject);
00418   }
00419   return status;
00420 }

StatusCode DataSvc::registerObject ( const std::string parentPath,
int  item,
DataObject pObject 
) [virtual]

Register object with the data store.

Definition at line 423 of file DataSvc.cpp.

00425                                                           {
00426   char buffer[32] = "/";
00427   ::_itoa( item, &buffer[1] , 10 );
00428   return registerObject(parentPath, buffer, pObject);
00429 }

StatusCode DataSvc::registerObject ( DataObject parentObj,
const std::string objPath,
DataObject pObject 
) [virtual]

Register object with the data store.

Definition at line 441 of file DataSvc.cpp.

00443                                                           {
00444   if ( checkRoot() )  {
00445     if ( 0 == parentObj )   {
00446       if ( objPath.length() > 0 )   {
00447         if ( objPath[0] == SEPARATOR )    {
00448           std::string::size_type sep = objPath.find(SEPARATOR,1);
00449           if ( sep != std::string::npos )    {
00450             std::string p_path (objPath, 0, sep);
00451             std::string o_path (objPath, sep, objPath.length());
00452             return registerObject(p_path, o_path, pObject);
00453           }
00454         }
00455         else  {
00456           return registerObject(m_rootName, objPath, pObject);
00457         }
00458       }
00459       return INVALID_OBJ_PATH;
00460     }
00461     RegEntry* node_entry = CAST_REGENTRY(RegEntry*,parentObj->registry());
00462     if ( 0 != node_entry )   {
00463       StatusCode status = INVALID_PARENT;
00464       std::string::size_type sep = objPath.find(SEPARATOR,1);
00465       if ( sep != std::string::npos )    {
00466         std::string p_path (objPath, 0, sep);
00467         std::string o_path (objPath, sep, objPath.length());
00468         RegEntry* par_entry = node_entry->findLeaf(p_path);
00469         // Create default object leafs if the
00470         // intermediate nodes are not present
00471         if ( 0 == par_entry && m_forceLeaves )    {
00472           DataObject *pLeaf = createDefaultObject();
00473           StatusCode sc = registerObject(parentObj, p_path, pLeaf);
00474           if ( ! sc.isSuccess() )   {
00475             delete pLeaf;
00476           }
00477           par_entry = node_entry->findLeaf(p_path);
00478         }
00479         else if ( 0 != par_entry && par_entry->object() == 0 )  {
00480           status = retrieveEntry( node_entry, p_path, par_entry);
00481           if ( !status.isSuccess() && !par_entry->address() && m_forceLeaves )  {
00482             DataObject *pLeaf = createDefaultObject();
00483             StatusCode sc = registerObject(parentObj, p_path, pLeaf);
00484             if ( ! sc.isSuccess() )   {
00485               delete pLeaf;
00486             }
00487             par_entry = node_entry->findLeaf(p_path);
00488           }
00489         }
00490         node_entry = par_entry;
00491         if ( 0 != node_entry )    {
00492           DataObject* obj = node_entry->object();
00493           if ( 0 != obj )   {
00494             status = registerObject( obj, o_path, pObject );
00495           }
00496         }
00497       }
00498       else   {
00499         RegEntry* leaf = node_entry->findLeaf(objPath);
00500         if ( 0 == leaf )    {
00501           status = node_entry->add( objPath, pObject );
00502         }
00503         else    {
00504           DataObject* obj = leaf->object();
00505           if ( 0 == obj )    {
00506             if (0 == pObject) {
00507               MsgStream log(msgSvc(), name());
00508               log << MSG::ERROR
00509                   << "registerObject: trying to register null DataObject" << endmsg;
00510               return StatusCode::FAILURE;
00511             }
00512             else  {
00513               pObject->setRegistry(leaf);
00514             }
00515             leaf->setAddress(0);
00516             leaf->setObject(pObject);
00517             status = StatusCode::SUCCESS;
00518           }
00519           else  {
00520             status = DOUBL_OBJ_PATH;
00521           }
00522         }
00523       }
00524       return status;
00525     }
00526     return INVALID_PARENT;
00527   }
00528   return INVALID_ROOT;
00529 }

StatusCode DataSvc::registerObject ( DataObject parentObj,
int  item,
DataObject pObject 
) [virtual]

Register object with the data store.

Definition at line 432 of file DataSvc.cpp.

00434                                                           {
00435   char buffer[32] = "/";
00436   ::_itoa( item, &buffer[1] , 10 );
00437   return registerObject(parentObj, buffer, pObject);
00438 }

StatusCode DataSvc::unregisterObject ( const std::string fullPath  )  [virtual]

Unregister object from the data store.

Definition at line 532 of file DataSvc.cpp.

00532                                                                 {
00533   DataObject* pObject = 0;
00534   StatusCode status = findObject(fullPath, pObject);
00535   if ( status.isSuccess() )   {
00536     RegEntry* pEntry = CAST_REGENTRY(RegEntry*,pObject->registry());
00537     if ( 0 != pEntry )    {
00538       if ( pEntry->isEmpty() )    {
00539         RegEntry* pParent = pEntry->parentEntry();
00540         if ( 0 != pParent )   {
00541           if ( 0 != pObject )    {
00542             pObject->addRef();
00543           }
00544           pParent->remove(pEntry);
00545           return StatusCode::SUCCESS;
00546         }
00547         return INVALID_PARENT;
00548       }
00549       return DIR_NOT_EMPTY;
00550     }
00551     return INVALID_ROOT;
00552   }
00553   return status;
00554 }

StatusCode DataSvc::unregisterObject ( const std::string parentPath,
const std::string objectPath 
) [virtual]

Unregister object from the data store.

Definition at line 557 of file DataSvc.cpp.

00558                                                                  {
00559   DataObject* pO = 0;
00560   StatusCode status = findObject(parentPath, pO);
00561   if ( status.isSuccess() )   {
00562     status = unregisterObject(pO, objPath);
00563   }
00564   return status;
00565 }

StatusCode DataSvc::unregisterObject ( const std::string parentPath,
int  item 
) [virtual]

Unregister object from the data store.

Definition at line 568 of file DataSvc.cpp.

00568                                                                           {
00569   char objPath[32] = "/";
00570   ::_itoa( item, &objPath[1] , 10 );
00571   return unregisterObject(parentPath, objPath);
00572 }

StatusCode DataSvc::unregisterObject ( DataObject pObject  )  [virtual]

Unregister object from the data store.

Definition at line 575 of file DataSvc.cpp.

00575                                                            {
00576   if ( checkRoot() )  {
00577     RegEntry* entry = m_root->findLeaf(pObject);
00578     if ( 0 != entry )   {
00579       RegEntry* parent = entry->parentEntry();
00580       if ( 0 != parent )    {
00581         if ( entry->isEmpty() )    {
00582           if ( 0 != entry->object() )    {
00583             entry->object()->addRef();
00584           }
00585           if ( 0 != parent )  {
00586             parent->remove(entry);
00587           }
00588           return SUCCESS;
00589         }
00590         return INVALID_PARENT;
00591       }
00592       return DIR_NOT_EMPTY;
00593     }
00594     return INVALID_OBJECT;
00595   }
00596   return INVALID_ROOT;
00597 }

StatusCode DataSvc::unregisterObject ( DataObject pObject,
const std::string objectPath 
) [virtual]

Unregister object from the data store.

Definition at line 600 of file DataSvc.cpp.

00601                                                                    {
00602   if ( checkRoot() )  {
00603     try   {
00604       RegEntry* parent = CAST_REGENTRY(RegEntry*,pParentObj->registry());
00605       if ( 0 != parent )   {
00606         RegEntry* entry = parent->findLeaf(objectPath);
00607         if ( 0 != entry )   {
00608           if ( entry->isEmpty() )    {
00609             if ( 0 != entry->object() )    {
00610               entry->object()->addRef();
00611             }
00612             parent->remove(entry);
00613             return SUCCESS;
00614           }
00615           return DIR_NOT_EMPTY;
00616         }
00617         return INVALID_OBJECT;
00618       }
00619     }
00620     catch(...) {
00621     }
00622     return INVALID_PARENT;
00623   }
00624   return INVALID_ROOT;
00625 }

StatusCode DataSvc::unregisterObject ( DataObject pObject,
int  item 
) [virtual]

Unregister object from the data store.

Definition at line 628 of file DataSvc.cpp.

00628                                                                         {
00629   char objPath[32] = "/";
00630   ::_itoa( item, &objPath[1] , 10 );
00631   return unregisterObject(pParentObj, objPath);
00632 }

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 860 of file DataSvc.cpp.

00862                                                            {
00863   pObject = 0;
00864   RegEntry *result = 0, *parent = CAST_REGENTRY(RegEntry*,pRegistry);
00865   StatusCode status = retrieveEntry(parent, path, result);
00866   if ( status.isSuccess() )   {
00867     pObject = result->object();
00868   }
00869   return status;
00870 }

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

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

Definition at line 873 of file DataSvc.cpp.

00874                                                            {
00875   IRegistry* nullDir = 0;
00876   return retrieveObject(nullDir, fullPath, pObject);
00877 }

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 880 of file DataSvc.cpp.

00882                                                            {
00883   DataObject* parent = 0;
00884   StatusCode status = retrieveObject(parentPath, parent);
00885   if ( status.isSuccess() )   {
00886     status = retrieveObject (parent, objectPath, pObject);
00887   }
00888   return status;
00889 }

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 892 of file DataSvc.cpp.

00894                                                            {
00895   char buffer[32] = "/";
00896   ::_itoa(item,&buffer[1],10);
00897   return retrieveObject(parentPath, buffer, pObject);
00898 }

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

Retrieve object from data store.

Definition at line 901 of file DataSvc.cpp.

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

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

Retrieve object from data store.

Retrieve registry entry from store.

Definition at line 909 of file DataSvc.cpp.

00911                                                           {
00912   char buffer[32] = "/";
00913   ::_itoa(item,&buffer[1],10);
00914   return retrieveObject(parentObj, buffer, pObject);
00915 }

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.

00938                                                        {
00939   pObject = 0;
00940   if ( checkRoot() )  {
00941     if ( path.length() == 0 || path == m_rootName )   {
00942       pObject = m_root->object();
00943       return (0 == pObject) ? OBJ_NOT_LOADED : IDataProviderSvc_NO_ERROR;
00944     }
00945     else if ( path[0] != SEPARATOR )    {
00946       return findObject(m_rootName, path, pObject);
00947     }
00948     return findObject((IRegistry*)0, path, pObject);
00949   }
00950   return INVALID_ROOT;
00951 }

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.

00920                                                        {
00921   pObject = 0;
00922   IRegistry* pReg = (0==pRegistry) ? m_root : pRegistry;
00923   RegEntry* root_entry = CAST_REGENTRY(RegEntry*, pReg);
00924   if ( 0 != root_entry )    {
00925     if ( path.length() > 0 )  {
00926       pReg = root_entry->find(path);
00927     }
00928     if ( 0 == pReg )    {
00929       return INVALID_OBJ_PATH;
00930     }
00931     pObject = pReg->object();
00932   }
00933   return (0 == pObject) ? OBJ_NOT_LOADED : IDataProviderSvc_NO_ERROR;
00934 }

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.

00956                                                        {
00957   DataObject* parent = 0;
00958   StatusCode status = findObject(parentPath, parent);
00959   if ( status.isSuccess() )   {
00960     status = findObject (parent, objectPath, pObject);
00961   }
00962   return status;
00963 }

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.

00967                                                                  {
00968   char buffer[32] = "/";
00969   ::_itoa(item,&buffer[1],10);
00970   return findObject(parentPath, buffer, pObject);
00971 }

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 983 of file DataSvc.cpp.

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

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 974 of file DataSvc.cpp.

00976                                                         {
00977   char buffer[32] = "/";
00978   ::_itoa(item,&buffer[1],10);
00979   return findObject(parentObj, buffer, pObject);
00980 }

StatusCode DataSvc::linkObject ( IRegistry from,
const std::string objPath,
DataObject to 
) [virtual]

Add a link to another object.

Definition at line 1088 of file DataSvc.cpp.

01089                                                                          {
01090   if ( checkRoot() )  {
01091     try   {
01092       RegEntry* from_entry = CAST_REGENTRY(RegEntry*,from);
01093       if ( 0 != from_entry )    {
01094         // First check if both objects are already registered to the store
01095         RegEntry* to_entry   = m_root->findLeaf(to);
01096         if ( 0 == to_entry )   {
01097           return INVALID_OBJECT;
01098         }
01099         else  {
01100           std::string::size_type sep = objPath.rfind(SEPARATOR);
01101           if ( sep > 0 && sep != std::string::npos )    {   // in case the objPath is a sub-directory itself
01102             DataObject* pO = 0;
01103             std::string fromPath(objPath, 0, sep);
01104             StatusCode sc = retrieveObject(from, fromPath, pO);
01105             if ( sc.isSuccess() )    {
01106               std::string toPath(objPath, sep, objPath.length());
01107               sc = linkObject(pO->registry(), toPath, to);
01108             }
01109             return sc;
01110           }
01111           // Now register the soft link
01112           StatusCode status = from_entry->add( objPath, to, true);
01113           return status.isSuccess() ?
01114             IDataProviderSvc_NO_ERROR : DOUBL_OBJ_PATH;
01115         }
01116       }
01117     }
01118     catch (...) {
01119     }
01120     return INVALID_PARENT;
01121   }
01122   return INVALID_ROOT;
01123 }

StatusCode DataSvc::linkObject ( const std::string fromPath,
const std::string objPath,
DataObject to 
) [virtual]

Add a link to another object.

Definition at line 1141 of file DataSvc.cpp.

01143                                                   {
01144   DataObject* pO = 0;
01145   StatusCode status = retrieveObject(from, pO);
01146   if ( status.isSuccess() )   {
01147     return linkObject(pO->registry(), objPath, to);
01148   }
01149   return status;
01150 }

StatusCode DataSvc::linkObject ( DataObject from,
const std::string objPath,
DataObject to 
) [virtual]

Add a link to another object.

Definition at line 1153 of file DataSvc.cpp.

01155                                                   {
01156   if ( 0 != from )    {
01157     IRegistry* from_entry = from->registry();
01158     if ( 0 != from_entry )   {
01159       return linkObject( from_entry, objPath, to);
01160     }
01161   }
01162   return INVALID_PARENT;
01163 }

StatusCode DataSvc::linkObject ( const std::string fullPath,
DataObject to 
) [virtual]

Add a link to another object.

Definition at line 1126 of file DataSvc.cpp.

01127                                                   {
01128   if ( fullPath.length() > 0 )    {
01129     if ( fullPath[0] != SEPARATOR )   {
01130       return linkObject(m_rootName, fullPath, to);
01131     }
01132     std::string::size_type sep = fullPath.rfind(SEPARATOR);
01133     std::string objPath(fullPath, sep, fullPath.length());
01134     std::string fromPath(fullPath, 0, sep);
01135     return linkObject( fromPath, objPath, to);
01136   }
01137   return INVALID_OBJ_PATH;
01138 }

StatusCode DataSvc::unlinkObject ( IRegistry from,
const std::string objPath 
) [virtual]

Remove a link to another object.

Definition at line 1166 of file DataSvc.cpp.

01167                                                               {
01168   if ( checkRoot() )  {
01169     try   {
01170       RegEntry* from_entry = CAST_REGENTRY(RegEntry*,from);
01171       if ( 0 != from_entry )    {
01172         std::string::size_type sep = objPath.rfind(SEPARATOR);
01173         if ( sep > 0 && sep != std::string::npos )    {  // in case the objPath is a sub-directory itself
01174           DataObject* pO = 0;
01175           std::string fromPath(objPath, 0, sep);
01176           StatusCode sc = findObject(from, fromPath, pO);
01177           if ( sc.isSuccess() )    {
01178             std::string toPath(objPath, sep, objPath.length());
01179             sc = unlinkObject(pO->registry(), toPath);
01180           }
01181           return sc;
01182         }
01183         StatusCode status = from_entry->remove( objPath );
01184         if ( status.isSuccess() )     {
01185           return status;
01186         }
01187         return INVALID_OBJ_PATH;
01188       }
01189     }
01190     catch (...)   {
01191     }
01192     return INVALID_PARENT;
01193   }
01194   return INVALID_ROOT;
01195 }

StatusCode DataSvc::unlinkObject ( const std::string fromPath,
const std::string objPath 
) [virtual]

Remove a link to another object.

Definition at line 1212 of file DataSvc.cpp.

01213                                                               {
01214   DataObject* pObject = 0;
01215   StatusCode status = findObject(from, pObject);
01216   if ( status.isSuccess() )   {
01217     status = unlinkObject(pObject->registry(), objPath);
01218   }
01219   return status;
01220 }

StatusCode DataSvc::unlinkObject ( DataObject fromObj,
const std::string objPath 
) [virtual]

Remove a link to another object.

Definition at line 1223 of file DataSvc.cpp.

01224                                                               {
01225   if ( checkRoot() )  {
01226     IRegistry* from_entry = m_root->findLeaf(from);
01227     return unlinkObject(from_entry, objPath);
01228   }
01229   return INVALID_ROOT;
01230 }

StatusCode DataSvc::unlinkObject ( const std::string fullPath  )  [virtual]

Remove a link to another object.

Definition at line 1198 of file DataSvc.cpp.

01198                                                              {
01199   if ( fullPath.length() > 0 )    {
01200     if ( fullPath[0] != SEPARATOR )   {
01201       return unlinkObject(m_rootName, fullPath);
01202     }
01203     std::string::size_type sep = fullPath.rfind(SEPARATOR);
01204     std::string objPath(fullPath, sep, fullPath.length());
01205     std::string fromPath(fullPath, 0, sep);
01206     return unlinkObject(fromPath, objPath);
01207   }
01208   return INVALID_OBJ_PATH;
01209 }

StatusCode DataSvc::updateObject ( IRegistry pDirectory  )  [virtual]

Update object identified by its directory entry.

Update object.

Definition at line 1001 of file DataSvc.cpp.

01001                                                         {
01002   if ( 0 == pRegistry )  {                     // Precondition:
01003     return INVALID_OBJ_ADDR;                   // Addres must be valid
01004   }
01005   DataObject* toUpdate = pRegistry->object();
01006   if ( 0 == toUpdate )  {                      // Try first to load
01007     return loadObject(pRegistry);
01008   }
01009   return updateObject(toUpdate);
01010 }

StatusCode DataSvc::updateObject ( const std::string updatePath  )  [virtual]

Update object.

Definition at line 991 of file DataSvc.cpp.

00991                                                               {
00992   DataObject* pO = 0;
00993   StatusCode status = findObject(updatePath, pO);
00994   if ( status.isSuccess() )   {
00995     return updateObject(pO);
00996   }
00997   return retrieveObject(updatePath, pO);
00998 }

StatusCode DataSvc::updateObject ( DataObject toUpdate  )  [virtual]

Update object.

Reimplemented in DetDataSvc.

Definition at line 1013 of file DataSvc.cpp.

01013                                                         {
01014   StatusCode status = INVALID_OBJ_ADDR;
01015   if ( 0 == toUpdate )  {                          // Precondition:
01016     return INVALID_OBJECT;                         // Address must be valid
01017   }
01018   IRegistry* pRegistry = toUpdate->registry();     // Precondition:
01019   if ( 0 == pRegistry )    {                       // Need valid registry
01020     return INVALID_OBJECT;
01021   }
01022   IOpaqueAddress* pAddress = pRegistry->address(); // Precondition:
01023   if ( 0 == pAddress )    {                        // Need valid address
01024     return INVALID_OBJ_ADDR;
01025   }
01026   IConversionSvc* pLoader = getDataLoader(pRegistry);
01027   if ( 0 == pLoader )   {                      // Precondition:
01028     return NO_DATA_LOADER;                     // Data loader must be present
01029   }
01030   if ( m_inhibitPathes.size() > 0 )   {
01031     const std::string& ident = pRegistry->identifier();
01032     std::vector<std::string>::iterator inhibit =
01033       std::find(m_inhibitPathes.begin(), m_inhibitPathes.end(), ident);
01034     if ( inhibit != m_inhibitPathes.end() )   {
01035       return NO_ACCESS;
01036     }
01037   }
01038   try   {
01039     status = pLoader->updateObj(pAddress, toUpdate);  // Call data loader
01040     if ( status.isSuccess() )   {
01041       status = pLoader->updateObjRefs(pAddress, toUpdate);
01042     }
01043   }
01044   catch( const GaudiException& exc ) {
01045     throw GaudiException("GaudiException in updateObject() " +
01046                          pRegistry->name(),
01047                          name(),
01048                          StatusCode::FAILURE, exc);
01049   }
01050   catch( const std::exception& x) {
01051     throw GaudiException("std::exception in updateObject() " +
01052                          pRegistry->name() + ": " +
01053                          System::typeinfoName(typeid(x)) + ", " +
01054                          x.what(),
01055                          name(), StatusCode::FAILURE);
01056   }
01057   catch(...) {
01058     throw GaudiException("UNKN exception in updateObject() " +
01059                          pRegistry->name(),
01060       name(), StatusCode::FAILURE);
01061   }
01062   return status;
01063 }

StatusCode DataSvc::updateObject ( const std::string parentPath,
const std::string updatePath 
) [virtual]

Update object.

Definition at line 1066 of file DataSvc.cpp.

01067                                                                  {
01068   DataObject* pParent = 0;
01069   StatusCode status = findObject(parentPath, pParent);
01070   if ( status.isSuccess() )   {
01071     status = updateObject( pParent, updatePath);
01072   }
01073   return status;
01074 }

StatusCode DataSvc::updateObject ( DataObject pParent,
const std::string updatePath 
) [virtual]

Update object.

Definition at line 1077 of file DataSvc.cpp.

01078                                                                 {
01079   DataObject* pObject = 0;
01080   StatusCode status = findObject(parent, updatePath, pObject);
01081   if ( status.isSuccess() )   {
01082     status = updateObject(pObject);
01083   }
01084   return status;
01085 }

StatusCode DataSvc::initialize (  )  [virtual]

Service initialization.

Reimplemented from Service.

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

Definition at line 1299 of file DataSvc.cpp.

01299                                   {
01300   // Nothing to do: just call base class initialisation
01301   StatusCode sc = Service::initialize();
01302   if ( !sc.isSuccess() )  {
01303     return sc;
01304   }
01305   sc = service("IncidentSvc", m_incidentSvc, true);
01306   if ( !sc.isSuccess() )  {
01307     MsgStream log(msgSvc(), name());
01308     log << MSG::ERROR << "Failed to access incident service." << endmsg;
01309   }
01310   return sc;
01311 }

StatusCode DataSvc::reinitialize (  )  [virtual]

Service initialization.

Service reinitialization.

Reimplemented from Service.

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

Definition at line 1314 of file DataSvc.cpp.

01314                                     {
01315   StatusCode sc;
01316   // the finalize part is copied here
01317   setDataLoader(0).ignore();
01318   resetPreLoad().ignore();
01319   clearStore().ignore();
01320   if ( m_incidentSvc )  {
01321     m_incidentSvc->release();
01322     m_incidentSvc = 0;
01323   }
01324   // re-initialize the base class
01325   sc = Service::reinitialize();
01326   if (!sc.isSuccess()) {
01327     MsgStream log(msgSvc(), name());
01328     log << MSG::ERROR << "Unable to reinitialize base class" << endmsg;
01329     return sc;
01330   }
01331   // the initialize part is copied here
01332   sc = service("IncidentSvc", m_incidentSvc, true);
01333   if ( !sc.isSuccess() )  {
01334     MsgStream log(msgSvc(), name());
01335     log << MSG::ERROR << "Failed to access incident service." << endmsg;
01336     return sc;
01337   }
01338   // return
01339   return StatusCode::SUCCESS;
01340 }

StatusCode DataSvc::finalize ( void   )  [virtual]

Service initialization.

Service initialisation.

Reimplemented from Service.

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

Definition at line 1343 of file DataSvc.cpp.

01343                                 {
01344   // Nothing to do: just call base class initialisation
01345   setDataLoader(0).ignore();
01346   resetPreLoad().ignore();
01347   clearStore().ignore();
01348   if ( m_incidentSvc )  {
01349     m_incidentSvc->release();
01350     m_incidentSvc = 0;
01351   }
01352   return Service::finalize();
01353 }

DataSvc& DataSvc::operator= ( const DataSvc  )  [private]

Fake assignment operator (never implemented).

bool DataSvc::checkRoot (  )  [inline, protected]

Check if root path is valid.

Definition at line 390 of file DataSvc.h.

00390                       {
00391     return 0 != m_root;
00392   }

IConversionSvc * DataSvc::getDataLoader ( IRegistry pReg  )  [protected, virtual]

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

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

Reimplemented in NTupleSvc.

Definition at line 1373 of file DataSvc.cpp.

01373                                                               {
01374   return m_dataLoader;
01375 }

DataObject * DataSvc::createDefaultObject (  )  const [protected, virtual]

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

Definition at line 1366 of file DataSvc.cpp.

01366                                                     {
01367   return new DataObject();
01368 }

StatusCode DataSvc::loadObject ( IRegistry pNode  )  [protected, virtual]

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

Definition at line 671 of file DataSvc.cpp.

00671                                                      {
00672   IConversionSvc* pLoader = getDataLoader(pRegistry);
00673   return loadObject(pLoader, pRegistry);
00674 }

StatusCode DataSvc::loadObject ( IConversionSvc pLoader,
IRegistry pNode 
) [protected, virtual]

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

Definition at line 679 of file DataSvc.cpp.

00679                                                                             {
00680   StatusCode status = INVALID_OBJ_ADDR;
00681   DataObject* pObject = 0;
00682   if ( 0 == pLoader )   {         // Precondition: Data loader must be present
00683     if (handleDataFault(pRegistry) != 0) return  SUCCESS;
00684     else                                 return  NO_DATA_LOADER;
00685   }
00686   if ( 0 == pRegistry )    {      // Precondition: Directory must be valid
00687     if (handleDataFault(pRegistry) != 0) return  SUCCESS;
00688     else                                 return  INVALID_OBJ_ADDR;
00689   }
00690 
00691   MsgStream log( msgSvc(), name() );
00692   log << MSG::VERBOSE << "Requested object " << pRegistry->identifier() << endmsg;
00693 
00694   if ( m_enableAccessHdlr )  {
00695     // Fire data access incident
00696     DataIncident incident(name(), m_accessName, pRegistry->identifier());
00697     m_incidentSvc->fireIncident(incident);
00698   }
00699   if ( m_inhibitPathes.size() > 0 )   {
00700     const std::string& ident = pRegistry->identifier();
00701     std::vector<std::string>::iterator inhibit =
00702       std::find(m_inhibitPathes.begin(), m_inhibitPathes.end(), ident);
00703     if ( inhibit != m_inhibitPathes.end() )   {
00704       return NO_ACCESS;
00705     }
00706   }
00707   IOpaqueAddress* pAddress = pRegistry->address();
00708   if ( 0 == pAddress )  {         // Precondition:
00709     return INVALID_OBJ_ADDR;      // Address must be valid
00710   }
00711   try   {
00712     status = pLoader->createObj(pAddress, pObject);  // Call data loader
00713     if ( status.isSuccess() )    {
00714 
00715       log << MSG::VERBOSE << "Object " << pRegistry->identifier() << " created" << endmsg;
00716 
00717       RegEntry *pEntry = CAST_REGENTRY(RegEntry*,pRegistry);
00718       pEntry->setObject(pObject);
00719 
00720       log << MSG::VERBOSE << "Filling object " << pRegistry->identifier() << endmsg;
00721       status = pLoader->fillObjRefs(pAddress, pObject);
00722     }
00723   }
00724   catch( const GaudiException& exc ) {
00725     if ( handleDataFault(pRegistry) != 0 )  {
00726       return SUCCESS;
00727     }
00728     throw GaudiException("GaudiException in loadObject() " + pRegistry->identifier(),
00729         name(), StatusCode::FAILURE, exc);
00730   }
00731   catch( const std::exception& x) {
00732     if ( handleDataFault(pRegistry) != 0 )  {
00733       return SUCCESS;
00734     }
00735     throw GaudiException("std::exception in loadObject() " + pRegistry->identifier() +
00736         ": " + System::typeinfoName(typeid(x)) + ", " + x.what(),
00737       name(), StatusCode::FAILURE);
00738   }
00739   catch(...) {
00740     if ( handleDataFault(pRegistry) != 0 )  {
00741       return SUCCESS;
00742     }
00743     throw GaudiException("UNKN exception in loadObject() " + pRegistry->identifier(),
00744       name(), StatusCode::FAILURE);
00745   }
00746   if ( !status.isSuccess() )  {
00747     if ( handleDataFault(pRegistry) != 0 )  {
00748       return StatusCode::SUCCESS;
00749     }
00750   }
00751   if ( status.isSuccess() ) {
00752     log << MSG::VERBOSE << "Object " << pRegistry->identifier() << " successfully loaded" << endmsg;
00753   }
00754   return status;
00755 }

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

Retrieve registry entry from store.

Definition at line 758 of file DataSvc.cpp.

00760                                                       {
00761   std::string::size_type        sep    = path.find(SEPARATOR,1);
00762   StatusCode status = StatusCode(INVALID_ROOT,true);
00763   pEntry = 0;
00764   // A.Valassi 16.08.2001 avoid core dump if store is empty
00765   if ( checkRoot() )  {
00766     if ( 0 == parentObj )    {
00767       if ( path.length() == 0 || path == m_rootName )   {
00768         return retrieveEntry(m_root, "", pEntry);
00769       }
00770       else if ( path[0] != SEPARATOR )  {
00771         return retrieveEntry(m_root, path, pEntry);
00772       }
00773       else if ( sep != std::string::npos )    {
00774         if ( m_root->object() == 0 )  {
00775           RegEntry* r = 0;
00776           status = retrieveEntry(m_root, "", r);
00777           if ( !status.isSuccess() )  {
00778             return status;
00779           }
00780         }
00781         std::string o_path (path, sep, path.length());
00782         return retrieveEntry(m_root, o_path, pEntry);
00783       }
00784       return INVALID_OBJ_PATH;
00785     }
00786     if ( sep != std::string::npos )  { // the string contains a separator (after pos 0)
00787       std::string p_path (path,0,sep);
00788       std::string o_path (path,sep,path.length());
00789       if (!parentObj->object()) { // if the parent object has not been loaded yet, load it now
00790         status = loadObject(parentObj);
00791         if ( !status.isSuccess() )  {
00792           return status;
00793         }
00794       }
00795       RegEntry* root_entry = parentObj->findLeaf(p_path);
00796       if ( !root_entry && m_enableFaultHdlr )    {
00797         // If not even the parent is there, an incident
00798         // to load the parent must be fired...
00799         handleDataFault(parentObj, p_path);
00800         root_entry = parentObj->findLeaf(p_path);
00801       }
00802       if ( root_entry )    {
00803         DataObject* pO = root_entry->object();
00804         if ( 0 == pO )  {
00805           // Object is not loaded: load the object if at all possible
00806           status = loadObject(root_entry);
00807           if ( !status.isSuccess() )  {
00808             return status;
00809           }
00810         }
00811         if ( root_entry->isSoft() )    {
00812           root_entry = CAST_REGENTRY(RegEntry*,pO->registry());
00813         }
00814         return retrieveEntry (root_entry, o_path, pEntry);
00815       }
00816       return status;
00817     }
00818     else if ( path.length() == 0 )    {
00819       pEntry = parentObj;
00820     }
00821     else {
00822       if (!parentObj->object()) { // if the parent object has not been loaded yet, load it now
00823         status = loadObject(parentObj);
00824         if ( !status.isSuccess() )  {
00825           return status;
00826         }
00827       }
00828       // last leave in search: find leaf and load
00829       pEntry = parentObj->findLeaf(path);
00830       // If no registry entry was found, trigger incident for action-on-demand
00831       if ( !pEntry && m_enableFaultHdlr )  {
00832         handleDataFault(parentObj, path);
00833         pEntry = (0==path.length()) ? parentObj : parentObj->findLeaf(path);
00834       }
00835     }
00836     // Check results and return
00837     if ( 0 == pEntry )  {
00838       status = INVALID_OBJ_PATH;
00839     }
00840     else if ( 0 == pEntry->object() )  {
00841       status = loadObject(pEntry);
00842     }
00843     else if ( m_enableAccessHdlr )  {
00844       // Fire data access incident
00845       // I do not know if this is a good idea....
00846       // This fires too often!
00847       //
00848       //DataIncident incident(name(), m_accessName, pEntry->identifier());
00849       //m_incidentSvc->fireIncident(incident);
00850       status = SUCCESS;
00851     }
00852     else  {
00853       status = SUCCESS;
00854     }
00855   }
00856   return status;
00857 }

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 636 of file DataSvc.cpp.

00637 {
00638   if ( m_enableFaultHdlr )  {
00639     IRegistry* pLeaf = 0;
00640     if ( pReg && path.length() == 0 )   {
00641       DataIncident incident(name(), m_faultName, pReg->identifier());
00642       m_incidentSvc->fireIncident(incident);
00643       return pReg->object();
00644     }
00645     else if ( pReg )  {
00646       std::string p = pReg->identifier();
00647       if (path[0] != SEPARATOR ) p += SEPARATOR;
00648       p += path;
00649       DataIncident incident(name(), m_faultName, p);
00650       m_incidentSvc->fireIncident(incident);
00651       pLeaf = m_root->findLeaf(p);
00652     }
00653     else  {
00654       std::string p = m_root->identifier();
00655       if (path[0] != SEPARATOR ) p += SEPARATOR;
00656       p += path;
00657       DataIncident incident(name(), m_faultName, p);
00658       m_incidentSvc->fireIncident(incident);
00659       pLeaf = m_root->findLeaf(p);
00660     }
00661     if ( pLeaf )  {
00662       return pLeaf->object();
00663     }
00664   }
00665   return 0;
00666 }


Friends And Related Function Documentation

friend class SvcFactory< DataSvc > [friend]

The class creator is of course a friend!

Definition at line 45 of file DataSvc.h.


Member Data Documentation

Integer Property corresponding to CLID of root entry.

Definition at line 53 of file DataSvc.h.

Name of root event.

Definition at line 55 of file DataSvc.h.

Pointer to data loader service.

Definition at line 57 of file DataSvc.h.

Pointer to incident service.

Definition at line 59 of file DataSvc.h.

Items to be pre-loaded.

Definition at line 61 of file DataSvc.h.

Allow forced creation of default leaves on registerObject.

Definition at line 63 of file DataSvc.h.

Flag to enable interrupts on data access requests.

Definition at line 65 of file DataSvc.h.

Flag to enable interrupts on data creation requests.

Definition at line 67 of file DataSvc.h.

Pointer to root entry.

Definition at line 69 of file DataSvc.h.

DataSvcHelpers::InhibitMap* DataSvc::m_inhibitMap [protected]

Map with object paths to be inhibited from loading.

Definition at line 71 of file DataSvc.h.

Property for the inhibited leaves.

Definition at line 73 of file DataSvc.h.

Name of the data access incident.

Definition at line 75 of file DataSvc.h.

Name of the data fault incident.

Definition at line 77 of file DataSvc.h.


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

Generated at Wed Mar 17 18:16:52 2010 for Gaudi Framework, version v21r8 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004