The Gaudi Framework  v30r0 (c919700c)
DataSvcHelpers::RegistryEntry Class Referencefinal

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...
 
- Public Types inherited from IRegistry
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::stringname () const override
 Retrieve name of the entry. More...
 
const std::stringidentifier () 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 (boost::string_ref 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 StatusCode add (std::string name, DataObject *pObject, bool is_soft=false)
 Add entry to data store. More...
 
virtual StatusCode add (std::string name, IOpaqueAddress *pAddress, bool is_soft=false)
 Add entry to data store. More...
 
virtual StatusCode remove (boost::string_ref 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 StatusCode traverseTree (IDataStoreAgent *pAgent, int level=0)
 traverse data tree More...
 
- Public Member Functions inherited from IRegistry
virtual ~IRegistry ()=default
 destructor More...
 

Private Types

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...
 

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
 
class ::TsDataSvc
 

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 36 of file RegistryEntry.h.

Member Typedef Documentation

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

Iterator definition.

Definition at line 47 of file RegistryEntry.h.

Definition of datastore type.

Definition at line 40 of file RegistryEntry.h.

Constructor & Destructor Documentation

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

Standard Constructor.

Definition at line 43 of file RegistryEntry.cpp.

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

Standard Destructor.

Standard destructor.

Definition at line 54 of file RegistryEntry.cpp.

55 {
57  if ( m_pObject ) {
58  if ( !m_isSoft ) m_pObject->setRegistry( nullptr );
59  m_pObject->release();
60  }
61  if ( m_pAddress ) {
62  if ( !m_isSoft ) m_pAddress->setRegistry( nullptr );
64  }
65 }
virtual long deleteElements()
Delete all contained elements.
void setRegistry(IRegistry *pRegistry)
Set pointer to Registry.
Definition: DataObject.h:71
virtual unsigned long release()=0
release reference to object
IOpaqueAddress * m_pAddress
Pointer to opaque address (load info)
Definition: RegistryEntry.h:61
bool m_isSoft
Is the link soft or hard?
Definition: RegistryEntry.h:53
virtual unsigned long release()
release reference to object
Definition: DataObject.cpp:51
DataObject * m_pObject
Pointer to object.
Definition: RegistryEntry.h:63
virtual void setRegistry(IRegistry *r)=0
Update directory pointer.

Member Function Documentation

StatusCode DataSvcHelpers::RegistryEntry::add ( 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.

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

219 {
220  RegistryEntry* entry = i_create( std::move( name ) );
221  if ( !entry ) return StatusCode::FAILURE;
222  ( is_soft ) ? entry->makeSoft( pAddress ) : entry->makeHard( pAddress );
223  i_add( entry );
224  return StatusCode::SUCCESS;
225 }
long i_add(RegistryEntry *entry)
Internal method to add entries.
RegistryEntry * i_create(std::string name)
Internal method to create entries.
T move(T...args)
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.
long DataSvcHelpers::RegistryEntry::add ( IRegistry obj)
virtual

Add object to the container.

Reimplemented in Hive::HiveEventRegistryEntry.

Definition at line 179 of file RegistryEntry.cpp.

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

IInterface implementation: Dereference the object.

Implements IRegistry.

Definition at line 114 of file RegistryEntry.h.

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

Retrieve opaque storage address.

Implements IRegistry.

Definition at line 124 of file RegistryEntry.h.

124 { return m_pAddress; }
IOpaqueAddress * m_pAddress
Pointer to opaque address (load info)
Definition: RegistryEntry.h:61
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 316 of file RegistryEntry.cpp.

317 {
318  if ( m_pParent ) m_pParent->assemblePath( buffer );
319  buffer += m_path;
320 }
RegistryEntry * m_pParent
Pointer to parent.
Definition: RegistryEntry.h:59
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:57
virtual Iterator DataSvcHelpers::RegistryEntry::begin ( ) const
inlinevirtual

Return starting point for container iteration.

Definition at line 136 of file RegistryEntry.h.

136 { return m_store.begin(); }
T begin(T...args)
Store m_store
Store of leaves.
Definition: RegistryEntry.h:67
IDataProviderSvc* DataSvcHelpers::RegistryEntry::dataSvc ( ) const
inlineoverridevirtual

Retrieve pointer to Transient Store.

Implements IRegistry.

Definition at line 120 of file RegistryEntry.h.

120 { return m_pDataProviderSvc; }
IDataProviderSvc * m_pDataProviderSvc
Pointer to hosting transient store.
Definition: RegistryEntry.h:65
long DataSvcHelpers::RegistryEntry::deleteElements ( )
virtual

Delete all contained elements.

Delete recursively all elements pending from the current store item.

Definition at line 228 of file RegistryEntry.cpp.

229 {
230  for ( auto& i : m_store ) {
231  RegistryEntry* entry = CAST_REGENTRY( RegistryEntry*, i );
232  if ( entry ) {
233  entry->deleteElements();
234  entry->release();
235  }
236  }
237  m_store.erase( m_store.begin(), m_store.end() );
238  return 0;
239 }
#define CAST_REGENTRY(x, y)
Store m_store
Store of leaves.
Definition: RegistryEntry.h:67
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.
virtual Iterator DataSvcHelpers::RegistryEntry::end ( ) const
inlinevirtual

Return end elemtn if the container.

Definition at line 138 of file RegistryEntry.h.

138 { return m_store.end(); }
T end(T...args)
Store m_store
Store of leaves.
Definition: RegistryEntry.h:67
virtual IRegistry* DataSvcHelpers::RegistryEntry::find ( const IRegistry obj) const
inlinevirtual

Try to find an object identified by its pointer.

Definition at line 140 of file RegistryEntry.h.

140 { return i_find( obj ); }
IRegistry * i_find(const IRegistry *pDirectory) const
Internal method to retrieve data directory.
virtual IRegistry* DataSvcHelpers::RegistryEntry::find ( boost::string_ref  path) const
inlinevirtual

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

Definition at line 142 of file RegistryEntry.h.

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

94 { return i_find( path ); }
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 { return i_find( key ); }
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.

Add object to the container.

Definition at line 186 of file RegistryEntry.cpp.

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

Internal method to create entries.

Internal method to add entries.

Definition at line 169 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 =
174  std::none_of( std::begin( m_store ), std::end( m_store ), [&]( IRegistry* i ) { return nam == i->name(); } );
175  return not_present ? new RegistryEntry( std::move( nam ), this ) : nullptr;
176 }
constexpr char SEPARATOR
virtual const name_type & name() const =0
Name of the directory (or key)
T end(T...args)
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
T move(T...args)
T begin(T...args)
T none_of(T...args)
Store m_store
Store of leaves.
Definition: RegistryEntry.h:67
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.
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 242 of file RegistryEntry.cpp.

243 {
244  auto i = std::find( m_store.begin(), m_store.end(), obj );
245  return ( i != m_store.end() ) ? ( *i ) : nullptr;
246 }
T end(T...args)
T find(T...args)
T begin(T...args)
Store m_store
Store of leaves.
Definition: RegistryEntry.h:67
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 249 of file RegistryEntry.cpp.

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

278 {
279  if ( key ) {
280  if ( key == m_pObject ) return const_cast<RegistryEntry*>( this );
281  // Look in the immediate level:
282  RegistryEntry* result = CAST_REGENTRY( RegistryEntry*, i_find( key->registry() ) );
283  if ( result ) return result;
284  // Go levels down
285  for ( const auto& i : m_store ) {
286  try {
287  const RegistryEntry* entry = CAST_REGENTRY( RegistryEntry*, i );
288  result = entry->i_find( key );
289  if ( result ) return result;
290  } catch ( ... ) {
291  }
292  }
293  }
294  return nullptr;
295 }
#define CAST_REGENTRY(x, y)
DataObject * m_pObject
Pointer to object.
Definition: RegistryEntry.h:63
Store m_store
Store of leaves.
Definition: RegistryEntry.h:67
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.
IRegistry * i_find(const IRegistry *pDirectory) const
Internal method to retrieve data directory.
const std::string& DataSvcHelpers::RegistryEntry::identifier ( ) const
inlineoverridevirtual

Full identifier (or key)

Implements IRegistry.

Definition at line 118 of file RegistryEntry.h.

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

Simple check if the Container is empty.

Definition at line 134 of file RegistryEntry.h.

134 { return m_store.size() == 0; }
T size(T...args)
Store m_store
Store of leaves.
Definition: RegistryEntry.h:67
virtual bool DataSvcHelpers::RegistryEntry::isSoft ( ) const
inlinevirtual

Is the link soft or hard.

Definition at line 128 of file RegistryEntry.h.

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

Access the leaves of the object.

Definition at line 130 of file RegistryEntry.h.

130 { return m_store; }
Store m_store
Store of leaves.
Definition: RegistryEntry.h:67
void DataSvcHelpers::RegistryEntry::makeHard ( DataObject pObject)
private

Initialize link as hard link.

Create hard link.

Definition at line 101 of file RegistryEntry.cpp.

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

Initialize link as hard link.

Create hard link.

Definition at line 110 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:53
void DataSvcHelpers::RegistryEntry::makeSoft ( DataObject pObject)
private

Initialize link as soft link.

Create soft link.

Definition at line 84 of file RegistryEntry.cpp.

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

Initialize link as soft link.

Create soft link.

Definition at line 94 of file RegistryEntry.cpp.

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

Retrieve name of the entry.

Implements IRegistry.

Definition at line 116 of file RegistryEntry.h.

116 { return m_path; }
std::string m_path
Path name.
Definition: RegistryEntry.h:57
DataObject* DataSvcHelpers::RegistryEntry::object ( ) const
inlineoverridevirtual

Retrive object behind the link.

Implements IRegistry.

Definition at line 122 of file RegistryEntry.h.

122 { return m_pObject; }
DataObject * m_pObject
Pointer to object.
Definition: RegistryEntry.h:63
virtual IRegistry* DataSvcHelpers::RegistryEntry::parent ( ) const
inlinevirtual

Pointer to parent directory entry.

Definition at line 126 of file RegistryEntry.h.

126 { return m_pParent; }
RegistryEntry * m_pParent
Pointer to parent.
Definition: RegistryEntry.h:59
virtual RegistryEntry* DataSvcHelpers::RegistryEntry::parentEntry ( )
inlineprivatevirtual

Pointer to parent registry entry.

Definition at line 92 of file RegistryEntry.h.

92 { return m_pParent; }
RegistryEntry * m_pParent
Pointer to parent.
Definition: RegistryEntry.h:59
unsigned long DataSvcHelpers::RegistryEntry::release ( )
overridevirtual

IInterface implementation: Reference the object.

Release entry.

Implements IRegistry.

Definition at line 68 of file RegistryEntry.cpp.

69 {
70  unsigned long cnt = --m_refCount;
71  if ( !m_refCount ) delete this;
72  return cnt;
73 }
unsigned long m_refCount
Reference counter.
Definition: RegistryEntry.h:51
StatusCode DataSvcHelpers::RegistryEntry::remove ( boost::string_ref  name)
virtual

Remove an entry from the store.

Remove entry from data store.

Definition at line 154 of file RegistryEntry.cpp.

155 {
156  if ( path.front() == SEPARATOR ) path.remove_prefix( 1 );
157  auto i = std::find_if( m_store.begin(), m_store.end(), [&]( const auto* j ) {
158  boost::string_ref name{j->name()};
159  name.remove_prefix( 1 ); // skip leading SEPARATOR
160  return name == path;
161  } );
162  // if the requested object is not present, this is an error....
163  if ( i == m_store.end() ) return StatusCode::FAILURE;
164  remove( *i );
165  return StatusCode::SUCCESS;
166 }
constexpr char SEPARATOR
const std::string & name() const override
Retrieve name of the entry.
T end(T...args)
T find_if(T...args)
T begin(T...args)
Store m_store
Store of leaves.
Definition: RegistryEntry.h:67
long DataSvcHelpers::RegistryEntry::remove ( IRegistry obj)
virtual

Remove an object from the container.

Definition at line 139 of file RegistryEntry.cpp.

140 {
141  try {
142  RegistryEntry* pEntry = dynamic_cast<RegistryEntry*>( obj );
143  auto i = std::remove( std::begin( m_store ), std::end( m_store ), pEntry );
144  if ( i != std::end( m_store ) ) {
145  pEntry->release();
146  m_store.erase( i, std::end( m_store ) );
147  }
148  } catch ( ... ) {
149  }
150  return m_store.size();
151 }
T end(T...args)
T remove(T...args)
T erase(T...args)
T size(T...args)
T begin(T...args)
Store m_store
Store of leaves.
Definition: RegistryEntry.h:67
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.
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.

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

Set the transient data store.

Definition at line 90 of file RegistryEntry.h.

90 { m_pDataProviderSvc = s; }
IDataProviderSvc * m_pDataProviderSvc
Pointer to hosting transient store.
Definition: RegistryEntry.h:65
string s
Definition: gaudirun.py:253
void DataSvcHelpers::RegistryEntry::setObject ( DataObject obj)

Set/Update object address.

Set object pointer of data store item.

Definition at line 128 of file RegistryEntry.cpp.

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

Set new parent pointer.

Definition at line 76 of file RegistryEntry.cpp.

77 {
78  m_pParent = pParent;
79  m_fullpath.clear();
81 }
RegistryEntry * m_pParent
Pointer to parent.
Definition: RegistryEntry.h:59
std::string m_fullpath
String containing full path of the object (volatile)
Definition: RegistryEntry.h:55
void assemblePath(std::string &buffer) const
The following entries serve two aspects: 1) They are faster for recursive calls, because they are non...
T clear(T...args)
virtual int DataSvcHelpers::RegistryEntry::size ( ) const
inlinevirtual

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

Definition at line 132 of file RegistryEntry.h.

132 { return m_store.size(); }
T size(T...args)
Store m_store
Store of leaves.
Definition: RegistryEntry.h:67
StatusCode DataSvcHelpers::RegistryEntry::traverseTree ( IDataStoreAgent pAgent,
int  level = 0 
)
virtual

traverse data tree

Definition at line 298 of file RegistryEntry.cpp.

299 {
300  bool go_down = pAgent->analyse( this, level );
301  StatusCode status;
302  if ( go_down ) {
303  for ( auto& i : m_store ) {
304  try {
305  RegistryEntry* entry = CAST_REGENTRY( RegistryEntry*, i );
306  entry->traverseTree( pAgent, level + 1 ).ignore();
307  } catch ( ... ) {
308  status = StatusCode::FAILURE;
309  }
310  }
311  }
312  return status;
313 }
virtual bool analyse(IRegistry *pObject, int level)=0
Analyse the data object.
#define CAST_REGENTRY(x, y)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
Store m_store
Store of leaves.
Definition: RegistryEntry.h:67
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.

Friends And Related Function Documentation

friend class ::DataSvc
friend

Definition at line 43 of file RegistryEntry.h.

friend class ::TsDataSvc
friend

Definition at line 45 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 55 of file RegistryEntry.h.

bool DataSvcHelpers::RegistryEntry::m_isSoft = false
private

Is the link soft or hard?

Definition at line 53 of file RegistryEntry.h.

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

Pointer to opaque address (load info)

Definition at line 61 of file RegistryEntry.h.

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

Path name.

Definition at line 57 of file RegistryEntry.h.

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

Pointer to hosting transient store.

Definition at line 65 of file RegistryEntry.h.

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

Pointer to object.

Definition at line 63 of file RegistryEntry.h.

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

Pointer to parent.

Definition at line 59 of file RegistryEntry.h.

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

Reference counter.

Definition at line 51 of file RegistryEntry.h.

Store DataSvcHelpers::RegistryEntry::m_store
private

Store of leaves.

Definition at line 67 of file RegistryEntry.h.


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