DataSvcHelpers::RegistryEntry Class Reference

Definition of an entry in the transient data store. More...

#include <GaudiKernel/RegistryEntry.h>

Inheritance diagram for DataSvcHelpers::RegistryEntry:
Collaboration diagram for DataSvcHelpers::RegistryEntry:

Public Types

typedef Store::const_iterator Iterator
 Iterator definition. More...
 
typedef Store::const_iterator Iterator
 Iterator definition. More...
 
- Public Types inherited from IRegistry
typedef std::string name_type
 Type definitions Name type. More...
 
typedef std::string id_type
 Identifier Key type. More...
 
typedef std::string name_type
 Type definitions Name type. More...
 
typedef std::string id_type
 Identifier Key type. More...
 

Public Member Functions

 RegistryEntry (std::string path, RegistryEntry *parent=nullptr)
 Standard Constructor. More...
 
 ~RegistryEntry () override
 Standard Destructor. More...
 
unsigned long release () override
 IInterface implementation: Reference the object. More...
 
unsigned long addRef () override
 IInterface implementation: Dereference the object. More...
 
const std::string & name () const override
 Retrieve name of the entry. More...
 
const std::string & identifier () const override
 Full identifier (or key) More...
 
IDataProviderSvcdataSvc () const override
 Retrieve pointer to Transient Store. More...
 
DataObjectobject () const override
 Retrive object behind the link. More...
 
IOpaqueAddressaddress () const override
 Retrieve opaque storage address. More...
 
virtual IRegistryparent () const
 Pointer to parent directory entry. More...
 
virtual bool isSoft () const
 Is the link soft or hard. More...
 
const Storeleaves () const
 Access the leaves of the object. More...
 
virtual int size () const
 Return the size of the container(=number of objects) More...
 
virtual bool isEmpty () const
 Simple check if the Container is empty. More...
 
virtual Iterator begin () const
 Return starting point for container iteration. More...
 
virtual Iterator end () const
 Return end elemtn if the container. More...
 
virtual IRegistryfind (const IRegistry *obj) const
 Try to find an object identified by its pointer. More...
 
virtual IRegistryfind (const std::string &path) const
 Try to find an object identified by its relative name to the directory. More...
 
void setAddress (IOpaqueAddress *pAddress) override
 Set/Update Opaque address. More...
 
void setObject (DataObject *obj)
 Set/Update object address. More...
 
virtual long add (const std::string &name, DataObject *pObject, bool is_soft=false)
 Add entry to data store. More...
 
virtual long add (const std::string &name, IOpaqueAddress *pAddress, bool is_soft=false)
 Add entry to data store. More...
 
virtual long remove (const std::string &name)
 Remove an entry from the store. More...
 
virtual long add (IRegistry *obj)
 Add object to the container. More...
 
virtual long remove (IRegistry *obj)
 Remove an object from the container. More...
 
virtual long deleteElements ()
 Delete all contained elements. More...
 
virtual long traverseTree (IDataStoreAgent *pAgent, int level=0)
 traverse data tree More...
 
 RegistryEntry (std::string path, RegistryEntry *parent=nullptr)
 Standard Constructor. More...
 
 ~RegistryEntry () override
 Standard Destructor. More...
 
unsigned long release () override
 IInterface implementation: Reference the object. More...
 
unsigned long addRef () override
 IInterface implementation: Dereference the object. More...
 
const std::string & name () const override
 Retrieve name of the entry. More...
 
const std::string & identifier () const override
 Full identifier (or key) More...
 
IDataProviderSvcdataSvc () const override
 Retrieve pointer to Transient Store. More...
 
DataObjectobject () const override
 Retrive object behind the link. More...
 
IOpaqueAddressaddress () const override
 Retrieve opaque storage address. More...
 
virtual IRegistryparent () const
 Pointer to parent directory entry. More...
 
virtual bool isSoft () const
 Is the link soft or hard. More...
 
const Storeleaves () const
 Access the leaves of the object. More...
 
virtual int size () const
 Return the size of the container(=number of objects) More...
 
virtual bool isEmpty () const
 Simple check if the Container is empty. More...
 
virtual Iterator begin () const
 Return starting point for container iteration. More...
 
virtual Iterator end () const
 Return end elemtn if the container. More...
 
virtual IRegistryfind (const IRegistry *obj) const
 Try to find an object identified by its pointer. More...
 
virtual IRegistryfind (const std::string &path) const
 Try to find an object identified by its relative name to the directory. More...
 
void setAddress (IOpaqueAddress *pAddress) override
 Set/Update Opaque address. More...
 
void setObject (DataObject *obj)
 Set/Update object address. More...
 
virtual long add (const std::string &name, DataObject *pObject, bool is_soft=false)
 Add entry to data store. More...
 
virtual long add (const std::string &name, IOpaqueAddress *pAddress, bool is_soft=false)
 Add entry to data store. More...
 
virtual long remove (const std::string &name)
 Remove an entry from the store. More...
 
virtual long add (IRegistry *obj)
 Add object to the container. More...
 
virtual long remove (IRegistry *obj)
 Remove an object from the container. More...
 
virtual long deleteElements ()
 Delete all contained elements. More...
 
virtual long traverseTree (IDataStoreAgent *pAgent, int level=0)
 traverse data tree More...
 
- Public Member Functions inherited from IRegistry
virtual ~IRegistry ()=default
 destructor More...
 
virtual ~IRegistry ()=default
 destructor More...
 

Private Types

typedef std::vector< IRegistry * > Store
 Definition of datastore type. More...
 
typedef std::vector< IRegistry * > Store
 Definition of datastore type. More...
 

Private Member Functions

void assemblePath (std::string &buffer) const
 The following entries serve two aspects: 1) They are faster for recursive calls, because they are non-virtual 2) They can be re-used for the non-const entry points using a const_cast of the result. More...
 
IRegistryi_find (const IRegistry *pDirectory) const
 Internal method to retrieve data directory. More...
 
RegistryEntryi_find (boost::string_ref path) const
 Internal method to retrieve data directory. More...
 
RegistryEntryi_find (const DataObject *pObject) const
 Internal method to locate object entry. More...
 
RegistryEntryi_create (std::string name)
 Internal method to create entries. More...
 
long i_add (RegistryEntry *entry)
 Internal method to add entries. More...
 
void setParent (RegistryEntry *pParent)
 Set new parent pointer. More...
 
void setDataSvc (IDataProviderSvc *s)
 Set the transient data store. More...
 
virtual RegistryEntryparentEntry ()
 Pointer to parent registry entry. More...
 
RegistryEntryfindLeaf (boost::string_ref path) const
 Find identified leaf in this registry node. More...
 
RegistryEntryfindLeaf (const DataObject *key) const
 Find identified leaf in this registry node. More...
 
void makeHard (DataObject *pObject)
 Initialize link as hard link. More...
 
void makeHard (IOpaqueAddress *pAddress)
 Initialize link as hard link. More...
 
void makeSoft (DataObject *pObject)
 Initialize link as soft link. More...
 
void makeSoft (IOpaqueAddress *pAddress)
 Initialize link as soft link. More...
 
void assemblePath (std::string &buffer) const
 The following entries serve two aspects: 1) They are faster for recursive calls, because they are non-virtual 2) They can be re-used for the non-const entry points using a const_cast of the result. More...
 
IRegistryi_find (const IRegistry *pDirectory) const
 Internal method to retrieve data directory. More...
 
RegistryEntryi_find (boost::string_ref path) const
 Internal method to retrieve data directory. More...
 
RegistryEntryi_find (const DataObject *pObject) const
 Internal method to locate object entry. More...
 
RegistryEntryi_create (std::string name)
 Internal method to create entries. More...
 
long i_add (RegistryEntry *entry)
 Internal method to add entries. More...
 
void setParent (RegistryEntry *pParent)
 Set new parent pointer. More...
 
void setDataSvc (IDataProviderSvc *s)
 Set the transient data store. More...
 
virtual RegistryEntryparentEntry ()
 Pointer to parent registry entry. More...
 
RegistryEntryfindLeaf (boost::string_ref path) const
 Find identified leaf in this registry node. More...
 
RegistryEntryfindLeaf (const DataObject *key) const
 Find identified leaf in this registry node. More...
 
void makeHard (DataObject *pObject)
 Initialize link as hard link. More...
 
void makeHard (IOpaqueAddress *pAddress)
 Initialize link as hard link. More...
 
void makeSoft (DataObject *pObject)
 Initialize link as soft link. More...
 
void makeSoft (IOpaqueAddress *pAddress)
 Initialize link as soft link. More...
 

Private Attributes

unsigned long m_refCount = 0
 Reference counter. More...
 
bool m_isSoft = false
 Is the link soft or hard? More...
 
std::string m_fullpath
 String containing full path of the object (volatile) More...
 
std::string m_path
 Path name. More...
 
RegistryEntrym_pParent = nullptr
 Pointer to parent. More...
 
IOpaqueAddressm_pAddress = nullptr
 Pointer to opaque address (load info) More...
 
DataObjectm_pObject = nullptr
 Pointer to object. More...
 
IDataProviderSvcm_pDataProviderSvc = nullptr
 Pointer to hosting transient store. More...
 
Store m_store
 Store of leaves. More...
 

Friends

class ::DataSvc
 

Detailed Description

Definition of an entry in the transient data store.

The RegistryEntry represents an entry of the transient data store. The object holds the recipe how to retrieve objects from the persistent world (member IOpaqueAddress) as well as the backward link to the parent entry and the leaves.

Author
Markus Frank
Sebastien Ponce

Definition at line 34 of file RegistryEntry.h.

Member Typedef Documentation

typedef Store::const_iterator DataSvcHelpers::RegistryEntry::Iterator

Iterator definition.

Definition at line 41 of file RegistryEntry.h.

typedef Store::const_iterator DataSvcHelpers::RegistryEntry::Iterator

Iterator definition.

Definition at line 41 of file RegistryEntry.h.

typedef std::vector<IRegistry*> DataSvcHelpers::RegistryEntry::Store
private

Definition of datastore type.

Definition at line 37 of file RegistryEntry.h.

typedef std::vector<IRegistry*> DataSvcHelpers::RegistryEntry::Store
private

Definition of datastore type.

Definition at line 37 of file RegistryEntry.h.

Constructor & Destructor Documentation

DataSvcHelpers::RegistryEntry::RegistryEntry ( std::string  path,
RegistryEntry parent = nullptr 
)

Standard Constructor.

Definition at line 49 of file RegistryEntry.cpp.

49  :
50  m_path(std::move(path)),
52 {
53  std::string::size_type sep = m_path.rfind(SEPARATOR);
54  if ( m_path.front() != SEPARATOR ) m_path.insert(0,1,SEPARATOR);
55  if ( sep != std::string::npos ) m_path.erase(0,sep);
57  addRef();
58 }
constexpr char SEPARATOR
unsigned long addRef() override
IInterface implementation: Dereference the object.
list path
Definition: __init__.py:15
std::string m_fullpath
String containing full path of the object (volatile)
Definition: RegistryEntry.h:48
RegistryEntry * m_pParent
Pointer to parent.
Definition: RegistryEntry.h:52
void assemblePath(std::string &buffer) const
The following entries serve two aspects: 1) They are faster for recursive calls, because they are non...
virtual IRegistry * parent() const
Pointer to parent directory entry.
std::string m_path
Path name.
Definition: RegistryEntry.h:50
DataSvcHelpers::RegistryEntry::~RegistryEntry ( )
override

Standard Destructor.

Standard destructor.

Definition at line 61 of file RegistryEntry.cpp.

61  {
63  if ( m_pObject ) {
64  if ( !m_isSoft ) m_pObject->setRegistry(nullptr);
65  m_pObject->release();
66  }
67  if ( m_pAddress ) {
68  if ( !m_isSoft ) m_pAddress->setRegistry(nullptr);
70  }
71 }
virtual long deleteElements()
Delete all contained elements.
void setRegistry(IRegistry *pRegistry)
Set pointer to Registry.
Definition: DataObject.h:70
virtual unsigned long release()=0
release reference to object
bool m_isSoft
Is the link soft or hard?
Definition: RegistryEntry.h:46
virtual unsigned long release()
release reference to object
Definition: DataObject.cpp:56
IOpaqueAddress * m_pAddress
Pointer to opaque address (load info)
Definition: RegistryEntry.h:54
DataObject * m_pObject
Pointer to object.
Definition: RegistryEntry.h:56
virtual void setRegistry(IRegistry *r)=0
Update directory pointer.
DataSvcHelpers::RegistryEntry::RegistryEntry ( std::string  path,
RegistryEntry parent = nullptr 
)

Standard Constructor.

DataSvcHelpers::RegistryEntry::~RegistryEntry ( )
override

Standard Destructor.

Member Function Documentation

long DataSvcHelpers::RegistryEntry::add ( const std::string &  name,
DataObject pObject,
bool  is_soft = false 
)
virtual

Add entry to data store.

Add entry to the current data store item.

Definition at line 202 of file RegistryEntry.cpp.

202  {
203  RegistryEntry* entry = i_create(name);
204  if ( !entry ) return StatusCode::FAILURE;
205  ( is_soft ) ? entry->makeSoft(pObject) : entry->makeHard(pObject);
206  i_add( entry );
207  return StatusCode::SUCCESS;
208 }
long i_add(RegistryEntry *entry)
Internal method to add entries.
const std::string & name() const override
Retrieve name of the entry.
RegistryEntry * i_create(std::string name)
Internal method to create entries.
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.
virtual long DataSvcHelpers::RegistryEntry::add ( const std::string &  name,
DataObject pObject,
bool  is_soft = false 
)
virtual

Add entry to data store.

long DataSvcHelpers::RegistryEntry::add ( const std::string &  name,
IOpaqueAddress pAddress,
bool  is_soft = false 
)
virtual

Add entry to data store.

Add entry to the current data store item.

Definition at line 211 of file RegistryEntry.cpp.

211  {
212  RegistryEntry* entry = i_create(name);
213  if ( !entry ) return StatusCode::FAILURE;
214  ( is_soft ) ? entry->makeSoft(pAddress) : entry->makeHard(pAddress);
215  i_add( entry );
216  return StatusCode::SUCCESS;
217 }
long i_add(RegistryEntry *entry)
Internal method to add entries.
const std::string & name() const override
Retrieve name of the entry.
RegistryEntry * i_create(std::string name)
Internal method to create entries.
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.
virtual long DataSvcHelpers::RegistryEntry::add ( const std::string &  name,
IOpaqueAddress pAddress,
bool  is_soft = false 
)
virtual

Add entry to data store.

long DataSvcHelpers::RegistryEntry::add ( IRegistry obj)
virtual

Add object to the container.

Definition at line 174 of file RegistryEntry.cpp.

174  {
175  RegistryEntry* pEntry = CAST_REGENTRY(RegistryEntry*, obj);
176  return i_add(pEntry);
177 }
#define CAST_REGENTRY(x, y)
long i_add(RegistryEntry *entry)
Internal method to add entries.
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.
virtual long DataSvcHelpers::RegistryEntry::add ( IRegistry obj)
virtual

Add object to the container.

unsigned long DataSvcHelpers::RegistryEntry::addRef ( )
inlineoverridevirtual

IInterface implementation: Dereference the object.

Implements IRegistry.

Definition at line 114 of file RegistryEntry.h.

114  {
115  return ++m_refCount;
116  }
unsigned long m_refCount
Reference counter.
Definition: RegistryEntry.h:44
unsigned long DataSvcHelpers::RegistryEntry::addRef ( )
inlineoverridevirtual

IInterface implementation: Dereference the object.

Implements IRegistry.

Definition at line 114 of file RegistryEntry.h.

114  {
115  return ++m_refCount;
116  }
unsigned long m_refCount
Reference counter.
Definition: RegistryEntry.h:44
IOpaqueAddress* DataSvcHelpers::RegistryEntry::address ( ) const
inlineoverridevirtual

Retrieve opaque storage address.

Implements IRegistry.

Definition at line 134 of file RegistryEntry.h.

134  {
135  return m_pAddress;
136  }
IOpaqueAddress * m_pAddress
Pointer to opaque address (load info)
Definition: RegistryEntry.h:54
IOpaqueAddress* DataSvcHelpers::RegistryEntry::address ( void  ) const
inlineoverridevirtual

Retrieve opaque storage address.

Implements IRegistry.

Definition at line 134 of file RegistryEntry.h.

134  {
135  return m_pAddress;
136  }
IOpaqueAddress * m_pAddress
Pointer to opaque address (load info)
Definition: RegistryEntry.h:54
void DataSvcHelpers::RegistryEntry::assemblePath ( std::string &  buffer) const
private

The following entries serve two aspects: 1) They are faster for recursive calls, because they are non-virtual 2) They can be re-used for the non-const entry points using a const_cast of the result.

Recursive helper to assemble the full path name of the entry

Definition at line 308 of file RegistryEntry.cpp.

308  {
309  if ( m_pParent ) m_pParent->assemblePath(buffer);
310  buffer += m_path;
311 }
RegistryEntry * m_pParent
Pointer to parent.
Definition: RegistryEntry.h:52
void assemblePath(std::string &buffer) const
The following entries serve two aspects: 1) They are faster for recursive calls, because they are non...
std::string m_path
Path name.
Definition: RegistryEntry.h:50
void DataSvcHelpers::RegistryEntry::assemblePath ( std::string &  buffer) const
private

The following entries serve two aspects: 1) They are faster for recursive calls, because they are non-virtual 2) They can be re-used for the non-const entry points using a const_cast of the result.

Recursive helper to assemble the full path name of the entry

virtual Iterator DataSvcHelpers::RegistryEntry::begin ( ) const
inlinevirtual

Return starting point for container iteration.

Definition at line 158 of file RegistryEntry.h.

158  {
159  return m_store.begin();
160  }
Store m_store
Store of leaves.
Definition: RegistryEntry.h:60
virtual Iterator DataSvcHelpers::RegistryEntry::begin ( ) const
inlinevirtual

Return starting point for container iteration.

Definition at line 158 of file RegistryEntry.h.

158  {
159  return m_store.begin();
160  }
Store m_store
Store of leaves.
Definition: RegistryEntry.h:60
IDataProviderSvc* DataSvcHelpers::RegistryEntry::dataSvc ( ) const
inlineoverridevirtual

Retrieve pointer to Transient Store.

Implements IRegistry.

Definition at line 126 of file RegistryEntry.h.

126  {
127  return m_pDataProviderSvc;
128  }
IDataProviderSvc * m_pDataProviderSvc
Pointer to hosting transient store.
Definition: RegistryEntry.h:58
IDataProviderSvc* DataSvcHelpers::RegistryEntry::dataSvc ( ) const
inlineoverridevirtual

Retrieve pointer to Transient Store.

Implements IRegistry.

Definition at line 126 of file RegistryEntry.h.

126  {
127  return m_pDataProviderSvc;
128  }
IDataProviderSvc * m_pDataProviderSvc
Pointer to hosting transient store.
Definition: RegistryEntry.h:58
long DataSvcHelpers::RegistryEntry::deleteElements ( )
virtual

Delete all contained elements.

Delete recursively all elements pending from the current store item.

Definition at line 220 of file RegistryEntry.cpp.

220  {
221  for (auto& i : m_store ) {
223  if ( entry ) {
224  entry->deleteElements();
225  entry->release();
226  }
227  }
228  m_store.erase(m_store.begin(), m_store.end());
229  return 0;
230 }
#define CAST_REGENTRY(x, y)
Store m_store
Store of leaves.
Definition: RegistryEntry.h:60
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.
list i
Definition: ana.py:128
virtual long DataSvcHelpers::RegistryEntry::deleteElements ( )
virtual

Delete all contained elements.

virtual Iterator DataSvcHelpers::RegistryEntry::end ( ) const
inlinevirtual

Return end elemtn if the container.

Definition at line 162 of file RegistryEntry.h.

162  {
163  return m_store.end();
164  }
Store m_store
Store of leaves.
Definition: RegistryEntry.h:60
virtual Iterator DataSvcHelpers::RegistryEntry::end ( ) const
inlinevirtual

Return end elemtn if the container.

Definition at line 162 of file RegistryEntry.h.

162  {
163  return m_store.end();
164  }
Store m_store
Store of leaves.
Definition: RegistryEntry.h:60
virtual IRegistry* DataSvcHelpers::RegistryEntry::find ( const IRegistry obj) const
inlinevirtual

Try to find an object identified by its pointer.

Definition at line 166 of file RegistryEntry.h.

166  {
167  return i_find(obj);
168  }
IRegistry * i_find(const IRegistry *pDirectory) const
Internal method to retrieve data directory.
virtual IRegistry* DataSvcHelpers::RegistryEntry::find ( const IRegistry obj) const
inlinevirtual

Try to find an object identified by its pointer.

Definition at line 166 of file RegistryEntry.h.

166  {
167  return i_find(obj);
168  }
IRegistry * i_find(const IRegistry *pDirectory) const
Internal method to retrieve data directory.
virtual IRegistry* DataSvcHelpers::RegistryEntry::find ( const std::string &  path) const
inlinevirtual

Try to find an object identified by its relative name to the directory.

Definition at line 170 of file RegistryEntry.h.

170  {
171  return i_find(path);
172  }
list path
Definition: __init__.py:15
IRegistry * i_find(const IRegistry *pDirectory) const
Internal method to retrieve data directory.
virtual IRegistry* DataSvcHelpers::RegistryEntry::find ( const std::string &  path) const
inlinevirtual

Try to find an object identified by its relative name to the directory.

Definition at line 170 of file RegistryEntry.h.

170  {
171  return i_find(path);
172  }
list path
Definition: __init__.py:15
IRegistry * i_find(const IRegistry *pDirectory) const
Internal method to retrieve data directory.
RegistryEntry* DataSvcHelpers::RegistryEntry::findLeaf ( boost::string_ref  path) const
inlineprivate

Find identified leaf in this registry node.

Definition at line 91 of file RegistryEntry.h.

91  {
92  return i_find(path);
93  }
list path
Definition: __init__.py:15
IRegistry * i_find(const IRegistry *pDirectory) const
Internal method to retrieve data directory.
RegistryEntry* DataSvcHelpers::RegistryEntry::findLeaf ( boost::string_ref  path) const
inlineprivate

Find identified leaf in this registry node.

Definition at line 91 of file RegistryEntry.h.

91  {
92  return i_find(path);
93  }
list path
Definition: __init__.py:15
IRegistry * i_find(const IRegistry *pDirectory) const
Internal method to retrieve data directory.
RegistryEntry* DataSvcHelpers::RegistryEntry::findLeaf ( const DataObject key) const
inlineprivate

Find identified leaf in this registry node.

Definition at line 95 of file RegistryEntry.h.

95  {
96  return i_find(key);
97  }
IRegistry * i_find(const IRegistry *pDirectory) const
Internal method to retrieve data directory.
RegistryEntry* DataSvcHelpers::RegistryEntry::findLeaf ( const DataObject key) const
inlineprivate

Find identified leaf in this registry node.

Definition at line 95 of file RegistryEntry.h.

95  {
96  return i_find(key);
97  }
IRegistry * i_find(const IRegistry *pDirectory) const
Internal method to retrieve data directory.
long DataSvcHelpers::RegistryEntry::i_add ( RegistryEntry entry)
private

Internal method to add entries.

long DataSvcHelpers::RegistryEntry::i_add ( RegistryEntry entry)
private

Internal method to add entries.

Add object to the container.

Definition at line 180 of file RegistryEntry.cpp.

180  {
181 //TODO: if this is the sole place where items are added to m_store,
182 // and we know here that they must be RegisteryEntry, can we
183 // drop the dynamic_cast every where else???
184 //TODO: if so, can we also change m_store to be std::vector<RegistryEntry*>
185 // instead
186 //TODO: if so, can we not make it std::vector<RegistryEntry> instead?
187 //TODO: if so, should make sure that a RegistryEntry can be std::move'ed
188  try {
189  pEntry->setDataSvc(m_pDataProviderSvc);
190  m_store.push_back(pEntry);
191  pEntry->setParent(this);
192  if ( !pEntry->isSoft() && pEntry->address() ) {
193  pEntry->address()->setRegistry(pEntry);
194  }
195  }
196  catch ( ... ) {
197  }
198  return m_store.size();
199 }
IDataProviderSvc * m_pDataProviderSvc
Pointer to hosting transient store.
Definition: RegistryEntry.h:58
Store m_store
Store of leaves.
Definition: RegistryEntry.h:60
DataSvcHelpers::RegistryEntry * DataSvcHelpers::RegistryEntry::i_create ( std::string  name)
private

Internal method to create entries.

Internal method to add entries.

Definition at line 164 of file RegistryEntry.cpp.

164  {
165  if ( nam.front() != SEPARATOR ) nam.insert(0,1,SEPARATOR);
166  // if this object is already present, this is an error....
167  auto not_present = std::none_of( std::begin(m_store), std::end(m_store),
168  [&](IRegistry* i) { return nam == i->name();
169  } );
170  return not_present ? new RegistryEntry( std::move(nam), this ) : nullptr;
171 }
constexpr char SEPARATOR
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:45
virtual const name_type & name() const =0
Name of the directory (or key)
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
Store m_store
Store of leaves.
Definition: RegistryEntry.h:60
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.
list i
Definition: ana.py:128
RegistryEntry* DataSvcHelpers::RegistryEntry::i_create ( std::string  name)
private

Internal method to create entries.

IRegistry * DataSvcHelpers::RegistryEntry::i_find ( const IRegistry pDirectory) const
private

Internal method to retrieve data directory.

Try to find an object identified by its pointer.

Definition at line 233 of file RegistryEntry.cpp.

233  {
234  auto i = std::find(m_store.begin(),m_store.end(),obj);
235  return (i!=m_store.end()) ? (*i) : nullptr;
236 }
Store m_store
Store of leaves.
Definition: RegistryEntry.h:60
list i
Definition: ana.py:128
IRegistry* DataSvcHelpers::RegistryEntry::i_find ( const IRegistry pDirectory) const
private

Internal method to retrieve data directory.

RegistryEntry* DataSvcHelpers::RegistryEntry::i_find ( boost::string_ref  path) const
private

Internal method to retrieve data directory.

DataSvcHelpers::RegistryEntry * DataSvcHelpers::RegistryEntry::i_find ( boost::string_ref  path) const
private

Internal method to retrieve data directory.

Find identified leaf in this registry node.

Definition at line 239 of file RegistryEntry.cpp.

239  {
240  if ( path.front() == SEPARATOR ) path.remove_prefix(1); // strip leading '/', if present
241  while (!path.empty()) {
242  // check that the chars of path prior to / are the same as regEnt->name()
243  // (i.e. match { nam:"/Ab" path:"/Ab/C"}
244  // but not { nam:"/Abc" path:"/Ab/C"})
245  auto loc1 = path.find(SEPARATOR);
246  auto cpath = path.substr(0,loc1);
247  if (loc1 != boost::string_ref::npos) {
248  path.remove_prefix(loc1+1);
249  } else {
250  path.clear();
251  }
252  auto i = std::find_if( std::begin(m_store), std::end(m_store),
253  [&](decltype(m_store)::const_reference reg) {
254  return cpath == boost::string_ref{reg->name()}.substr(1);
255  });
256  if ( i!=std::end(m_store) ) {
258  return path.empty() ? regEnt : regEnt->i_find(path);
259  }
260  // If this node is "/NodeA", this part allows to find "/NodeA/NodeB" as
261  // our "/NodeB" child.
262  if ( cpath != boost::string_ref{m_path}.substr(1) ) break;
263  }
264  return nullptr;
265 }
constexpr char SEPARATOR
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:45
list path
Definition: __init__.py:15
#define CAST_REGENTRY(x, y)
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:47
Store m_store
Store of leaves.
Definition: RegistryEntry.h:60
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.
std::string m_path
Path name.
Definition: RegistryEntry.h:50
list i
Definition: ana.py:128
DataSvcHelpers::RegistryEntry * DataSvcHelpers::RegistryEntry::i_find ( const DataObject pObject) const
private

Internal method to locate object entry.

Find identified leaf in this registry node.

Definition at line 268 of file RegistryEntry.cpp.

268  {
269  if ( key ) {
270  if ( key == m_pObject ) {
271  return const_cast<RegistryEntry*>(this);
272  }
273  // Look in the immediate level:
274  RegistryEntry *result = CAST_REGENTRY(RegistryEntry*, i_find(key->registry()));
275  if ( result ) return result;
276  // Go levels down
277  for (const auto& i : m_store) {
278  try {
279  const RegistryEntry *entry = CAST_REGENTRY(RegistryEntry*, i);
280  result = entry->i_find(key);
281  if( result ) return result;
282  }
283  catch ( ... ) { }
284  }
285  }
286  return nullptr;
287 }
#define CAST_REGENTRY(x, y)
Store m_store
Store of leaves.
Definition: RegistryEntry.h:60
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.
DataObject * m_pObject
Pointer to object.
Definition: RegistryEntry.h:56
list i
Definition: ana.py:128
IRegistry * i_find(const IRegistry *pDirectory) const
Internal method to retrieve data directory.
RegistryEntry* DataSvcHelpers::RegistryEntry::i_find ( const DataObject pObject) const
private

Internal method to locate object entry.

const std::string& DataSvcHelpers::RegistryEntry::identifier ( ) const
inlineoverridevirtual

Full identifier (or key)

Implements IRegistry.

Definition at line 122 of file RegistryEntry.h.

122  {
123  return m_fullpath;
124  }
std::string m_fullpath
String containing full path of the object (volatile)
Definition: RegistryEntry.h:48
const std::string& DataSvcHelpers::RegistryEntry::identifier ( ) const
inlineoverridevirtual

Full identifier (or key)

Implements IRegistry.

Definition at line 122 of file RegistryEntry.h.

122  {
123  return m_fullpath;
124  }
std::string m_fullpath
String containing full path of the object (volatile)
Definition: RegistryEntry.h:48
virtual bool DataSvcHelpers::RegistryEntry::isEmpty ( ) const
inlinevirtual

Simple check if the Container is empty.

Definition at line 154 of file RegistryEntry.h.

154  {
155  return m_store.size() == 0;
156  }
Store m_store
Store of leaves.
Definition: RegistryEntry.h:60
virtual bool DataSvcHelpers::RegistryEntry::isEmpty ( ) const
inlinevirtual

Simple check if the Container is empty.

Definition at line 154 of file RegistryEntry.h.

154  {
155  return m_store.size() == 0;
156  }
Store m_store
Store of leaves.
Definition: RegistryEntry.h:60
virtual bool DataSvcHelpers::RegistryEntry::isSoft ( ) const
inlinevirtual

Is the link soft or hard.

Definition at line 142 of file RegistryEntry.h.

142  {
143  return m_isSoft;
144  }
bool m_isSoft
Is the link soft or hard?
Definition: RegistryEntry.h:46
virtual bool DataSvcHelpers::RegistryEntry::isSoft ( ) const
inlinevirtual

Is the link soft or hard.

Definition at line 142 of file RegistryEntry.h.

142  {
143  return m_isSoft;
144  }
bool m_isSoft
Is the link soft or hard?
Definition: RegistryEntry.h:46
const Store& DataSvcHelpers::RegistryEntry::leaves ( ) const
inline

Access the leaves of the object.

Definition at line 146 of file RegistryEntry.h.

146  {
147  return m_store;
148  }
Store m_store
Store of leaves.
Definition: RegistryEntry.h:60
const Store& DataSvcHelpers::RegistryEntry::leaves ( ) const
inline

Access the leaves of the object.

Definition at line 146 of file RegistryEntry.h.

146  {
147  return m_store;
148  }
Store m_store
Store of leaves.
Definition: RegistryEntry.h:60
void DataSvcHelpers::RegistryEntry::makeHard ( DataObject pObject)
private

Initialize link as hard link.

Create hard link.

Definition at line 103 of file RegistryEntry.cpp.

103  {
104  makeSoft(pObject);
105  m_isSoft = false;
106  if ( m_pObject ) m_pObject->setRegistry(this);
107  if ( m_pAddress ) m_pAddress->setRegistry(this);
108 }
void setRegistry(IRegistry *pRegistry)
Set pointer to Registry.
Definition: DataObject.h:70
void makeSoft(DataObject *pObject)
Initialize link as soft link.
bool m_isSoft
Is the link soft or hard?
Definition: RegistryEntry.h:46
IOpaqueAddress * m_pAddress
Pointer to opaque address (load info)
Definition: RegistryEntry.h:54
DataObject * m_pObject
Pointer to object.
Definition: RegistryEntry.h:56
virtual void setRegistry(IRegistry *r)=0
Update directory pointer.
void DataSvcHelpers::RegistryEntry::makeHard ( DataObject pObject)
private

Initialize link as hard link.

void DataSvcHelpers::RegistryEntry::makeHard ( IOpaqueAddress pAddress)
private

Initialize link as hard link.

void DataSvcHelpers::RegistryEntry::makeHard ( IOpaqueAddress pAddress)
private

Initialize link as hard link.

Create hard link.

Definition at line 111 of file RegistryEntry.cpp.

111  {
112  m_isSoft = false;
113  setAddress(pAddress);
114 }
void setAddress(IOpaqueAddress *pAddress) override
Set/Update Opaque address.
bool m_isSoft
Is the link soft or hard?
Definition: RegistryEntry.h:46
void DataSvcHelpers::RegistryEntry::makeSoft ( DataObject pObject)
private

Initialize link as soft link.

void DataSvcHelpers::RegistryEntry::makeSoft ( DataObject pObject)
private

Initialize link as soft link.

Create soft link.

Definition at line 88 of file RegistryEntry.cpp.

88  {
89  m_isSoft = true;
90  setObject(pObject);
91 // if ( 0 != m_pObject ) { // Useless: This justs sets my own address again...
92 // setAddress(m_pObject->address());
93 // }
94 }
void setObject(DataObject *obj)
Set/Update object address.
bool m_isSoft
Is the link soft or hard?
Definition: RegistryEntry.h:46
void DataSvcHelpers::RegistryEntry::makeSoft ( IOpaqueAddress pAddress)
private

Initialize link as soft link.

void DataSvcHelpers::RegistryEntry::makeSoft ( IOpaqueAddress pAddress)
private

Initialize link as soft link.

Create soft link.

Definition at line 97 of file RegistryEntry.cpp.

97  {
98  m_isSoft = true;
99  setAddress(pAddress);
100 }
void setAddress(IOpaqueAddress *pAddress) override
Set/Update Opaque address.
bool m_isSoft
Is the link soft or hard?
Definition: RegistryEntry.h:46
const std::string& DataSvcHelpers::RegistryEntry::name ( ) const
inlineoverridevirtual

Retrieve name of the entry.

Implements IRegistry.

Definition at line 118 of file RegistryEntry.h.

118  {
119  return m_path;
120  }
std::string m_path
Path name.
Definition: RegistryEntry.h:50
const std::string& DataSvcHelpers::RegistryEntry::name ( ) const
inlineoverridevirtual

Retrieve name of the entry.

Implements IRegistry.

Definition at line 118 of file RegistryEntry.h.

118  {
119  return m_path;
120  }
std::string m_path
Path name.
Definition: RegistryEntry.h:50
DataObject* DataSvcHelpers::RegistryEntry::object ( ) const
inlineoverridevirtual

Retrive object behind the link.

Implements IRegistry.

Definition at line 130 of file RegistryEntry.h.

130  {
131  return m_pObject;
132  }
DataObject * m_pObject
Pointer to object.
Definition: RegistryEntry.h:56
DataObject* DataSvcHelpers::RegistryEntry::object ( ) const
inlineoverridevirtual

Retrive object behind the link.

Implements IRegistry.

Definition at line 130 of file RegistryEntry.h.

130  {
131  return m_pObject;
132  }
DataObject * m_pObject
Pointer to object.
Definition: RegistryEntry.h:56
virtual IRegistry* DataSvcHelpers::RegistryEntry::parent ( ) const
inlinevirtual

Pointer to parent directory entry.

Definition at line 138 of file RegistryEntry.h.

138  {
139  return m_pParent;
140  }
RegistryEntry * m_pParent
Pointer to parent.
Definition: RegistryEntry.h:52
virtual IRegistry* DataSvcHelpers::RegistryEntry::parent ( void  ) const
inlinevirtual

Pointer to parent directory entry.

Definition at line 138 of file RegistryEntry.h.

138  {
139  return m_pParent;
140  }
RegistryEntry * m_pParent
Pointer to parent.
Definition: RegistryEntry.h:52
virtual RegistryEntry* DataSvcHelpers::RegistryEntry::parentEntry ( )
inlineprivatevirtual

Pointer to parent registry entry.

Definition at line 87 of file RegistryEntry.h.

87  {
88  return m_pParent;
89  }
RegistryEntry * m_pParent
Pointer to parent.
Definition: RegistryEntry.h:52
virtual RegistryEntry* DataSvcHelpers::RegistryEntry::parentEntry ( )
inlineprivatevirtual

Pointer to parent registry entry.

Definition at line 87 of file RegistryEntry.h.

87  {
88  return m_pParent;
89  }
RegistryEntry * m_pParent
Pointer to parent.
Definition: RegistryEntry.h:52
unsigned long DataSvcHelpers::RegistryEntry::release ( )
overridevirtual

IInterface implementation: Reference the object.

Implements IRegistry.

unsigned long DataSvcHelpers::RegistryEntry::release ( )
overridevirtual

IInterface implementation: Reference the object.

Release entry.

Implements IRegistry.

Definition at line 74 of file RegistryEntry.cpp.

74  {
75  unsigned long cnt = --m_refCount;
76  if ( !m_refCount ) delete this;
77  return cnt;
78 }
unsigned long m_refCount
Reference counter.
Definition: RegistryEntry.h:44
long DataSvcHelpers::RegistryEntry::remove ( const std::string &  name)
virtual

Remove an entry from the store.

Remove entry from data store.

Definition at line 151 of file RegistryEntry.cpp.

151  {
152  if ( nam.front() != SEPARATOR ) return remove( SEPARATOR+nam );
153  // if this object is already present, this is an error....
154  for (auto& i : m_store ) {
155  if ( nam == i->name() ) {
156  remove(i);
157  return StatusCode::SUCCESS;
158  }
159  }
160  return StatusCode::FAILURE;
161 }
constexpr char SEPARATOR
Store m_store
Store of leaves.
Definition: RegistryEntry.h:60
list i
Definition: ana.py:128
virtual long DataSvcHelpers::RegistryEntry::remove ( const std::string &  name)
virtual

Remove an entry from the store.

virtual long DataSvcHelpers::RegistryEntry::remove ( IRegistry obj)
virtual

Remove an object from the container.

long DataSvcHelpers::RegistryEntry::remove ( IRegistry obj)
virtual

Remove an object from the container.

Definition at line 137 of file RegistryEntry.cpp.

137  {
138  try {
139  RegistryEntry* pEntry = dynamic_cast<RegistryEntry*>(obj);
140  auto i = std::remove(std::begin(m_store), std::end(m_store), pEntry);
141  if (i != std::end(m_store)) {
142  pEntry->release();
143  m_store.erase( i, std::end(m_store) );
144  }
145  }
146  catch ( ... ) { }
147  return m_store.size();
148 }
def remove(file, logdir)
Definition: install.py:153
auto begin(reverse_wrapper< T > &w)
Definition: reverse.h:45
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:47
Store m_store
Store of leaves.
Definition: RegistryEntry.h:60
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.
list i
Definition: ana.py:128
void DataSvcHelpers::RegistryEntry::setAddress ( IOpaqueAddress pAddress)
overridevirtual

Set/Update Opaque address.

Update Opaque address of registry entry.

Implements IRegistry.

Definition at line 117 of file RegistryEntry.cpp.

117  {
118  if ( pAddress ) {
119  pAddress->addRef();
120  pAddress->setRegistry(this);
121  }
122  if ( m_pAddress ) m_pAddress->release();
123  m_pAddress = pAddress;
124 }
virtual unsigned long release()=0
release reference to object
IOpaqueAddress * m_pAddress
Pointer to opaque address (load info)
Definition: RegistryEntry.h:54
virtual void setRegistry(IRegistry *r)=0
Update directory pointer.
virtual unsigned long addRef()=0
Add reference to object.
void DataSvcHelpers::RegistryEntry::setAddress ( IOpaqueAddress pAddress)
overridevirtual

Set/Update Opaque address.

Implements IRegistry.

void DataSvcHelpers::RegistryEntry::setDataSvc ( IDataProviderSvc s)
inlineprivate

Set the transient data store.

Definition at line 83 of file RegistryEntry.h.

83  {
85  }
IDataProviderSvc * m_pDataProviderSvc
Pointer to hosting transient store.
Definition: RegistryEntry.h:58
string s
Definition: gaudirun.py:246
void DataSvcHelpers::RegistryEntry::setDataSvc ( IDataProviderSvc s)
inlineprivate

Set the transient data store.

Definition at line 83 of file RegistryEntry.h.

83  {
85  }
IDataProviderSvc * m_pDataProviderSvc
Pointer to hosting transient store.
Definition: RegistryEntry.h:58
string s
Definition: gaudirun.py:246
void DataSvcHelpers::RegistryEntry::setObject ( DataObject obj)

Set/Update object address.

Set object pointer of data store item.

Definition at line 127 of file RegistryEntry.cpp.

127  {
128  if ( pObject ) {
129  pObject->addRef();
130  if ( !isSoft() ) pObject->setRegistry(this);
131  }
132  if ( m_pObject ) m_pObject->release();
133  m_pObject = pObject;
134 }
virtual bool isSoft() const
Is the link soft or hard.
virtual unsigned long release()
release reference to object
Definition: DataObject.cpp:56
DataObject * m_pObject
Pointer to object.
Definition: RegistryEntry.h:56
void DataSvcHelpers::RegistryEntry::setObject ( DataObject obj)

Set/Update object address.

void DataSvcHelpers::RegistryEntry::setParent ( RegistryEntry pParent)
private

Set new parent pointer.

Definition at line 81 of file RegistryEntry.cpp.

81  {
82  m_pParent = pParent;
83  m_fullpath.clear();
85 }
std::string m_fullpath
String containing full path of the object (volatile)
Definition: RegistryEntry.h:48
RegistryEntry * m_pParent
Pointer to parent.
Definition: RegistryEntry.h:52
void assemblePath(std::string &buffer) const
The following entries serve two aspects: 1) They are faster for recursive calls, because they are non...
void DataSvcHelpers::RegistryEntry::setParent ( RegistryEntry pParent)
private

Set new parent pointer.

virtual int DataSvcHelpers::RegistryEntry::size ( ) const
inlinevirtual

Return the size of the container(=number of objects)

Definition at line 150 of file RegistryEntry.h.

150  {
151  return m_store.size();
152  }
Store m_store
Store of leaves.
Definition: RegistryEntry.h:60
virtual int DataSvcHelpers::RegistryEntry::size ( ) const
inlinevirtual

Return the size of the container(=number of objects)

Definition at line 150 of file RegistryEntry.h.

150  {
151  return m_store.size();
152  }
Store m_store
Store of leaves.
Definition: RegistryEntry.h:60
long DataSvcHelpers::RegistryEntry::traverseTree ( IDataStoreAgent pAgent,
int  level = 0 
)
virtual

traverse data tree

Definition at line 290 of file RegistryEntry.cpp.

290  {
291  bool go_down = pAgent->analyse(this, level);
292  long status = StatusCode::SUCCESS;
293  if ( go_down ) {
294  for ( auto& i : m_store ) {
295  try {
297  entry->traverseTree(pAgent, level+1);
298  }
299  catch (...) {
300  status = StatusCode::FAILURE;
301  }
302  }
303  }
304  return status;
305 }
virtual bool analyse(IRegistry *pObject, int level)=0
Analyse the data object.
#define CAST_REGENTRY(x, y)
Store m_store
Store of leaves.
Definition: RegistryEntry.h:60
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.
list i
Definition: ana.py:128
virtual long DataSvcHelpers::RegistryEntry::traverseTree ( IDataStoreAgent pAgent,
int  level = 0 
)
virtual

traverse data tree

Friends And Related Function Documentation

friend class ::DataSvc
friend

Definition at line 39 of file RegistryEntry.h.

Member Data Documentation

std::string DataSvcHelpers::RegistryEntry::m_fullpath
private

String containing full path of the object (volatile)

Definition at line 48 of file RegistryEntry.h.

bool DataSvcHelpers::RegistryEntry::m_isSoft = false
private

Is the link soft or hard?

Definition at line 46 of file RegistryEntry.h.

IOpaqueAddress * DataSvcHelpers::RegistryEntry::m_pAddress = nullptr
private

Pointer to opaque address (load info)

Definition at line 54 of file RegistryEntry.h.

std::string DataSvcHelpers::RegistryEntry::m_path
private

Path name.

Definition at line 50 of file RegistryEntry.h.

IDataProviderSvc * DataSvcHelpers::RegistryEntry::m_pDataProviderSvc = nullptr
private

Pointer to hosting transient store.

Definition at line 58 of file RegistryEntry.h.

DataObject * DataSvcHelpers::RegistryEntry::m_pObject = nullptr
private

Pointer to object.

Definition at line 56 of file RegistryEntry.h.

RegistryEntry * DataSvcHelpers::RegistryEntry::m_pParent = nullptr
private

Pointer to parent.

Definition at line 52 of file RegistryEntry.h.

unsigned long DataSvcHelpers::RegistryEntry::m_refCount = 0
private

Reference counter.

Definition at line 44 of file RegistryEntry.h.

Store DataSvcHelpers::RegistryEntry::m_store
private

Store of leaves.

Definition at line 60 of file RegistryEntry.h.


The documentation for this class was generated from the following files: