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=0)
 Standard Constructor. More...
 
virtual ~RegistryEntry ()
 Standard Destructor. More...
 
virtual unsigned long release ()
 IInterface implementation: Reference the object. More...
 
virtual unsigned long addRef ()
 IInterface implementation: Dereference the object. More...
 
const std::string & name () const
 Retrieve name of the entry. More...
 
virtual const std::string & identifier () const
 Full identifier (or key) More...
 
virtual IDataProviderSvcdataSvc () const
 Retrieve pointer to Transient Store. More...
 
virtual DataObjectobject () const
 Retrive object behind the link. More...
 
virtual IOpaqueAddressaddress () const
 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)
 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=0)
 Standard Constructor. More...
 
virtual ~RegistryEntry ()
 Standard Destructor. More...
 
virtual unsigned long release ()
 IInterface implementation: Reference the object. More...
 
virtual unsigned long addRef ()
 IInterface implementation: Dereference the object. More...
 
const std::string & name () const
 Retrieve name of the entry. More...
 
virtual const std::string & identifier () const
 Full identifier (or key) More...
 
virtual IDataProviderSvcdataSvc () const
 Retrieve pointer to Transient Store. More...
 
virtual DataObjectobject () const
 Retrive object behind the link. More...
 
virtual IOpaqueAddressaddress () const
 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)
 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 ()
 destructor More...
 
virtual ~IRegistry ()
 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
 Reference counter. More...
 
bool m_isSoft
 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
 Pointer to parent. More...
 
IOpaqueAddressm_pAddress
 Pointer to opaque address (load info) More...
 
DataObjectm_pObject
 Pointer to object. More...
 
IDataProviderSvcm_pDataProviderSvc
 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 35 of file RegistryEntry.h.

Member Typedef Documentation

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

Iterator definition.

Definition at line 42 of file RegistryEntry.h.

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

Iterator definition.

Definition at line 42 of file RegistryEntry.h.

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

Definition of datastore type.

Definition at line 38 of file RegistryEntry.h.

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

Definition of datastore type.

Definition at line 38 of file RegistryEntry.h.

Constructor & Destructor Documentation

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

Standard Constructor.

Definition at line 50 of file RegistryEntry.cpp.

51 : m_refCount(0),
52  m_isSoft(false),
53  m_path(std::move(path)),
55  m_pAddress(nullptr),
56  m_pObject(nullptr),
57  m_pDataProviderSvc(nullptr)
58 {
59  std::string::size_type sep = m_path.rfind(SEPARATOR);
60  if ( m_path.front() != SEPARATOR ) m_path.insert(0,1,SEPARATOR);
61  if ( sep != std::string::npos ) m_path.erase(0,sep);
63  addRef();
64 }
virtual unsigned long addRef()
IInterface implementation: Dereference the object.
constexpr char SEPARATOR
IDataProviderSvc * m_pDataProviderSvc
Pointer to hosting transient store.
Definition: RegistryEntry.h:59
list path
Definition: __init__.py:15
std::string m_fullpath
String containing full path of the object (volatile)
Definition: RegistryEntry.h:49
RegistryEntry * m_pParent
Pointer to parent.
Definition: RegistryEntry.h:53
void assemblePath(std::string &buffer) const
The following entries serve two aspects: 1) They are faster for recursive calls, because they are non...
bool m_isSoft
Is the link soft or hard?
Definition: RegistryEntry.h:47
unsigned long m_refCount
Reference counter.
Definition: RegistryEntry.h:45
virtual IRegistry * parent() const
Pointer to parent directory entry.
IOpaqueAddress * m_pAddress
Pointer to opaque address (load info)
Definition: RegistryEntry.h:55
DataObject * m_pObject
Pointer to object.
Definition: RegistryEntry.h:57
std::string m_path
Path name.
Definition: RegistryEntry.h:51
DataSvcHelpers::RegistryEntry::~RegistryEntry ( )
virtual

Standard Destructor.

Standard destructor.

Definition at line 67 of file RegistryEntry.cpp.

67  {
69  if ( m_pObject ) {
70  if ( !m_isSoft ) m_pObject->setRegistry(nullptr);
71  m_pObject->release();
72  }
73  if ( m_pAddress ) {
74  if ( !m_isSoft ) m_pAddress->setRegistry(nullptr);
76  }
77 }
virtual long deleteElements()
Delete all contained elements.
void setRegistry(IRegistry *pRegistry)
Set pointer to Registry.
Definition: DataObject.h:65
virtual unsigned long release()=0
release reference to object
bool m_isSoft
Is the link soft or hard?
Definition: RegistryEntry.h:47
virtual unsigned long release()
release reference to object
Definition: DataObject.cpp:44
IOpaqueAddress * m_pAddress
Pointer to opaque address (load info)
Definition: RegistryEntry.h:55
DataObject * m_pObject
Pointer to object.
Definition: RegistryEntry.h:57
virtual void setRegistry(IRegistry *r)=0
Update directory pointer.
DataSvcHelpers::RegistryEntry::RegistryEntry ( std::string  path,
RegistryEntry parent = 0 
)

Standard Constructor.

virtual DataSvcHelpers::RegistryEntry::~RegistryEntry ( )
virtual

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 208 of file RegistryEntry.cpp.

208  {
209  RegistryEntry* entry = i_create(name);
210  if ( !entry ) return StatusCode::FAILURE;
211  ( is_soft ) ? entry->makeSoft(pObject) : entry->makeHard(pObject);
212  i_add( entry );
213  return StatusCode::SUCCESS;
214 }
RegistryEntry(std::string path, RegistryEntry *parent=0)
Standard Constructor.
long i_add(RegistryEntry *entry)
Internal method to add entries.
RegistryEntry * i_create(std::string name)
Internal method to create entries.
const std::string & name() const
Retrieve name of the entry.
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 217 of file RegistryEntry.cpp.

217  {
218  RegistryEntry* entry = i_create(name);
219  if ( !entry ) return StatusCode::FAILURE;
220  ( is_soft ) ? entry->makeSoft(pAddress) : entry->makeHard(pAddress);
221  i_add( entry );
222  return StatusCode::SUCCESS;
223 }
RegistryEntry(std::string path, RegistryEntry *parent=0)
Standard Constructor.
long i_add(RegistryEntry *entry)
Internal method to add entries.
RegistryEntry * i_create(std::string name)
Internal method to create entries.
const std::string & name() const
Retrieve name of the entry.
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 180 of file RegistryEntry.cpp.

180  {
181  RegistryEntry* pEntry = CAST_REGENTRY(RegistryEntry*, obj);
182  return i_add(pEntry);
183 }
#define CAST_REGENTRY(x, y)
RegistryEntry(std::string path, RegistryEntry *parent=0)
Standard Constructor.
long i_add(RegistryEntry *entry)
Internal method to add entries.
virtual long DataSvcHelpers::RegistryEntry::add ( IRegistry obj)
virtual

Add object to the container.

virtual unsigned long DataSvcHelpers::RegistryEntry::addRef ( )
inlinevirtual

IInterface implementation: Dereference the object.

Implements IRegistry.

Definition at line 115 of file RegistryEntry.h.

115  {
116  return ++m_refCount;
117  }
unsigned long m_refCount
Reference counter.
Definition: RegistryEntry.h:45
virtual unsigned long DataSvcHelpers::RegistryEntry::addRef ( )
inlinevirtual

IInterface implementation: Dereference the object.

Implements IRegistry.

Definition at line 115 of file RegistryEntry.h.

115  {
116  return ++m_refCount;
117  }
unsigned long m_refCount
Reference counter.
Definition: RegistryEntry.h:45
virtual IOpaqueAddress* DataSvcHelpers::RegistryEntry::address ( ) const
inlinevirtual

Retrieve opaque storage address.

Implements IRegistry.

Definition at line 135 of file RegistryEntry.h.

135  {
136  return m_pAddress;
137  }
IOpaqueAddress * m_pAddress
Pointer to opaque address (load info)
Definition: RegistryEntry.h:55
virtual IOpaqueAddress* DataSvcHelpers::RegistryEntry::address ( void  ) const
inlinevirtual

Retrieve opaque storage address.

Implements IRegistry.

Definition at line 135 of file RegistryEntry.h.

135  {
136  return m_pAddress;
137  }
IOpaqueAddress * m_pAddress
Pointer to opaque address (load info)
Definition: RegistryEntry.h:55
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 314 of file RegistryEntry.cpp.

314  {
315  if ( m_pParent ) m_pParent->assemblePath(buffer);
316  buffer += m_path;
317 }
RegistryEntry * m_pParent
Pointer to parent.
Definition: RegistryEntry.h:53
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:51
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 159 of file RegistryEntry.h.

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

Return starting point for container iteration.

Definition at line 159 of file RegistryEntry.h.

159  {
160  return m_store.begin();
161  }
Store m_store
Store of leaves.
Definition: RegistryEntry.h:61
virtual IDataProviderSvc* DataSvcHelpers::RegistryEntry::dataSvc ( ) const
inlinevirtual

Retrieve pointer to Transient Store.

Implements IRegistry.

Definition at line 127 of file RegistryEntry.h.

127  {
128  return m_pDataProviderSvc;
129  }
IDataProviderSvc * m_pDataProviderSvc
Pointer to hosting transient store.
Definition: RegistryEntry.h:59
virtual IDataProviderSvc* DataSvcHelpers::RegistryEntry::dataSvc ( ) const
inlinevirtual

Retrieve pointer to Transient Store.

Implements IRegistry.

Definition at line 127 of file RegistryEntry.h.

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

Delete all contained elements.

Delete recursively all elements pending from the current store item.

Definition at line 226 of file RegistryEntry.cpp.

226  {
227  for (auto& i : m_store ) {
229  if ( entry ) {
230  entry->deleteElements();
231  entry->release();
232  }
233  }
234  m_store.erase(m_store.begin(), m_store.end());
235  return 0;
236 }
#define CAST_REGENTRY(x, y)
RegistryEntry(std::string path, RegistryEntry *parent=0)
Standard Constructor.
Store m_store
Store of leaves.
Definition: RegistryEntry.h:61
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 163 of file RegistryEntry.h.

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

Return end elemtn if the container.

Definition at line 163 of file RegistryEntry.h.

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

Try to find an object identified by its pointer.

Definition at line 167 of file RegistryEntry.h.

167  {
168  return i_find(obj);
169  }
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 167 of file RegistryEntry.h.

167  {
168  return i_find(obj);
169  }
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 171 of file RegistryEntry.h.

171  {
172  return i_find(path);
173  }
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 171 of file RegistryEntry.h.

171  {
172  return i_find(path);
173  }
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 92 of file RegistryEntry.h.

92  {
93  return i_find(path);
94  }
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 92 of file RegistryEntry.h.

92  {
93  return i_find(path);
94  }
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 96 of file RegistryEntry.h.

96  {
97  return i_find(key);
98  }
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 96 of file RegistryEntry.h.

96  {
97  return i_find(key);
98  }
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 186 of file RegistryEntry.cpp.

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

Internal method to create entries.

Internal method to add entries.

Definition at line 170 of file RegistryEntry.cpp.

170  {
171  if ( nam.front() != SEPARATOR ) nam.insert(0,1,SEPARATOR);
172  // if this object is already present, this is an error....
173  auto not_present = std::none_of( std::begin(m_store), std::end(m_store),
174  [&](IRegistry* i) { return nam == i->name();
175  } );
176  return not_present ? new RegistryEntry( std::move(nam), this ) : nullptr;
177 }
constexpr char SEPARATOR
virtual const name_type & name() const =0
Name of the directory (or key)
RegistryEntry(std::string path, RegistryEntry *parent=0)
Standard Constructor.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
tuple end
Definition: IOTest.py:101
Store m_store
Store of leaves.
Definition: RegistryEntry.h:61
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 239 of file RegistryEntry.cpp.

239  {
240  auto i = std::find(m_store.begin(),m_store.end(),obj);
241  return (i!=m_store.end()) ? (*i) : nullptr;
242 }
Store m_store
Store of leaves.
Definition: RegistryEntry.h:61
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 245 of file RegistryEntry.cpp.

245  {
246  if ( path.front() == SEPARATOR ) path.remove_prefix(1); // strip leading '/', if present
247  while (!path.empty()) {
248  // check that the chars of path prior to / are the same as regEnt->name()
249  // (i.e. match { nam:"/Ab" path:"/Ab/C"}
250  // but not { nam:"/Abc" path:"/Ab/C"})
251  auto loc1 = path.find(SEPARATOR);
252  auto cpath = path.substr(0,loc1);
253  if (loc1 != boost::string_ref::npos) {
254  path.remove_prefix(loc1+1);
255  } else {
256  path.clear();
257  }
258  auto i = std::find_if( std::begin(m_store), std::end(m_store),
259  [&](decltype(m_store)::const_reference reg) {
260  return cpath == boost::string_ref{reg->name()}.substr(1);
261  });
262  if ( i!=std::end(m_store) ) {
264  return path.empty() ? regEnt : regEnt->i_find(path);
265  }
266  // If this node is "/NodeA", this part allows to find "/NodeA/NodeB" as
267  // our "/NodeB" child.
268  if ( cpath != boost::string_ref{m_path}.substr(1) ) break;
269  }
270  return nullptr;
271 }
constexpr char SEPARATOR
list path
Definition: __init__.py:15
#define CAST_REGENTRY(x, y)
RegistryEntry(std::string path, RegistryEntry *parent=0)
Standard Constructor.
tuple end
Definition: IOTest.py:101
Store m_store
Store of leaves.
Definition: RegistryEntry.h:61
std::string m_path
Path name.
Definition: RegistryEntry.h:51
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 274 of file RegistryEntry.cpp.

274  {
275  if ( key ) {
276  if ( key == m_pObject ) {
277  return const_cast<RegistryEntry*>(this);
278  }
279  // Look in the immediate level:
280  RegistryEntry *result = CAST_REGENTRY(RegistryEntry*, i_find(key->registry()));
281  if ( result ) return result;
282  // Go levels down
283  for (const auto& i : m_store) {
284  try {
285  const RegistryEntry *entry = CAST_REGENTRY(RegistryEntry*, i);
286  result = entry->i_find(key);
287  if( result ) return result;
288  }
289  catch ( ... ) { }
290  }
291  }
292  return nullptr;
293 }
#define CAST_REGENTRY(x, y)
RegistryEntry(std::string path, RegistryEntry *parent=0)
Standard Constructor.
Store m_store
Store of leaves.
Definition: RegistryEntry.h:61
DataObject * m_pObject
Pointer to object.
Definition: RegistryEntry.h:57
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.

virtual const std::string& DataSvcHelpers::RegistryEntry::identifier ( ) const
inlinevirtual

Full identifier (or key)

Implements IRegistry.

Definition at line 123 of file RegistryEntry.h.

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

Full identifier (or key)

Implements IRegistry.

Definition at line 123 of file RegistryEntry.h.

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

Simple check if the Container is empty.

Definition at line 155 of file RegistryEntry.h.

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

Simple check if the Container is empty.

Definition at line 155 of file RegistryEntry.h.

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

Is the link soft or hard.

Definition at line 143 of file RegistryEntry.h.

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

Is the link soft or hard.

Definition at line 143 of file RegistryEntry.h.

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

Access the leaves of the object.

Definition at line 147 of file RegistryEntry.h.

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

Access the leaves of the object.

Definition at line 147 of file RegistryEntry.h.

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

Initialize link as hard link.

Create hard link.

Definition at line 109 of file RegistryEntry.cpp.

109  {
110  makeSoft(pObject);
111  m_isSoft = false;
112  if ( m_pObject ) m_pObject->setRegistry(this);
113  if ( m_pAddress ) m_pAddress->setRegistry(this);
114 }
void setRegistry(IRegistry *pRegistry)
Set pointer to Registry.
Definition: DataObject.h:65
void makeSoft(DataObject *pObject)
Initialize link as soft link.
bool m_isSoft
Is the link soft or hard?
Definition: RegistryEntry.h:47
IOpaqueAddress * m_pAddress
Pointer to opaque address (load info)
Definition: RegistryEntry.h:55
DataObject * m_pObject
Pointer to object.
Definition: RegistryEntry.h:57
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 117 of file RegistryEntry.cpp.

117  {
118  m_isSoft = false;
119  setAddress(pAddress);
120 }
void setAddress(IOpaqueAddress *pAddress)
Set/Update Opaque address.
bool m_isSoft
Is the link soft or hard?
Definition: RegistryEntry.h:47
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 94 of file RegistryEntry.cpp.

94  {
95  m_isSoft = true;
96  setObject(pObject);
97 // if ( 0 != m_pObject ) { // Useless: This justs sets my own address again...
98 // setAddress(m_pObject->address());
99 // }
100 }
void setObject(DataObject *obj)
Set/Update object address.
bool m_isSoft
Is the link soft or hard?
Definition: RegistryEntry.h:47
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 103 of file RegistryEntry.cpp.

103  {
104  m_isSoft = true;
105  setAddress(pAddress);
106 }
void setAddress(IOpaqueAddress *pAddress)
Set/Update Opaque address.
bool m_isSoft
Is the link soft or hard?
Definition: RegistryEntry.h:47
const std::string& DataSvcHelpers::RegistryEntry::name ( ) const
inlinevirtual

Retrieve name of the entry.

Implements IRegistry.

Definition at line 119 of file RegistryEntry.h.

119  {
120  return m_path;
121  }
std::string m_path
Path name.
Definition: RegistryEntry.h:51
const std::string& DataSvcHelpers::RegistryEntry::name ( ) const
inlinevirtual

Retrieve name of the entry.

Implements IRegistry.

Definition at line 119 of file RegistryEntry.h.

119  {
120  return m_path;
121  }
std::string m_path
Path name.
Definition: RegistryEntry.h:51
virtual DataObject* DataSvcHelpers::RegistryEntry::object ( ) const
inlinevirtual

Retrive object behind the link.

Implements IRegistry.

Definition at line 131 of file RegistryEntry.h.

131  {
132  return m_pObject;
133  }
DataObject * m_pObject
Pointer to object.
Definition: RegistryEntry.h:57
virtual DataObject* DataSvcHelpers::RegistryEntry::object ( ) const
inlinevirtual

Retrive object behind the link.

Implements IRegistry.

Definition at line 131 of file RegistryEntry.h.

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

Pointer to parent directory entry.

Definition at line 139 of file RegistryEntry.h.

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

Pointer to parent directory entry.

Definition at line 139 of file RegistryEntry.h.

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

Pointer to parent registry entry.

Definition at line 88 of file RegistryEntry.h.

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

Pointer to parent registry entry.

Definition at line 88 of file RegistryEntry.h.

88  {
89  return m_pParent;
90  }
RegistryEntry * m_pParent
Pointer to parent.
Definition: RegistryEntry.h:53
virtual unsigned long DataSvcHelpers::RegistryEntry::release ( )
virtual

IInterface implementation: Reference the object.

Implements IRegistry.

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

IInterface implementation: Reference the object.

Release entry.

Implements IRegistry.

Definition at line 80 of file RegistryEntry.cpp.

80  {
81  unsigned long cnt = --m_refCount;
82  if ( !m_refCount ) delete this;
83  return cnt;
84 }
unsigned long m_refCount
Reference counter.
Definition: RegistryEntry.h:45
long DataSvcHelpers::RegistryEntry::remove ( const std::string &  name)
virtual

Remove an entry from the store.

Remove entry from data store.

Definition at line 157 of file RegistryEntry.cpp.

157  {
158  if ( nam.front() != SEPARATOR ) return remove( SEPARATOR+nam );
159  // if this object is already present, this is an error....
160  for (auto& i : m_store ) {
161  if ( nam == i->name() ) {
162  remove(i);
163  return StatusCode::SUCCESS;
164  }
165  }
166  return StatusCode::FAILURE;
167 }
constexpr char SEPARATOR
Store m_store
Store of leaves.
Definition: RegistryEntry.h:61
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 143 of file RegistryEntry.cpp.

143  {
144  try {
145  RegistryEntry* pEntry = dynamic_cast<RegistryEntry*>(obj);
146  auto i = std::remove(std::begin(m_store), std::end(m_store), pEntry);
147  if (i != std::end(m_store)) {
148  pEntry->release();
149  m_store.erase( i, std::end(m_store) );
150  }
151  }
152  catch ( ... ) { }
153  return m_store.size();
154 }
def remove(file, logdir)
Definition: install.py:153
RegistryEntry(std::string path, RegistryEntry *parent=0)
Standard Constructor.
tuple end
Definition: IOTest.py:101
Store m_store
Store of leaves.
Definition: RegistryEntry.h:61
list i
Definition: ana.py:128
void DataSvcHelpers::RegistryEntry::setAddress ( IOpaqueAddress pAddress)
virtual

Set/Update Opaque address.

Update Opaque address of registry entry.

Implements IRegistry.

Definition at line 123 of file RegistryEntry.cpp.

123  {
124  if ( pAddress ) {
125  pAddress->addRef();
126  pAddress->setRegistry(this);
127  }
128  if ( m_pAddress ) m_pAddress->release();
129  m_pAddress = pAddress;
130 }
virtual unsigned long release()=0
release reference to object
IOpaqueAddress * m_pAddress
Pointer to opaque address (load info)
Definition: RegistryEntry.h:55
virtual void setRegistry(IRegistry *r)=0
Update directory pointer.
virtual unsigned long addRef()=0
Add reference to object.
void DataSvcHelpers::RegistryEntry::setAddress ( IOpaqueAddress pAddress)
virtual

Set/Update Opaque address.

Implements IRegistry.

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

Set the transient data store.

Definition at line 84 of file RegistryEntry.h.

84  {
86  }
IDataProviderSvc * m_pDataProviderSvc
Pointer to hosting transient store.
Definition: RegistryEntry.h:59
string s
Definition: gaudirun.py:244
void DataSvcHelpers::RegistryEntry::setDataSvc ( IDataProviderSvc s)
inlineprivate

Set the transient data store.

Definition at line 84 of file RegistryEntry.h.

84  {
86  }
IDataProviderSvc * m_pDataProviderSvc
Pointer to hosting transient store.
Definition: RegistryEntry.h:59
string s
Definition: gaudirun.py:244
void DataSvcHelpers::RegistryEntry::setObject ( DataObject obj)

Set/Update object address.

Set object pointer of data store item.

Definition at line 133 of file RegistryEntry.cpp.

133  {
134  if ( pObject ) {
135  pObject->addRef();
136  if ( !isSoft() ) pObject->setRegistry(this);
137  }
138  if ( m_pObject ) m_pObject->release();
139  m_pObject = pObject;
140 }
virtual bool isSoft() const
Is the link soft or hard.
virtual unsigned long release()
release reference to object
Definition: DataObject.cpp:44
DataObject * m_pObject
Pointer to object.
Definition: RegistryEntry.h:57
void DataSvcHelpers::RegistryEntry::setObject ( DataObject obj)

Set/Update object address.

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

Set new parent pointer.

Definition at line 87 of file RegistryEntry.cpp.

87  {
88  m_pParent = pParent;
89  m_fullpath = "";
91 }
std::string m_fullpath
String containing full path of the object (volatile)
Definition: RegistryEntry.h:49
RegistryEntry * m_pParent
Pointer to parent.
Definition: RegistryEntry.h:53
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 151 of file RegistryEntry.h.

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

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

Definition at line 151 of file RegistryEntry.h.

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

traverse data tree

Definition at line 296 of file RegistryEntry.cpp.

296  {
297  bool go_down = pAgent->analyse(this, level);
298  long status = StatusCode::SUCCESS;
299  if ( go_down ) {
300  for ( auto& i : m_store ) {
301  try {
303  entry->traverseTree(pAgent, level+1);
304  }
305  catch (...) {
306  status = StatusCode::FAILURE;
307  }
308  }
309  }
310  return status;
311 }
virtual bool analyse(IRegistry *pObject, int level)=0
Analyse the data object.
#define CAST_REGENTRY(x, y)
RegistryEntry(std::string path, RegistryEntry *parent=0)
Standard Constructor.
Store m_store
Store of leaves.
Definition: RegistryEntry.h:61
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 40 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 49 of file RegistryEntry.h.

bool DataSvcHelpers::RegistryEntry::m_isSoft
private

Is the link soft or hard?

Definition at line 47 of file RegistryEntry.h.

IOpaqueAddress * DataSvcHelpers::RegistryEntry::m_pAddress
private

Pointer to opaque address (load info)

Definition at line 55 of file RegistryEntry.h.

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

Path name.

Definition at line 51 of file RegistryEntry.h.

IDataProviderSvc * DataSvcHelpers::RegistryEntry::m_pDataProviderSvc
private

Pointer to hosting transient store.

Definition at line 59 of file RegistryEntry.h.

DataObject * DataSvcHelpers::RegistryEntry::m_pObject
private

Pointer to object.

Definition at line 57 of file RegistryEntry.h.

RegistryEntry * DataSvcHelpers::RegistryEntry::m_pParent
private

Pointer to parent.

Definition at line 53 of file RegistryEntry.h.

unsigned long DataSvcHelpers::RegistryEntry::m_refCount
private

Reference counter.

Definition at line 45 of file RegistryEntry.h.

Store DataSvcHelpers::RegistryEntry::m_store
private

Store of leaves.

Definition at line 61 of file RegistryEntry.h.


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