| The Gaudi Framework v32r1 (f65d50dc)

RegistryEntry.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_REGISTRYENTRY_H
2 #define GAUDIKERNEL_REGISTRYENTRY_H
3
4 // Framework include files
5 #include "GaudiKernel/IRegistry.h"
6 #include "GaudiKernel/Kernel.h"
7 #include "GaudiKernel/StatusCode.h"
8
9 // STL include files
10 #include <string_view>
11 #include <vector>
12
13 // Forward declarations
14 class DataSvc;
15 // DP add this fwd decl for thread safety
16 class TsDataSvc;
17 class DataObject;
18 class IDataProviderSvc;
19 class IOpaqueAddress;
20 class IDataStoreAgent;
21
22 namespace DataSvcHelpers {
36 class GAUDI_API RegistryEntry final : public IRegistry {
37 private:
39 typedef std::vector<IRegistry*> Store;
40
41 public:
42 friend class ::DataSvc;
43 // DP add friend class: the thread safe version of the DataSvc
44 friend class ::TsDataSvc;
46 typedef Store::const_iterator Iterator;
47
48 private:
50 unsigned long m_refCount = 0;
52 bool m_isSoft = false;
54 std::string m_fullpath;
56 std::string m_path;
58 RegistryEntry* m_pParent = nullptr;
60 IOpaqueAddress* m_pAddress = nullptr;
62 DataObject* m_pObject = nullptr;
64 IDataProviderSvc* m_pDataProviderSvc = nullptr;
66 Store m_store;
67
68 private:
74 void assemblePath( std::string& buffer ) const;
77 IRegistry* i_find( const IRegistry* pDirectory ) const;
79 RegistryEntry* i_find( std::string_view path ) const;
81 RegistryEntry* i_find( const DataObject* pObject ) const;
83 RegistryEntry* i_create( std::string name );
85 long i_add( RegistryEntry* entry );
87 void setParent( RegistryEntry* pParent );
89 void setDataSvc( IDataProviderSvc* s ) { m_pDataProviderSvc = s; }
91 RegistryEntry* parentEntry() { return m_pParent; }
93 RegistryEntry* findLeaf( std::string_view path ) const { return i_find( path ); }
95 RegistryEntry* findLeaf( const DataObject* key ) const { return i_find( key ); }
97 void makeHard( DataObject* pObject );
99 void makeHard( IOpaqueAddress* pAddress );
101 void makeSoft( DataObject* pObject );
103 void makeSoft( IOpaqueAddress* pAddress );
104
105 public:
107 RegistryEntry( std::string path, RegistryEntry* parent = nullptr );
109 ~RegistryEntry() override;
111 unsigned long release() override;
113 unsigned long addRef() override { return ++m_refCount; }
115 const std::string& name() const override { return m_path; }
117 const std::string& identifier() const override { return m_fullpath; }
119 IDataProviderSvc* dataSvc() const override { return m_pDataProviderSvc; }
121 DataObject* object() const override { return m_pObject; }
123 IOpaqueAddress* address() const override { return m_pAddress; }
125 IRegistry* parent() const { return m_pParent; }
127 bool isSoft() const { return m_isSoft; }
129 const Store& leaves() const { return m_store; }
131 int size() const { return m_store.size(); }
133 bool isEmpty() const { return m_store.size() == 0; }
135 Iterator begin() const { return m_store.begin(); }
137 Iterator end() const { return m_store.end(); }
139 IRegistry* find( const IRegistry* obj ) const { return i_find( obj ); }
141 IRegistry* find( std::string_view path ) const { return i_find( path ); }
143 void setAddress( IOpaqueAddress* pAddress ) override;
145 void setObject( DataObject* obj );
146
148 StatusCode add( std::string name, DataObject* pObject, bool is_soft = false );
150 StatusCode add( std::string name, IOpaqueAddress* pAddress, bool is_soft = false );
152 StatusCode remove( std::string_view name );
154 long add( IRegistry* obj );
156 long remove( IRegistry* obj );
158 long deleteElements();
160 StatusCode traverseTree( IDataStoreAgent* pAgent, int level = 0 );
161 };
162 } // namespace DataSvcHelpers
163 #endif // GAUDIKERNEL_REGISTRYENTRY_H
DataSvcHelpers::RegistryEntry::dataSvc
IDataProviderSvc * dataSvc() const override
Retrieve pointer to Transient Store.
Definition: RegistryEntry.h:119
Kernel.h
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:932
gaudiComponentHelp.name
name
Definition: gaudiComponentHelp.py:41
DataSvcHelpers::RegistryEntry::addRef
unsigned long addRef() override
IInterface implementation: Dereference the object.
Definition: RegistryEntry.h:113
DataSvcHelpers::RegistryEntry::findLeaf
RegistryEntry * findLeaf(std::string_view path) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:93
DataSvcHelpers::RegistryEntry::Store
std::vector< IRegistry * > Store
Definition of datastore type.
Definition: RegistryEntry.h:39
DataSvcHelpers::RegistryEntry::isEmpty
bool isEmpty() const
Simple check if the Container is empty.
Definition: RegistryEntry.h:133
std::vector::end
T end(T... args)
DataSvcHelpers::RegistryEntry::find
IRegistry * find(const IRegistry *obj) const
Try to find an object identified by its pointer.
Definition: RegistryEntry.h:139
IDataProviderSvc
Data provider interface definition.
Definition: IDataProviderSvc.h:43
DataSvcHelpers::RegistryEntry::findLeaf
RegistryEntry * findLeaf(const DataObject *key) const
Find identified leaf in this registry node.
Definition: RegistryEntry.h:95
DataSvcHelpers::RegistryEntry::parent
IRegistry * parent() const
Pointer to parent directory entry.
Definition: RegistryEntry.h:125
std::string
STL class.
DataSvcHelpers::RegistryEntry::m_fullpath
std::string m_fullpath
String containing full path of the object (volatile)
Definition: RegistryEntry.h:54
DataSvcHelpers::RegistryEntry::end
Iterator end() const
Return end elemtn if the container.
Definition: RegistryEntry.h:137
DataSvcHelpers::RegistryEntry::find
IRegistry * find(std::string_view path) const
Try to find an object identified by its relative name to the directory.
Definition: RegistryEntry.h:141
GaudiPython.Persistency.add
def add(instance)
Definition: Persistency.py:39
DataSvcHelpers::RegistryEntry::address
IOpaqueAddress * address() const override
Retrieve opaque storage address.
Definition: RegistryEntry.h:123
DataSvcHelpers::RegistryEntry::name
const std::string & name() const override
Retrieve name of the entry.
Definition: RegistryEntry.h:115
StatusCode
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
DataSvcHelpers::RegistryEntry::leaves
const Store & leaves() const
Access the leaves of the object.
Definition: RegistryEntry.h:129
DataSvcHelpers::RegistryEntry::setDataSvc
void setDataSvc(IDataProviderSvc *s)
Set the transient data store.
Definition: RegistryEntry.h:89
IRegistry.h
IRegistry
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
DataSvcHelpers::RegistryEntry::identifier
const std::string & identifier() const override
Full identifier (or key)
Definition: RegistryEntry.h:117
DataSvcHelpers::RegistryEntry::Iterator
Store::const_iterator Iterator
Iterator definition.
Definition: RegistryEntry.h:46
DataSvcHelpers::RegistryEntry
Definition of an entry in the transient data store.
Definition: RegistryEntry.h:36
std::vector::size
T size(T... args)
DataSvcHelpers::RegistryEntry::object
DataObject * object() const override
Retrive object behind the link.
Definition: RegistryEntry.h:121
std::vector< IRegistry * >
IDataStoreAgent
Generic data agent interface.
Definition: IDataStoreAgent.h:17
std::vector::begin
T begin(T... args)
DataSvcHelpers::RegistryEntry::parentEntry
RegistryEntry * parentEntry()
Pointer to parent registry entry.
Definition: RegistryEntry.h:91
TsDataSvc
Data service base class.
Definition: TsDataSvc.h:57
DataSvc
Data service base class.
Definition: DataSvc.h:42
DataSvcHelpers::RegistryEntry::m_store
Store m_store
Store of leaves.
Definition: RegistryEntry.h:66
DataSvcHelpers::RegistryEntry::size
int size() const
Return the size of the container(=number of objects)
Definition: RegistryEntry.h:131
gaudirun.s
string s
Definition: gaudirun.py:316
DataSvcHelpers::RegistryEntry::m_path
std::string m_path
Path name.
Definition: RegistryEntry.h:56
DataSvcHelpers::RegistryEntry::isSoft
bool isSoft() const
Is the link soft or hard.
Definition: RegistryEntry.h:127
gaudirun.level
level
Definition: gaudirun.py:334
DataSvcHelpers
Definition: DataSvc.h:27
StatusCode.h
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:71
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
DataSvcHelpers::RegistryEntry::begin
Iterator begin() const
Return starting point for container iteration.
Definition: RegistryEntry.h:135