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 {
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);
84  m_pDataProviderSvc = s;
85  }
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
IDataProviderSvc * dataSvc() const override
Retrieve pointer to Transient Store.
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:91
#define GAUDI_API
Definition: Kernel.h:107
unsigned long addRef() override
IInterface implementation: Dereference the object.
RegistryEntry * findLeaf(const DataObject *key) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:95
list path
Definition: __init__.py:15
std::vector< IRegistry * > Store
Definition of datastore type.
Definition: RegistryEntry.h:37
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:87
std::string m_fullpath
String containing full path of the object (volatile)
Definition: RegistryEntry.h:48
virtual bool isSoft() const
Is the link soft or hard.
IOpaqueAddress * address() const override
Retrieve opaque storage address.
const std::string & name() const override
Retrieve name of the entry.
virtual Iterator begin() const
Return starting point for container iteration.
void setDataSvc(IDataProviderSvc *s)
Set the transient data store.
Definition: RegistryEntry.h:83
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
const std::string & identifier() const override
Full identifier (or key)
virtual bool isEmpty() const
Simple check if the Container is empty.
Store::const_iterator Iterator
Iterator definition.
Definition: RegistryEntry.h:41
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:34
virtual IRegistry * find(const std::string &path) const
Try to find an object identified by its relative name to the directory.
DataObject * object() const override
Retrive object behind the link.
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:42
Store m_store
Store of leaves.
Definition: RegistryEntry.h:60
string s
Definition: gaudirun.py:246
std::string m_path
Path name.
Definition: RegistryEntry.h:50
Opaque address interface definition.
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
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.