|
Gaudi Framework, version v23r2p1 |
| Home | Generated: Fri Jun 29 2012 |
Definition of an entry in the transient data store. More...
#include <GaudiKernel/RegistryEntry.h>


Public Types | |
| typedef Store::const_iterator | Iterator |
| Iterator definition. | |
Public Member Functions | |
| RegistryEntry (const std::string &path, RegistryEntry *parent=0) | |
| Standard Constructor. | |
| virtual | ~RegistryEntry () |
| Standard Destructor. | |
| virtual unsigned long | release () |
| IInterface implementation: Reference the object. | |
| virtual unsigned long | addRef () |
| IInterface implementation: Dereference the object. | |
| const std::string & | name () const |
| Retrieve name of the entry. | |
| virtual const std::string & | identifier () const |
| Full identifier (or key) | |
| virtual IDataProviderSvc * | dataSvc () const |
| Retrieve pointer to Transient Store. | |
| virtual DataObject * | object () const |
| Retrive object behind the link. | |
| virtual IOpaqueAddress * | address () const |
| Retrieve opaque storage address. | |
| virtual IRegistry * | parent () const |
| Pointer to parent directory entry. | |
| virtual bool | isSoft () const |
| Is the link soft or hard. | |
| const Store & | leaves () const |
| Access the leaves of the object. | |
| virtual int | size () const |
| Return the size of the container(=number of objects) | |
| virtual bool | isEmpty () const |
| Simple check if the Container is empty. | |
| virtual Iterator | begin () const |
| Return starting point for container iteration. | |
| virtual Iterator | end () const |
| Return end elemtn if the container. | |
| virtual IRegistry * | find (const IRegistry *obj) const |
| Try to find an object identified by its pointer. | |
| virtual IRegistry * | find (const std::string &path) const |
| Try to find an object identified by its relative name to the directory. | |
| void | setAddress (IOpaqueAddress *pAddress) |
| Set/Update Opaque address. | |
| void | setObject (DataObject *obj) |
| Set/Update object address. | |
| virtual long | add (const std::string &name, DataObject *pObject, bool is_soft=false) |
| Add entry to data store. | |
| virtual long | add (const std::string &name, IOpaqueAddress *pAddress, bool is_soft=false) |
| Add entry to data store. | |
| virtual long | remove (const std::string &name) |
| Remove an entry from the store. | |
| virtual long | add (IRegistry *obj) |
| Add object to the container. | |
| virtual long | remove (IRegistry *obj) |
| Remove an object from the container. | |
| virtual long | deleteElements () |
| Delete all contained elements. | |
| virtual long | traverseTree (IDataStoreAgent *pAgent, int level=0) |
| traverse data tree | |
Private Types | |
| typedef std::vector< IRegistry * > | Store |
| Definition of datastore type. | |
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. | |
| IRegistry * | i_find (const IRegistry *pDirectory) const |
| Internal method to retrieve data directory. | |
| RegistryEntry * | i_find (const std::string &path) const |
| Internal method to retrieve data directory. | |
| RegistryEntry * | i_find (const DataObject *pObject) const |
| Internal method to locate object entry. | |
| RegistryEntry * | i_add (const std::string &name) |
| Internal method to add entries. | |
| void | setParent (RegistryEntry *pParent) |
| Set new parent pointer. | |
| void | setDataSvc (IDataProviderSvc *s) |
| Set the transient data store. | |
| virtual RegistryEntry * | parentEntry () |
| Pointer to parent registry entry. | |
| RegistryEntry * | findLeaf (const std::string &path) const |
| Find identified leaf in this registry node. | |
| RegistryEntry * | findLeaf (const DataObject *key) const |
| Find identified leaf in this registry node. | |
| void | makeHard (DataObject *pObject) |
| Initialize link as hard link. | |
| void | makeHard (IOpaqueAddress *pAddress) |
| Initialize link as hard link. | |
| void | makeSoft (DataObject *pObject) |
| Initialize link as soft link. | |
| void | makeSoft (IOpaqueAddress *pAddress) |
| Initialize link as soft link. | |
Private Attributes | |
| unsigned long | m_refCount |
| Reference counter. | |
| bool | m_isSoft |
| Is the link soft or hard? | |
| std::string | m_fullpath |
| String containing full path of the object (volatile) | |
| std::string | m_path |
| Path name. | |
| RegistryEntry * | m_pParent |
| Pointer to parent. | |
| IOpaqueAddress * | m_pAddress |
| Pointer to opaque address (load info) | |
| DataObject * | m_pObject |
| Pointer to object. | |
| IDataProviderSvc * | m_pDataProviderSvc |
| Pointer to hosting transient store. | |
| Store | m_store |
| Store of leaves. | |
Friends | |
| class | ::DataSvc |
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.
Definition at line 34 of file RegistryEntry.h.
Iterator definition.
Definition at line 41 of file RegistryEntry.h.
typedef std::vector<IRegistry*> DataSvcHelpers::RegistryEntry::Store [private] |
Definition of datastore type.
Definition at line 37 of file RegistryEntry.h.
| DataSvcHelpers::RegistryEntry::RegistryEntry | ( | const std::string & | path, |
| RegistryEntry * | parent = 0 |
||
| ) |
Standard Constructor.
Definition at line 45 of file RegistryEntry.cpp.
: m_refCount(0), m_isSoft(false), m_path(path), m_pParent(parent), m_pAddress(0), m_pObject(0), m_pDataProviderSvc(0) { std::string::size_type sep = m_path.rfind(SEPARATOR); if ( path[0] != SEPARATOR ) { m_path.insert(m_path.begin(), SEPARATOR); } if ( sep != std::string::npos ) { m_path.erase(0,sep); } assemblePath(m_fullpath); addRef(); }
| DataSvcHelpers::RegistryEntry::~RegistryEntry | ( | ) | [virtual] |
Standard Destructor.
Standard destructor.
Definition at line 66 of file RegistryEntry.cpp.
{
deleteElements();
if ( 0 != m_pObject ) {
if ( !m_isSoft ) m_pObject->setRegistry(0);
m_pObject->release();
}
if ( 0 != m_pAddress ) {
if ( !m_isSoft ) m_pAddress->setRegistry(0);
m_pAddress->release();
}
}
| 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 211 of file RegistryEntry.cpp.
{
RegistryEntry* entry = i_add(name);
if ( 0 != entry ) {
( is_soft ) ? entry->makeSoft(pObject) : entry->makeHard(pObject);
add( entry );
return StatusCode::SUCCESS;
}
return StatusCode::FAILURE;
}
| 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 222 of file RegistryEntry.cpp.
{
RegistryEntry* entry = i_add(name);
if ( 0 != entry ) {
( is_soft ) ? entry->makeSoft(pAddress) : entry->makeHard(pAddress);
add( entry );
return StatusCode::SUCCESS;
}
return StatusCode::FAILURE;
}
| long DataSvcHelpers::RegistryEntry::add | ( | IRegistry * | obj ) | [virtual] |
Add object to the container.
Definition at line 195 of file RegistryEntry.cpp.
{
try {
RegistryEntry* pEntry = CAST_REGENTRY(RegistryEntry*, obj);
pEntry->setDataSvc(m_pDataProviderSvc);
m_store.push_back(pEntry);
pEntry->setParent(this);
if ( !pEntry->isSoft() && pEntry->address() != 0 ) {
pEntry->address()->setRegistry(pEntry);
}
}
catch ( ... ) {
}
return m_store.size();
}
| virtual unsigned long DataSvcHelpers::RegistryEntry::addRef | ( | ) | [inline, virtual] |
IInterface implementation: Dereference the object.
Implements IRegistry.
Definition at line 112 of file RegistryEntry.h.
{
return ++m_refCount;
}
| virtual IOpaqueAddress* DataSvcHelpers::RegistryEntry::address | ( | ) | const [inline, virtual] |
Retrieve opaque storage address.
Implements IRegistry.
Definition at line 132 of file RegistryEntry.h.
{
return m_pAddress;
}
| 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 339 of file RegistryEntry.cpp.
| virtual Iterator DataSvcHelpers::RegistryEntry::begin | ( | void | ) | const [inline, virtual] |
Return starting point for container iteration.
Definition at line 156 of file RegistryEntry.h.
| virtual IDataProviderSvc* DataSvcHelpers::RegistryEntry::dataSvc | ( | ) | const [inline, virtual] |
Retrieve pointer to Transient Store.
Implements IRegistry.
Definition at line 124 of file RegistryEntry.h.
{
return m_pDataProviderSvc;
}
| long DataSvcHelpers::RegistryEntry::deleteElements | ( | ) | [virtual] |
Delete all contained elements.
Delete recursively all elements pending from the current store item.
Definition at line 233 of file RegistryEntry.cpp.
{
for (Store::iterator i = m_store.begin(); i != m_store.end(); i++ ) {
RegistryEntry* entry = CAST_REGENTRY(RegistryEntry*, *i);
if ( 0 != entry ) {
entry->deleteElements();
entry->release();
}
}
m_store.erase(m_store.begin(), m_store.end());
return 0;
}
| virtual Iterator DataSvcHelpers::RegistryEntry::end | ( | void | ) | const [inline, virtual] |
Return end elemtn if the container.
Definition at line 160 of file RegistryEntry.h.
| virtual IRegistry* DataSvcHelpers::RegistryEntry::find | ( | const IRegistry * | obj ) | const [inline, virtual] |
Try to find an object identified by its pointer.
Definition at line 164 of file RegistryEntry.h.
{
return i_find(obj);
}
| virtual IRegistry* DataSvcHelpers::RegistryEntry::find | ( | const std::string & | path ) | const [inline, virtual] |
Try to find an object identified by its relative name to the directory.
Definition at line 168 of file RegistryEntry.h.
| RegistryEntry* DataSvcHelpers::RegistryEntry::findLeaf | ( | const std::string & | path ) | const [inline, private] |
Find identified leaf in this registry node.
Definition at line 89 of file RegistryEntry.h.
| RegistryEntry* DataSvcHelpers::RegistryEntry::findLeaf | ( | const DataObject * | key ) | const [inline, private] |
Find identified leaf in this registry node.
Definition at line 93 of file RegistryEntry.h.
{
return i_find(key);
}
| DataSvcHelpers::RegistryEntry * DataSvcHelpers::RegistryEntry::i_add | ( | const std::string & | name ) | [private] |
Internal method to add entries.
Definition at line 179 of file RegistryEntry.cpp.
{
if ( nam[0] != SEPARATOR ) {
std::string path = nam;
path.insert(path.begin(), SEPARATOR);
return i_add(path);
}
// if this object is already present, this is an error....
for (Store::iterator i = m_store.begin(); i != m_store.end(); i++ ) {
if ( nam == (*i)->name() ) {
return 0;
}
}
return new RegistryEntry( nam, this );
}
| 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 299 of file RegistryEntry.cpp.
{
if ( 0 != key ) {
if ( key == m_pObject ) {
return const_cast<RegistryEntry*>(this);
}
// Look in the immediate level:
RegistryEntry *result = CAST_REGENTRY(RegistryEntry*, i_find(key->registry()));
if ( 0 != result ) return result;
// Go levels down
for (Store::const_iterator i = m_store.begin(); i != m_store.end(); i++ ) {
try {
const RegistryEntry *entry = CAST_REGENTRY(RegistryEntry*, *i);
if( 0 != (result = entry->i_find(key)) )
return result;
}
catch ( ... ) { }
}
}
return 0;
}
| DataSvcHelpers::RegistryEntry * DataSvcHelpers::RegistryEntry::i_find | ( | const std::string & | path ) | const [private] |
Internal method to retrieve data directory.
Find identified leaf in this registry node.
Definition at line 252 of file RegistryEntry.cpp.
{
if ( path[0] != SEPARATOR ) {
std::string thePath = path;
thePath.insert(thePath.begin(), SEPARATOR);
return i_find(thePath);
}
else {
std::string::size_type len = path.length();
std::string::size_type loc1 = path.find(SEPARATOR,1);
std::string::size_type len2 = loc1 != std::string::npos ? loc1 : len;
for (Store::const_iterator i = m_store.begin(); i != m_store.end(); i++ ) {
RegistryEntry* regEnt = CAST_REGENTRY(RegistryEntry*, *i);
const std::string& nam = regEnt->name();
// check that the first len2 chars of path are the same as nam
// (i.e. match {len2:3 nam:"/Ab" path:"/Ab/C"}
// but not {len2:3 nam:"/Abc" path:"/Ab/C"})
if ( path.compare(0, len2, nam) == 0 ) {
try {
if ( loc1 != std::string::npos ) {
std::string search_path(path, loc1, len);
IRegistry* pDir = regEnt->find(search_path);
if ( 0 != pDir ) {
return CAST_REGENTRY(RegistryEntry*, pDir);
}
return 0;
}
else {
return CAST_REGENTRY(RegistryEntry*, *i);
}
}
catch (...) {
}
}
}
// If this node is "/NodeA", this part allows to find "/NodeA/NodeB" as
// our "/NodeB" child.
if ( path.compare(0, len2, m_path) == 0 ) {
if (len2 < len) {
std::string search_path(path, loc1, len);
return i_find(search_path);
}
}
}
return 0;
}
| virtual const std::string& DataSvcHelpers::RegistryEntry::identifier | ( | ) | const [inline, virtual] |
Full identifier (or key)
Implements IRegistry.
Definition at line 120 of file RegistryEntry.h.
{
return m_fullpath;
}
| virtual bool DataSvcHelpers::RegistryEntry::isEmpty | ( | ) | const [inline, virtual] |
Simple check if the Container is empty.
Definition at line 152 of file RegistryEntry.h.
| virtual bool DataSvcHelpers::RegistryEntry::isSoft | ( | ) | const [inline, virtual] |
| const Store& DataSvcHelpers::RegistryEntry::leaves | ( | ) | const [inline] |
Access the leaves of the object.
Definition at line 144 of file RegistryEntry.h.
{
return m_store;
}
| void DataSvcHelpers::RegistryEntry::makeHard | ( | DataObject * | pObject ) | [private] |
Initialize link as hard link.
Create hard link.
Definition at line 110 of file RegistryEntry.cpp.
{
makeSoft(pObject);
m_isSoft = false;
if ( 0 != m_pObject ) {
m_pObject->setRegistry(this);
}
if ( 0 != m_pAddress ) {
m_pAddress->setRegistry(this);
}
}
| void DataSvcHelpers::RegistryEntry::makeHard | ( | IOpaqueAddress * | pAddress ) | [private] |
Initialize link as hard link.
Create hard link.
Definition at line 122 of file RegistryEntry.cpp.
{
m_isSoft = false;
setAddress(pAddress);
}
| void DataSvcHelpers::RegistryEntry::makeSoft | ( | DataObject * | pObject ) | [private] |
| void DataSvcHelpers::RegistryEntry::makeSoft | ( | IOpaqueAddress * | pAddress ) | [private] |
Initialize link as soft link.
Create soft link.
Definition at line 104 of file RegistryEntry.cpp.
{
m_isSoft = true;
setAddress(pAddress);
}
| const std::string& DataSvcHelpers::RegistryEntry::name | ( | ) | const [inline, virtual] |
Retrieve name of the entry.
Implements IRegistry.
Definition at line 116 of file RegistryEntry.h.
{
return m_path;
}
| virtual DataObject* DataSvcHelpers::RegistryEntry::object | ( | ) | const [inline, virtual] |
Retrive object behind the link.
Implements IRegistry.
Definition at line 128 of file RegistryEntry.h.
{
return m_pObject;
}
| virtual IRegistry* DataSvcHelpers::RegistryEntry::parent | ( | ) | const [inline, virtual] |
Pointer to parent directory entry.
Definition at line 136 of file RegistryEntry.h.
{
return m_pParent;
}
| virtual RegistryEntry* DataSvcHelpers::RegistryEntry::parentEntry | ( | ) | [inline, private, virtual] |
Pointer to parent registry entry.
Definition at line 85 of file RegistryEntry.h.
{
return m_pParent;
}
| unsigned long DataSvcHelpers::RegistryEntry::release | ( | ) | [virtual] |
IInterface implementation: Reference the object.
Release entry.
Implements IRegistry.
Definition at line 79 of file RegistryEntry.cpp.
{
unsigned long cnt = --m_refCount;
if ( 0 == m_refCount ) {
delete this;
}
return cnt;
}
| long DataSvcHelpers::RegistryEntry::remove | ( | const std::string & | name ) | [virtual] |
Remove an entry from the store.
Remove entry from data store.
Definition at line 162 of file RegistryEntry.cpp.
{
if ( nam[0] != SEPARATOR ) {
std::string path = nam;
path.insert(path.begin(), SEPARATOR);
return remove(path);
}
// if this object is already present, this is an error....
for (Store::iterator i = m_store.begin(); i != m_store.end(); i++ ) {
if ( nam == (*i)->name() ) {
remove(*i);
return StatusCode::SUCCESS;
}
}
return StatusCode::FAILURE;
}
| long DataSvcHelpers::RegistryEntry::remove | ( | IRegistry * | obj ) | [virtual] |
Remove an object from the container.
Definition at line 148 of file RegistryEntry.cpp.
{
try {
RegistryEntry* pEntry = dynamic_cast<RegistryEntry*>(obj);
Store::iterator i = std::remove(m_store.begin(), m_store.end(), pEntry);
if (i != m_store.end()) {
pEntry->release();
m_store.erase( i, m_store.end() );
}
}
catch ( ... ) { }
return m_store.size();
}
| void DataSvcHelpers::RegistryEntry::setAddress | ( | IOpaqueAddress * | pAddress ) | [virtual] |
Set/Update Opaque address.
Update Opaque address of registry entry.
Implements IRegistry.
Definition at line 128 of file RegistryEntry.cpp.
{
if ( 0 != pAddress ) {
pAddress->addRef();
pAddress->setRegistry(this);
}
if ( 0 != m_pAddress ) m_pAddress->release();
m_pAddress = pAddress;
}
| void DataSvcHelpers::RegistryEntry::setDataSvc | ( | IDataProviderSvc * | s ) | [inline, private] |
Set the transient data store.
Definition at line 81 of file RegistryEntry.h.
{
m_pDataProviderSvc = s;
}
| void DataSvcHelpers::RegistryEntry::setObject | ( | DataObject * | obj ) |
| void DataSvcHelpers::RegistryEntry::setParent | ( | RegistryEntry * | pParent ) | [private] |
Set new parent pointer.
Definition at line 88 of file RegistryEntry.cpp.
{
m_pParent = pParent;
m_fullpath = "";
assemblePath(m_fullpath);
}
| virtual int DataSvcHelpers::RegistryEntry::size | ( | void | ) | const [inline, virtual] |
Return the size of the container(=number of objects)
Definition at line 148 of file RegistryEntry.h.
| long DataSvcHelpers::RegistryEntry::traverseTree | ( | IDataStoreAgent * | pAgent, |
| int | level = 0 |
||
| ) | [virtual] |
traverse data tree
Definition at line 321 of file RegistryEntry.cpp.
{
bool go_down = pAgent->analyse(this, level);
long status = StatusCode::SUCCESS;
if ( go_down ) {
for ( Store::iterator i = m_store.begin(); i != m_store.end(); i++ ) {
try {
RegistryEntry* entry = CAST_REGENTRY(RegistryEntry*, *i);
entry->traverseTree(pAgent, level+1);
}
catch (...) {
status = StatusCode::FAILURE;
}
}
}
return status;
}
friend class ::DataSvc [friend] |
Definition at line 39 of file RegistryEntry.h.
String containing full path of the object (volatile)
Definition at line 48 of file RegistryEntry.h.
bool DataSvcHelpers::RegistryEntry::m_isSoft [private] |
Is the link soft or hard?
Definition at line 46 of file RegistryEntry.h.
Pointer to opaque address (load info)
Definition at line 54 of file RegistryEntry.h.
Path name.
Definition at line 50 of file RegistryEntry.h.
Pointer to hosting transient store.
Definition at line 58 of file RegistryEntry.h.
Pointer to object.
Definition at line 56 of file RegistryEntry.h.
Pointer to parent.
Definition at line 52 of file RegistryEntry.h.
unsigned long DataSvcHelpers::RegistryEntry::m_refCount [private] |
Reference counter.
Definition at line 44 of file RegistryEntry.h.
Store DataSvcHelpers::RegistryEntry::m_store [private] |
Store of leaves.
Definition at line 60 of file RegistryEntry.h.