The Gaudi Framework  v29r0 (ff2e7097)
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
9 #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 namespace DataSvcHelpers
22 {
37  {
38  private:
41 
42  public:
43  friend class ::DataSvc;
44  // DP add friend class: the thread safe version of the DataSvc
45  friend class ::TsDataSvc;
47  typedef Store::const_iterator Iterator;
48 
49  private:
51  unsigned long m_refCount = 0;
53  bool m_isSoft = false;
59  RegistryEntry* m_pParent = nullptr;
61  IOpaqueAddress* m_pAddress = nullptr;
63  DataObject* m_pObject = nullptr;
65  IDataProviderSvc* m_pDataProviderSvc = nullptr;
67  Store m_store;
68 
69  private:
75  void assemblePath( std::string& buffer ) const;
78  IRegistry* i_find( const IRegistry* pDirectory ) const;
80  RegistryEntry* i_find( boost::string_ref path ) const;
82  RegistryEntry* i_find( const DataObject* pObject ) const;
84  RegistryEntry* i_create( std::string name );
86  long i_add( RegistryEntry* entry );
88  void setParent( RegistryEntry* pParent );
90  void setDataSvc( IDataProviderSvc* s ) { m_pDataProviderSvc = s; }
92  virtual RegistryEntry* parentEntry() { return m_pParent; }
94  RegistryEntry* findLeaf( boost::string_ref path ) const { return i_find( path ); }
96  RegistryEntry* findLeaf( const DataObject* key ) const { return i_find( key ); }
98  void makeHard( DataObject* pObject );
100  void makeHard( IOpaqueAddress* pAddress );
102  void makeSoft( DataObject* pObject );
104  void makeSoft( IOpaqueAddress* pAddress );
105 
106  public:
108  RegistryEntry( std::string path, RegistryEntry* parent = nullptr );
110  ~RegistryEntry() override;
112  unsigned long release() override;
114  unsigned long addRef() override { return ++m_refCount; }
116  const std::string& name() const override { return m_path; }
118  const std::string& identifier() const override { return m_fullpath; }
120  IDataProviderSvc* dataSvc() const override { return m_pDataProviderSvc; }
122  DataObject* object() const override { return m_pObject; }
124  IOpaqueAddress* address() const override { return m_pAddress; }
126  virtual IRegistry* parent() const { return m_pParent; }
128  virtual bool isSoft() const { return m_isSoft; }
130  const Store& leaves() const { return m_store; }
132  virtual int size() const { return m_store.size(); }
134  virtual bool isEmpty() const { return m_store.size() == 0; }
136  virtual Iterator begin() const { return m_store.begin(); }
138  virtual Iterator end() const { return m_store.end(); }
140  virtual IRegistry* find( const IRegistry* obj ) const { return i_find( obj ); }
142  virtual IRegistry* find( const std::string& path ) const { return i_find( path ); }
144  void setAddress( IOpaqueAddress* pAddress ) override;
146  void setObject( DataObject* obj );
147 
149  virtual long add( const std::string& name, DataObject* pObject, bool is_soft = false );
151  virtual long add( const std::string& name, IOpaqueAddress* pAddress, bool is_soft = false );
153  virtual long remove( const std::string& name );
155  virtual long add( IRegistry* obj );
157  virtual long remove( IRegistry* obj );
159  virtual long deleteElements();
161  virtual long traverseTree( IDataStoreAgent* pAgent, int level = 0 );
162  };
163 }
164 #endif // GAUDIKERNEL_REGISTRYENTRY_H
RegistryEntry * findLeaf(boost::string_ref path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:94
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:96
std::vector< IRegistry * > Store
Definition of datastore type.
Definition: RegistryEntry.h:40
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:92
STL class.
std::string m_fullpath
String containing full path of the object (volatile)
Definition: RegistryEntry.h:55
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:90
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:47
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:67
string s
Definition: gaudirun.py:253
std::string m_path
Path name.
Definition: RegistryEntry.h:57
const std::string & identifier() const override
Full identifier (or key)
Opaque address interface definition.
#define GAUDI_API
Definition: Kernel.h:110
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
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.