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"
10 #include <boost/utility/string_ref.hpp>
11 
12 // Forward declarations
13 class DataSvc;
14 // DP add this fwd decl for thread safety
15 class TsDataSvc;
16 class DataObject;
17 class IDataProviderSvc;
18 class IOpaqueAddress;
19 class IDataStoreAgent;
20 
21 
22 namespace DataSvcHelpers {
37  private:
40  public:
41  friend class ::DataSvc;
42  // DP add friend class: the thread safe version of the DataSvc
43  friend class ::TsDataSvc;
45  typedef Store::const_iterator Iterator;
46  private:
48  unsigned long m_refCount = 0;
50  bool m_isSoft = false;
56  RegistryEntry* m_pParent = nullptr;
58  IOpaqueAddress* m_pAddress = nullptr;
60  DataObject* m_pObject = nullptr;
62  IDataProviderSvc* m_pDataProviderSvc = nullptr;
64  Store m_store;
65 
66  private:
72  void assemblePath(std::string& buffer) const;
75  IRegistry* i_find ( const IRegistry* pDirectory ) const;
77  RegistryEntry* i_find ( boost::string_ref path ) const;
79  RegistryEntry* i_find ( const DataObject* pObject ) const;
81  RegistryEntry* i_create ( std::string name );
83  long i_add ( RegistryEntry* entry );
85  void setParent(RegistryEntry* pParent);
88  m_pDataProviderSvc = s;
89  }
92  return m_pParent;
93  }
95  RegistryEntry* findLeaf(boost::string_ref path) const {
96  return i_find(path);
97  }
99  RegistryEntry* findLeaf(const DataObject* key) const {
100  return i_find(key);
101  }
103  void makeHard (DataObject* pObject);
105  void makeHard (IOpaqueAddress* pAddress);
107  void makeSoft (DataObject* pObject);
109  void makeSoft (IOpaqueAddress* pAddress);
110  public:
112  RegistryEntry(std::string path, RegistryEntry* parent = nullptr);
114  ~RegistryEntry() override;
116  unsigned long release() override;
118  unsigned long addRef() override {
119  return ++m_refCount;
120  }
122  const std::string& name() const override {
123  return m_path;
124  }
126  const std::string& identifier() const override {
127  return m_fullpath;
128  }
130  IDataProviderSvc* dataSvc() const override {
131  return m_pDataProviderSvc;
132  }
134  DataObject* object() const override {
135  return m_pObject;
136  }
138  IOpaqueAddress* address() const override {
139  return m_pAddress;
140  }
142  virtual IRegistry* parent() const {
143  return m_pParent;
144  }
146  virtual bool isSoft() const {
147  return m_isSoft;
148  }
150  const Store& leaves() const {
151  return m_store;
152  }
154  virtual int size() const {
155  return m_store.size();
156  }
158  virtual bool isEmpty() const {
159  return m_store.size() == 0;
160  }
162  virtual Iterator begin () const {
163  return m_store.begin();
164  }
166  virtual Iterator end () const {
167  return m_store.end();
168  }
170  virtual IRegistry* find ( const IRegistry* obj ) const {
171  return i_find(obj);
172  }
174  virtual IRegistry* find ( const std::string& path ) const {
175  return i_find(path);
176  }
178  void setAddress(IOpaqueAddress* pAddress) override;
180  void setObject(DataObject* obj);
181 
183  virtual long add(const std::string& name,
184  DataObject* pObject,
185  bool is_soft = false);
187  virtual long add(const std::string& name,
188  IOpaqueAddress* pAddress,
189  bool is_soft = false);
191  virtual long remove(const std::string& name);
193  virtual long add(IRegistry* obj);
195  virtual long remove(IRegistry* obj);
197  virtual long deleteElements();
199  virtual long traverseTree(IDataStoreAgent* pAgent, int level = 0);
200  };
201 }
202 #endif // GAUDIKERNEL_REGISTRYENTRY_H
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:95
DataObject * object() const override
Retrive object behind the link.
const std::string & name() const override
Retrieve name of the entry.
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:99
std::vector< IRegistry * > Store
Definition of datastore type.
Definition: RegistryEntry.h:39
T end(T...args)
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:91
STL class.
std::string m_fullpath
String containing full path of the object (volatile)
Definition: RegistryEntry.h:52
virtual bool isSoft() const
Is the link soft or hard.
IDataProviderSvc * dataSvc() const override
Retrieve pointer to Transient Store.
virtual Iterator begin() const
Return starting point for container iteration.
void setDataSvc(IDataProviderSvc *s)
Set the transient data store.
Definition: RegistryEntry.h:87
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:45
IOpaqueAddress * address() const override
Retrieve opaque storage address.
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
virtual IRegistry * find(const std::string &path) const
Try to find an object identified by its relative name to the directory.
T size(T...args)
virtual IRegistry * parent() const
Pointer to parent directory entry.
Generic data agent interface.
T begin(T...args)
Data service base class.
Definition: TsDataSvc.h:58
virtual int size() const
Return the size of the container(=number of objects)
Data service base class.
Definition: DataSvc.h:44
Store m_store
Store of leaves.
Definition: RegistryEntry.h:64
string s
Definition: gaudirun.py:245
std::string m_path
Path name.
Definition: RegistryEntry.h:54
const std::string & identifier() const override
Full identifier (or key)
Opaque address interface definition.
#define GAUDI_API
Definition: Kernel.h:107
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.