Objects Namespace Reference

Namespace for basic object handling within container classes. More...

Functions

bool access (const ContainedObject *from, ContainedObject **to)
 
bool access (const DataObject *from, DataObject **to)
 
template<class TO , class FROM >
TO * reference (FROM *from)
 

Detailed Description

Namespace for basic object handling within container classes.

Function Documentation

bool Objects::access ( const ContainedObject from,
ContainedObject **  to 
)

Definition at line 53 of file KeyedObject.cpp.

54 {
55  *to = nullptr;
56  if ( from ) {
57  DataObject *tar = nullptr;
58  if ( access(from->parent(), &tar) ) {
59  ObjectContainerBase* cnt = dynamic_cast<ObjectContainerBase*>(tar);
60  if ( cnt ) {
61  *to = cnt->containedObject(from->index());
62  }
63  }
64  }
65  return *to != nullptr;
66 }
virtual long index() const
Distance in the parent container.
bool access(const DataObject *from, DataObject **to)
Definition: KeyedObject.cpp:26
const ObjectContainerBase * parent() const
Access to parent object.
virtual ContainedObject * containedObject(long dist) const =0
Pointer to an object of a given distance.
ObjectContainerBase is the base class for Gaudi container classes.
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
bool Objects::access ( const DataObject from,
DataObject **  to 
)

Definition at line 26 of file KeyedObject.cpp.

27 {
28  DataObject* src = const_cast<DataObject*>(from);
29  DataObject* tar = nullptr;
30  if ( src ) {
31  LinkManager* mgr = src->linkMgr();
32  if ( mgr ) {
33  LinkManager::Link* link = mgr->link(long(0));
34  if ( link ) {
35  tar = link->object();
36  if ( !tar ) {
37  IRegistry* reg = src->registry();
38  if ( reg ) {
39  IDataProviderSvc* ds = reg->dataSvc();
40  if ( ds && ds->retrieveObject(link->path(), tar).isSuccess() ) {
41  link->setObject(tar);
42  }
43  }
44  }
45  }
46  }
47  }
48  *to = tar;
49  return tar != nullptr;
50 }
Data provider interface definition.
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
LinkManager * linkMgr() const
Retrieve Link manager.
Definition: DataObject.h:78
virtual IDataProviderSvc * dataSvc() const =0
Retrieve pointer to Transient Store.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
virtual StatusCode retrieveObject(IRegistry *pDirectory, const std::string &path, DataObject *&pObject)=0
Retrieve object identified by its directory entry.
template<class TO , class FROM >
TO* Objects::reference ( FROM *  from)

Definition at line 20 of file KeyedObject.cpp.

20  {
21  ContainedObject* to = nullptr;
22  return access(from, &to) ? dynamic_cast<TO*>(to) : nullptr;
23  }
bool access(const DataObject *from, DataObject **to)
Definition: KeyedObject.cpp:26
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.