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 {
35  class GAUDI_API RegistryEntry : public IRegistry {
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;
53  RegistryEntry* m_pParent;
55  IOpaqueAddress* m_pAddress;
57  DataObject* m_pObject;
59  IDataProviderSvc* m_pDataProviderSvc;
61  Store m_store;
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);
84  void setDataSvc(IDataProviderSvc* s) {
85  m_pDataProviderSvc = s;
86  }
88  virtual RegistryEntry* parentEntry() {
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
#define GAUDI_API
Definition: Kernel.h:108
list path
Definition: __init__.py:15
Data provider interface definition.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
tuple end
Definition: IOTest.py:101
Generic data agent interface.
boost::spirit::classic::position_iterator2< ForwardIterator > Iterator
Definition: Iterator.h:19
Data service base class.
Definition: DataSvc.h:40
string s
Definition: gaudirun.py:244
Opaque address interface definition.
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:31