RegistryEntry.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_REGISTRYENTRY_H
2 #define GAUDIKERNEL_REGISTRYENTRY_H
3 
4 // STL include files
5 #include <vector>
6 
7 // Framework include files
8 #include "GaudiKernel/Kernel.h"
9 #include "GaudiKernel/IRegistry.h"
10 #include <boost/utility/string_ref.hpp>
11 
12 // Forward declarations
13 class DataSvc;
14 class DataObject;
15 class IDataProviderSvc;
16 class IOpaqueAddress;
17 class IDataStoreAgent;
18 
19 
20 namespace DataSvcHelpers {
34  class GAUDI_API RegistryEntry : public IRegistry {
35  private:
37  typedef std::vector<IRegistry*> Store;
38  public:
39  friend class ::DataSvc;
41  typedef Store::const_iterator Iterator;
42  private:
44  unsigned long m_refCount = 0;
46  bool m_isSoft = false;
48  std::string m_fullpath;
50  std::string m_path;
52  RegistryEntry* m_pParent = nullptr;
54  IOpaqueAddress* m_pAddress = nullptr;
56  DataObject* m_pObject = nullptr;
58  IDataProviderSvc* m_pDataProviderSvc = nullptr;
60  Store m_store;
61 
62  private:
68  void assemblePath(std::string& buffer) const;
71  IRegistry* i_find ( const IRegistry* pDirectory ) const;
73  RegistryEntry* i_find ( boost::string_ref path ) const;
75  RegistryEntry* i_find ( const DataObject* pObject ) const;
77  RegistryEntry* i_create ( std::string name );
79  long i_add ( RegistryEntry* entry );
81  void setParent(RegistryEntry* pParent);
83  void setDataSvc(IDataProviderSvc* s) {
84  m_pDataProviderSvc = s;
85  }
87  virtual RegistryEntry* parentEntry() {
88  return m_pParent;
89  }
91  RegistryEntry* findLeaf(boost::string_ref path) const {
92  return i_find(path);
93  }
95  RegistryEntry* findLeaf(const DataObject* key) const {
96  return i_find(key);
97  }
99  void makeHard (DataObject* pObject);
101  void makeHard (IOpaqueAddress* pAddress);
103  void makeSoft (DataObject* pObject);
105  void makeSoft (IOpaqueAddress* pAddress);
106  public:
108  RegistryEntry(std::string path, RegistryEntry* parent = nullptr);
110  ~RegistryEntry() override;
112  unsigned long release() override;
114  unsigned long addRef() override {
115  return ++m_refCount;
116  }
118  const std::string& name() const override {
119  return m_path;
120  }
122  const std::string& identifier() const override {
123  return m_fullpath;
124  }
126  IDataProviderSvc* dataSvc() const override {
127  return m_pDataProviderSvc;
128  }
130  DataObject* object() const override {
131  return m_pObject;
132  }
134  IOpaqueAddress* address() const override {
135  return m_pAddress;
136  }
138  virtual IRegistry* parent() const {
139  return m_pParent;
140  }
142  virtual bool isSoft() const {
143  return m_isSoft;
144  }
146  const Store& leaves() const {
147  return m_store;
148  }
150  virtual int size() const {
151  return m_store.size();
152  }
154  virtual bool isEmpty() const {
155  return m_store.size() == 0;
156  }
158  virtual Iterator begin () const {
159  return m_store.begin();
160  }
162  virtual Iterator end () const {
163  return m_store.end();
164  }
166  virtual IRegistry* find ( const IRegistry* obj ) const {
167  return i_find(obj);
168  }
170  virtual IRegistry* find ( const std::string& path ) const {
171  return i_find(path);
172  }
174  void setAddress(IOpaqueAddress* pAddress) override;
176  void setObject(DataObject* obj);
177 
179  virtual long add(const std::string& name,
180  DataObject* pObject,
181  bool is_soft = false);
183  virtual long add(const std::string& name,
184  IOpaqueAddress* pAddress,
185  bool is_soft = false);
187  virtual long remove(const std::string& name);
189  virtual long add(IRegistry* obj);
191  virtual long remove(IRegistry* obj);
193  virtual long deleteElements();
195  virtual long traverseTree(IDataStoreAgent* pAgent, int level = 0);
196  };
197 }
198 #endif // GAUDIKERNEL_REGISTRYENTRY_H
#define GAUDI_API
Definition: Kernel.h:107
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:45
list path
Definition: __init__.py:15
Data provider interface definition.
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:47
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
Generic data agent interface.
boost::spirit::classic::position_iterator2< ForwardIterator > Iterator
Definition: Iterator.h:18
Data service base class.
Definition: DataSvc.h:42
string s
Definition: gaudirun.py:246
Opaque address interface definition.
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30