All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RegistryEntry.h
Go to the documentation of this file.
1 // $Id: RegistryEntry.h,v 1.8 2005/07/18 16:34:05 hmd Exp $
2 #ifndef GAUDIKERNEL_REGISTRYENTRY_H
3 #define GAUDIKERNEL_REGISTRYENTRY_H
4 
5 // STL include files
6 #include <vector>
7 
8 // Framework include files
9 #include "GaudiKernel/Kernel.h"
10 #include "GaudiKernel/IRegistry.h"
11 #include <boost/utility/string_ref.hpp>
12 
13 // Forward declarations
14 class DataSvc;
15 class DataObject;
16 class IDataProviderSvc;
17 class IOpaqueAddress;
18 class IDataStoreAgent;
19 
20 
21 namespace DataSvcHelpers {
36  private:
38  typedef std::vector<IRegistry*> Store;
39  public:
40  friend class ::DataSvc;
42  typedef Store::const_iterator Iterator;
43  private:
45  unsigned long m_refCount;
47  bool m_isSoft;
49  std::string m_fullpath;
51  std::string m_path;
62 
63  private:
69  void assemblePath(std::string& buffer) const;
72  IRegistry* i_find ( const IRegistry* pDirectory ) const;
74  RegistryEntry* i_find ( boost::string_ref path ) const;
76  RegistryEntry* i_find ( const DataObject* pObject ) const;
78  RegistryEntry* i_create ( std::string name );
80  long i_add ( RegistryEntry* entry );
82  void setParent(RegistryEntry* pParent);
85  m_pDataProviderSvc = s;
86  }
89  return m_pParent;
90  }
92  RegistryEntry* findLeaf(boost::string_ref path) const {
93  return i_find(path);
94  }
96  RegistryEntry* findLeaf(const DataObject* key) const {
97  return i_find(key);
98  }
100  void makeHard (DataObject* pObject);
102  void makeHard (IOpaqueAddress* pAddress);
104  void makeSoft (DataObject* pObject);
106  void makeSoft (IOpaqueAddress* pAddress);
107  public:
109  RegistryEntry(std::string path, RegistryEntry* parent = 0);
111  virtual ~RegistryEntry();
113  virtual unsigned long release();
115  virtual unsigned long addRef() {
116  return ++m_refCount;
117  }
119  const std::string& name() const {
120  return m_path;
121  }
123  virtual const std::string& identifier() const {
124  return m_fullpath;
125  }
127  virtual IDataProviderSvc* dataSvc() const {
128  return m_pDataProviderSvc;
129  }
131  virtual DataObject* object() const {
132  return m_pObject;
133  }
135  virtual IOpaqueAddress* address() const {
136  return m_pAddress;
137  }
139  virtual IRegistry* parent() const {
140  return m_pParent;
141  }
143  virtual bool isSoft() const {
144  return m_isSoft;
145  }
147  const Store& leaves() const {
148  return m_store;
149  }
151  virtual int size() const {
152  return m_store.size();
153  }
155  virtual bool isEmpty() const {
156  return m_store.size() == 0;
157  }
159  virtual Iterator begin () const {
160  return m_store.begin();
161  }
163  virtual Iterator end () const {
164  return m_store.end();
165  }
167  virtual IRegistry* find ( const IRegistry* obj ) const {
168  return i_find(obj);
169  }
171  virtual IRegistry* find ( const std::string& path ) const {
172  return i_find(path);
173  }
175  void setAddress(IOpaqueAddress* pAddress);
177  void setObject(DataObject* obj);
178 
180  virtual long add(const std::string& name,
181  DataObject* pObject,
182  bool is_soft = false);
184  virtual long add(const std::string& name,
185  IOpaqueAddress* pAddress,
186  bool is_soft = false);
188  virtual long remove(const std::string& name);
190  virtual long add(IRegistry* obj);
192  virtual long remove(IRegistry* obj);
194  virtual long deleteElements();
196  virtual long traverseTree(IDataStoreAgent* pAgent, int level = 0);
197  };
198 }
199 #endif // GAUDIKERNEL_REGISTRYENTRY_H
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:92
virtual unsigned long addRef()
IInterface implementation: Dereference the object.
RegistryEntry * findLeaf(const DataObject *key) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:96
RegistryEntry * m_pParent
Pointer to parent.
Definition: RegistryEntry.h:53
std::vector< IRegistry * > Store
Definition of datastore type.
Definition: RegistryEntry.h:38
const Store & leaves() const
Access the leaves of the object.
Data provider interface definition.
virtual RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:88
std::string m_fullpath
String containing full path of the object (volatile)
Definition: RegistryEntry.h:49
virtual bool isSoft() const
Is the link soft or hard.
virtual IOpaqueAddress * address() const
Retrieve opaque storage address.
virtual Iterator begin() const
Return starting point for container iteration.
IDataProviderSvc * m_pDataProviderSvc
Pointer to hosting transient store.
Definition: RegistryEntry.h:59
void setDataSvc(IDataProviderSvc *s)
Set the transient data store.
Definition: RegistryEntry.h:84
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
virtual bool isEmpty() const
Simple check if the Container is empty.
Store::const_iterator Iterator
Iterator definition.
Definition: RegistryEntry.h:42
IOpaqueAddress * m_pAddress
Pointer to opaque address (load info)
Definition: RegistryEntry.h:55
virtual IDataProviderSvc * dataSvc() const
Retrieve pointer to Transient Store.
bool m_isSoft
Is the link soft or hard?
Definition: RegistryEntry.h:47
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:35
virtual IRegistry * find(const std::string &path) const
Try to find an object identified by its relative name to the directory.
DataObject * m_pObject
Pointer to object.
Definition: RegistryEntry.h:57
virtual const std::string & identifier() const
Full identifier (or key)
unsigned long m_refCount
Reference counter.
Definition: RegistryEntry.h:45
const std::string & name() const
Retrieve name of the entry.
virtual IRegistry * parent() const
Pointer to parent directory entry.
Generic data agent interface.
virtual int size() const
Return the size of the container(=number of objects)
Data service base class.
Definition: DataSvc.h:40
Store m_store
Store of leaves.
Definition: RegistryEntry.h:61
string s
Definition: gaudirun.py:210
std::string m_path
Path name.
Definition: RegistryEntry.h:51
virtual DataObject * object() const
Retrive object behind the link.
Opaque address interface definition.
#define GAUDI_API
Definition: Kernel.h:108
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:31
virtual IRegistry * find(const IRegistry *obj) const
Try to find an object identified by its pointer.
virtual Iterator end() const
Return end elemtn if the container.