The Gaudi Framework  v33r0 (d5ea422b)
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...
 
IRegistryparent () const
 Pointer to parent directory entry. More...
 
bool isSoft () const
 Is the link soft or hard. More...
 
const Storeleaves () const
 Access the leaves of the object. More...
 
int size () const
 Return the size of the container(=number of objects) More...
 
bool isEmpty () const
 Simple check if the Container is empty. More...
 
Iterator begin () const
 Return starting point for container iteration. More...
 
Iterator end () const
 Return end elemtn if the container. More...
 
IRegistryfind (const IRegistry *obj) const
 Try to find an object identified by its pointer. More...
 
IRegistryfind (std::string_view 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...
 
StatusCode add (std::string name, DataObject *pObject, bool is_soft=false)
 Add entry to data store. More...
 
StatusCode add (std::string name, IOpaqueAddress *pAddress, bool is_soft=false)
 Add entry to data store. More...
 
StatusCode remove (std::string_view name)
 Remove an entry from the store. More...
 
long add (IRegistry *obj)
 Add object to the container. More...
 
long remove (IRegistry *obj)
 Remove an object from the container. More...
 
long deleteElements ()
 Delete all contained elements. More...
 
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 (std::string_view 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...
 
RegistryEntryparentEntry ()
 Pointer to parent registry entry. More...
 
RegistryEntryfindLeaf (std::string_view 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 46 of file RegistryEntry.h.

Member Typedef Documentation

◆ Iterator

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

Iterator definition.

Definition at line 56 of file RegistryEntry.h.

◆ Store

Definition of datastore type.

Definition at line 49 of file RegistryEntry.h.

Constructor & Destructor Documentation

◆ RegistryEntry()

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

Standard Constructor.

Definition at line 53 of file RegistryEntry.cpp.

54  : m_path( std::move( path ) ), m_pParent( parent ) {
55  std::string::size_type sep = m_path.rfind( SEPARATOR );
56  if ( m_path.front() != SEPARATOR ) m_path.insert( 0, 1, SEPARATOR );
57  if ( sep != std::string::npos ) m_path.erase( 0, sep );
59  addRef();
60 }
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:68
IRegistry * parent() const
Pointer to parent directory entry.
std::string m_fullpath
String containing full path of the object (volatile)
Definition: RegistryEntry.h:64
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)
std::string m_path
Path name.
Definition: RegistryEntry.h:66

◆ ~RegistryEntry()

DataSvcHelpers::RegistryEntry::~RegistryEntry ( )
override

Standard Destructor.

Standard destructor.

Definition at line 63 of file RegistryEntry.cpp.

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

Member Function Documentation

◆ add() [1/3]

StatusCode DataSvcHelpers::RegistryEntry::add ( std::string  name,
DataObject pObject,
bool  is_soft = false 
)

Add entry to data store.

Add entry to the current data store item.

Definition at line 198 of file RegistryEntry.cpp.

198  {
199  RegistryEntry* entry = i_create( std::move( name ) );
200  if ( !entry ) return StatusCode::FAILURE;
201  ( is_soft ) ? entry->makeSoft( pObject ) : entry->makeHard( pObject );
202  i_add( entry );
203  return StatusCode::SUCCESS;
204 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:96
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.
T move(T... args)
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.
constexpr static const auto FAILURE
Definition: StatusCode.h:97

◆ add() [2/3]

StatusCode DataSvcHelpers::RegistryEntry::add ( std::string  name,
IOpaqueAddress pAddress,
bool  is_soft = false 
)

Add entry to data store.

Add entry to the current data store item.

Definition at line 207 of file RegistryEntry.cpp.

207  {
208  RegistryEntry* entry = i_create( std::move( name ) );
209  if ( !entry ) return StatusCode::FAILURE;
210  ( is_soft ) ? entry->makeSoft( pAddress ) : entry->makeHard( pAddress );
211  i_add( entry );
212  return StatusCode::SUCCESS;
213 }
constexpr static const auto SUCCESS
Definition: StatusCode.h:96
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.
T move(T... args)
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.
constexpr static const auto FAILURE
Definition: StatusCode.h:97

◆ add() [3/3]

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

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.

◆ addRef()

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

IInterface implementation: Dereference the object.

Implements IRegistry.

Definition at line 123 of file RegistryEntry.h.

123 { return ++m_refCount; }
unsigned long m_refCount
Reference counter.
Definition: RegistryEntry.h:60

◆ address()

IOpaqueAddress* DataSvcHelpers::RegistryEntry::address ( ) const
inlineoverridevirtual

Retrieve opaque storage address.

Implements IRegistry.

Definition at line 133 of file RegistryEntry.h.

133 { return m_pAddress; }
IOpaqueAddress * m_pAddress
Pointer to opaque address (load info)
Definition: RegistryEntry.h:70

◆ assemblePath()

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

296  {
297  if ( m_pParent ) m_pParent->assemblePath( buffer );
298  buffer += m_path;
299 }
RegistryEntry * m_pParent
Pointer to parent.
Definition: RegistryEntry.h:68
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:66

◆ begin()

Iterator DataSvcHelpers::RegistryEntry::begin ( ) const
inline

Return starting point for container iteration.

Definition at line 145 of file RegistryEntry.h.

145 { return m_store.begin(); }
T begin(T... args)
Store m_store
Store of leaves.
Definition: RegistryEntry.h:76

◆ dataSvc()

IDataProviderSvc* DataSvcHelpers::RegistryEntry::dataSvc ( ) const
inlineoverridevirtual

Retrieve pointer to Transient Store.

Implements IRegistry.

Definition at line 129 of file RegistryEntry.h.

129 { return m_pDataProviderSvc; }
IDataProviderSvc * m_pDataProviderSvc
Pointer to hosting transient store.
Definition: RegistryEntry.h:74

◆ deleteElements()

long DataSvcHelpers::RegistryEntry::deleteElements ( )

Delete all contained elements.

Delete recursively all elements pending from the current store item.

Definition at line 216 of file RegistryEntry.cpp.

216  {
217  for ( auto& i : m_store ) {
218  RegistryEntry* entry = CAST_REGENTRY( RegistryEntry*, i );
219  if ( entry ) {
220  entry->deleteElements();
221  entry->release();
222  }
223  }
225  return 0;
226 }
#define CAST_REGENTRY(x, y)
T end(T... args)
T erase(T... args)
T begin(T... args)
Store m_store
Store of leaves.
Definition: RegistryEntry.h:76
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.

◆ end()

Iterator DataSvcHelpers::RegistryEntry::end ( ) const
inline

Return end elemtn if the container.

Definition at line 147 of file RegistryEntry.h.

147 { return m_store.end(); }
T end(T... args)
Store m_store
Store of leaves.
Definition: RegistryEntry.h:76

◆ find() [1/2]

IRegistry* DataSvcHelpers::RegistryEntry::find ( const IRegistry obj) const
inline

Try to find an object identified by its pointer.

Definition at line 149 of file RegistryEntry.h.

149 { return i_find( obj ); }
IRegistry * i_find(const IRegistry *pDirectory) const
Internal method to retrieve data directory.

◆ find() [2/2]

IRegistry* DataSvcHelpers::RegistryEntry::find ( std::string_view  path) const
inline

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

Definition at line 151 of file RegistryEntry.h.

151 { return i_find( path ); }
IRegistry * i_find(const IRegistry *pDirectory) const
Internal method to retrieve data directory.

◆ findLeaf() [1/2]

RegistryEntry* DataSvcHelpers::RegistryEntry::findLeaf ( std::string_view  path) const
inlineprivate

Find identified leaf in this registry node.

Definition at line 103 of file RegistryEntry.h.

103 { return i_find( path ); }
IRegistry * i_find(const IRegistry *pDirectory) const
Internal method to retrieve data directory.

◆ findLeaf() [2/2]

RegistryEntry* DataSvcHelpers::RegistryEntry::findLeaf ( const DataObject key) const
inlineprivate

Find identified leaf in this registry node.

Definition at line 105 of file RegistryEntry.h.

105 { return i_find( key ); }
IRegistry * i_find(const IRegistry *pDirectory) const
Internal method to retrieve data directory.

◆ i_add()

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() ) { pEntry->address()->setRegistry( pEntry ); }
193  } catch ( ... ) {}
194  return m_store.size();
195 }
T push_back(T... args)
IDataProviderSvc * m_pDataProviderSvc
Pointer to hosting transient store.
Definition: RegistryEntry.h:74
virtual IOpaqueAddress * address() const =0
Retrieve opaque storage address.
T size(T... args)
Store m_store
Store of leaves.
Definition: RegistryEntry.h:76
virtual void setRegistry(IRegistry *r)=0
Update directory pointer.

◆ i_create()

DataSvcHelpers::RegistryEntry * DataSvcHelpers::RegistryEntry::i_create ( std::string  name)
private

Internal method to create entries.

Internal method to add entries.

Definition at line 165 of file RegistryEntry.cpp.

165  {
166  if ( nam.front() != SEPARATOR ) nam.insert( 0, 1, SEPARATOR );
167  // if this object is already present, this is an error....
168  auto not_present =
169  std::none_of( std::begin( m_store ), std::end( m_store ), [&]( IRegistry* i ) { return nam == i->name(); } );
170  return not_present ? new RegistryEntry( std::move( nam ), this ) : nullptr;
171 }
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:32
T move(T... args)
T begin(T... args)
T none_of(T... args)
Store m_store
Store of leaves.
Definition: RegistryEntry.h:76
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.

◆ i_find() [1/3]

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

229  {
230  auto i = std::find( m_store.begin(), m_store.end(), obj );
231  return ( i != m_store.end() ) ? ( *i ) : nullptr;
232 }
T end(T... args)
T find(T... args)
T begin(T... args)
Store m_store
Store of leaves.
Definition: RegistryEntry.h:76

◆ i_find() [2/3]

DataSvcHelpers::RegistryEntry * DataSvcHelpers::RegistryEntry::i_find ( std::string_view  path) const
private

Internal method to retrieve data directory.

Find identified leaf in this registry node.

Definition at line 235 of file RegistryEntry.cpp.

235  {
236  if ( path.front() == SEPARATOR ) path.remove_prefix( 1 ); // strip leading '/', if present
237  while ( !path.empty() ) {
238  // check that the chars of path prior to / are the same as regEnt->name()
239  // (i.e. match { nam:"/Ab" path:"/Ab/C"}
240  // but not { nam:"/Abc" path:"/Ab/C"})
241  auto loc1 = path.find( SEPARATOR );
242  auto cpath = path.substr( 0, loc1 );
243  if ( loc1 != std::string_view::npos ) {
244  path.remove_prefix( loc1 + 1 );
245  } else {
246  path = std::string_view{};
247  }
249  [&]( const auto& reg ) { return cpath == std::string_view{reg->name()}.substr( 1 ); } );
250  if ( i != std::end( m_store ) ) {
251  RegistryEntry* regEnt = CAST_REGENTRY( RegistryEntry*, *i );
252  return path.empty() ? regEnt : regEnt->i_find( path );
253  }
254  // If this node is "/NodeA", this part allows to find "/NodeA/NodeB" as
255  // our "/NodeB" child.
256  if ( cpath != std::string_view{m_path}.substr( 1 ) ) break;
257  }
258  return nullptr;
259 }
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:76
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.
std::string m_path
Path name.
Definition: RegistryEntry.h:66
T substr(T... args)

◆ i_find() [3/3]

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

262  {
263  if ( key ) {
264  if ( key == m_pObject ) return const_cast<RegistryEntry*>( this );
265  // Look in the immediate level:
266  RegistryEntry* result = CAST_REGENTRY( RegistryEntry*, i_find( key->registry() ) );
267  if ( result ) return result;
268  // Go levels down
269  for ( const auto& i : m_store ) {
270  try {
271  const RegistryEntry* entry = CAST_REGENTRY( RegistryEntry*, i );
272  result = entry->i_find( key );
273  if ( result ) return result;
274  } catch ( ... ) {}
275  }
276  }
277  return nullptr;
278 }
#define CAST_REGENTRY(x, y)
IRegistry * i_find(const IRegistry *pDirectory) const
Internal method to retrieve data directory.
DataObject * m_pObject
Pointer to object.
Definition: RegistryEntry.h:72
Store m_store
Store of leaves.
Definition: RegistryEntry.h:76
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.

◆ identifier()

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

Full identifier (or key)

Implements IRegistry.

Definition at line 127 of file RegistryEntry.h.

127 { return m_fullpath; }
std::string m_fullpath
String containing full path of the object (volatile)
Definition: RegistryEntry.h:64

◆ isEmpty()

bool DataSvcHelpers::RegistryEntry::isEmpty ( ) const
inline

Simple check if the Container is empty.

Definition at line 143 of file RegistryEntry.h.

143 { return m_store.size() == 0; }
T size(T... args)
Store m_store
Store of leaves.
Definition: RegistryEntry.h:76

◆ isSoft()

bool DataSvcHelpers::RegistryEntry::isSoft ( ) const
inline

Is the link soft or hard.

Definition at line 137 of file RegistryEntry.h.

137 { return m_isSoft; }
bool m_isSoft
Is the link soft or hard?
Definition: RegistryEntry.h:62

◆ leaves()

const Store& DataSvcHelpers::RegistryEntry::leaves ( ) const
inline

Access the leaves of the object.

Definition at line 139 of file RegistryEntry.h.

139 { return m_store; }
Store m_store
Store of leaves.
Definition: RegistryEntry.h:76

◆ makeHard() [1/2]

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

Initialize link as hard link.

Create hard link.

Definition at line 105 of file RegistryEntry.cpp.

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

◆ makeHard() [2/2]

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

Initialize link as hard link.

Create hard link.

Definition at line 113 of file RegistryEntry.cpp.

113  {
114  m_isSoft = false;
115  setAddress( pAddress );
116 }
void setAddress(IOpaqueAddress *pAddress) override
Set/Update Opaque address.
bool m_isSoft
Is the link soft or hard?
Definition: RegistryEntry.h:62

◆ makeSoft() [1/2]

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

Initialize link as soft link.

Create soft link.

Definition at line 90 of file RegistryEntry.cpp.

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

◆ makeSoft() [2/2]

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

Initialize link as soft link.

Create soft link.

Definition at line 99 of file RegistryEntry.cpp.

99  {
100  m_isSoft = true;
101  setAddress( pAddress );
102 }
void setAddress(IOpaqueAddress *pAddress) override
Set/Update Opaque address.
bool m_isSoft
Is the link soft or hard?
Definition: RegistryEntry.h:62

◆ name()

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

Retrieve name of the entry.

Implements IRegistry.

Definition at line 125 of file RegistryEntry.h.

125 { return m_path; }
std::string m_path
Path name.
Definition: RegistryEntry.h:66

◆ object()

DataObject* DataSvcHelpers::RegistryEntry::object ( ) const
inlineoverridevirtual

Retrive object behind the link.

Implements IRegistry.

Definition at line 131 of file RegistryEntry.h.

131 { return m_pObject; }
DataObject * m_pObject
Pointer to object.
Definition: RegistryEntry.h:72

◆ parent()

IRegistry* DataSvcHelpers::RegistryEntry::parent ( ) const
inline

Pointer to parent directory entry.

Definition at line 135 of file RegistryEntry.h.

135 { return m_pParent; }
RegistryEntry * m_pParent
Pointer to parent.
Definition: RegistryEntry.h:68

◆ parentEntry()

RegistryEntry* DataSvcHelpers::RegistryEntry::parentEntry ( )
inlineprivate

Pointer to parent registry entry.

Definition at line 101 of file RegistryEntry.h.

101 { return m_pParent; }
RegistryEntry * m_pParent
Pointer to parent.
Definition: RegistryEntry.h:68

◆ release()

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

IInterface implementation: Reference the object.

Release entry.

Implements IRegistry.

Definition at line 76 of file RegistryEntry.cpp.

76  {
77  unsigned long cnt = --m_refCount;
78  if ( !m_refCount ) delete this;
79  return cnt;
80 }
unsigned long m_refCount
Reference counter.
Definition: RegistryEntry.h:60

◆ remove() [1/2]

StatusCode DataSvcHelpers::RegistryEntry::remove ( std::string_view  name)

Remove an entry from the store.

Remove entry from data store.

Definition at line 152 of file RegistryEntry.cpp.

152  {
153  if ( nam.front() == SEPARATOR ) nam.remove_prefix( 1 );
154  auto i = std::find_if( m_store.begin(), m_store.end(), [&]( const auto* entry ) {
155  // skip leading SEPARATOR
156  return entry->name().compare( 1, std::string::npos, nam.data(), nam.size() ) == 0;
157  } );
158  // if the requested object is not present, this is an error....
159  if ( i == m_store.end() ) return StatusCode::FAILURE;
160  remove( *i );
161  return StatusCode::SUCCESS;
162 }
constexpr char SEPARATOR
constexpr static const auto SUCCESS
Definition: StatusCode.h:96
virtual const name_type & name() const =0
Name of the directory (or key)
T end(T... args)
StatusCode remove(std::string_view name)
Remove an entry from the store.
T find_if(T... args)
T begin(T... args)
Store m_store
Store of leaves.
Definition: RegistryEntry.h:76
constexpr static const auto FAILURE
Definition: StatusCode.h:97
T compare(T... args)

◆ remove() [2/2]

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

Remove an object from the container.

Definition at line 139 of file RegistryEntry.cpp.

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

◆ setAddress()

void DataSvcHelpers::RegistryEntry::setAddress ( IOpaqueAddress pAddress)
overridevirtual

Set/Update Opaque address.

Update Opaque address of registry entry.

Implements IRegistry.

Definition at line 119 of file RegistryEntry.cpp.

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

◆ setDataSvc()

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

Set the transient data store.

Definition at line 99 of file RegistryEntry.h.

99 { m_pDataProviderSvc = s; }
IDataProviderSvc * m_pDataProviderSvc
Pointer to hosting transient store.
Definition: RegistryEntry.h:74
string s
Definition: gaudirun.py:328

◆ setObject()

void DataSvcHelpers::RegistryEntry::setObject ( DataObject obj)

Set/Update object address.

Set object pointer of data store item.

Definition at line 129 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 unsigned long release()
release reference to object
Definition: DataObject.cpp:56
DataObject * m_pObject
Pointer to object.
Definition: RegistryEntry.h:72
bool isSoft() const
Is the link soft or hard.

◆ setParent()

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

Set new parent pointer.

Definition at line 83 of file RegistryEntry.cpp.

83  {
84  m_pParent = pParent;
85  m_fullpath.clear();
87 }
RegistryEntry * m_pParent
Pointer to parent.
Definition: RegistryEntry.h:68
std::string m_fullpath
String containing full path of the object (volatile)
Definition: RegistryEntry.h:64
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)

◆ size()

int DataSvcHelpers::RegistryEntry::size ( ) const
inline

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

Definition at line 141 of file RegistryEntry.h.

141 { return m_store.size(); }
T size(T... args)
Store m_store
Store of leaves.
Definition: RegistryEntry.h:76

◆ traverseTree()

StatusCode DataSvcHelpers::RegistryEntry::traverseTree ( IDataStoreAgent pAgent,
int  level = 0 
)

traverse data tree

Definition at line 281 of file RegistryEntry.cpp.

281  {
282  bool go_down = pAgent->analyse( this, level );
283  StatusCode status;
284  if ( go_down ) {
285  for ( auto& i : m_store ) {
286  try {
287  RegistryEntry* entry = CAST_REGENTRY( RegistryEntry*, i );
288  entry->traverseTree( pAgent, level + 1 ).ignore();
289  } catch ( ... ) { status = StatusCode::FAILURE; }
290  }
291  }
292  return status;
293 }
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:61
Store m_store
Store of leaves.
Definition: RegistryEntry.h:76
RegistryEntry(std::string path, RegistryEntry *parent=nullptr)
Standard Constructor.
constexpr static const auto FAILURE
Definition: StatusCode.h:97

Friends And Related Function Documentation

◆ ::DataSvc

friend class ::DataSvc
friend

Definition at line 52 of file RegistryEntry.h.

◆ ::TsDataSvc

friend class ::TsDataSvc
friend

Definition at line 54 of file RegistryEntry.h.

Member Data Documentation

◆ m_fullpath

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

String containing full path of the object (volatile)

Definition at line 64 of file RegistryEntry.h.

◆ m_isSoft

bool DataSvcHelpers::RegistryEntry::m_isSoft = false
private

Is the link soft or hard?

Definition at line 62 of file RegistryEntry.h.

◆ m_pAddress

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

Pointer to opaque address (load info)

Definition at line 70 of file RegistryEntry.h.

◆ m_path

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

Path name.

Definition at line 66 of file RegistryEntry.h.

◆ m_pDataProviderSvc

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

Pointer to hosting transient store.

Definition at line 74 of file RegistryEntry.h.

◆ m_pObject

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

Pointer to object.

Definition at line 72 of file RegistryEntry.h.

◆ m_pParent

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

Pointer to parent.

Definition at line 68 of file RegistryEntry.h.

◆ m_refCount

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

Reference counter.

Definition at line 60 of file RegistryEntry.h.

◆ m_store

Store DataSvcHelpers::RegistryEntry::m_store
private

Store of leaves.

Definition at line 76 of file RegistryEntry.h.


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