The Gaudi Framework  v29r0 (ff2e7097)
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 55 of file KeyedObject.cpp.

56 {
57  *to = nullptr;
58  if ( from ) {
59  DataObject* tar = nullptr;
60  if ( access( from->parent(), &tar ) ) {
61  ObjectContainerBase* cnt = dynamic_cast<ObjectContainerBase*>( tar );
62  if ( cnt ) {
63  *to = cnt->containedObject( from->index() );
64  }
65  }
66  }
67  return *to != nullptr;
68 }
virtual long index() const
Distance in the parent container.
bool access(const DataObject *from, DataObject **to)
Definition: KeyedObject.cpp:28
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:29
bool Objects::access ( const DataObject from,
DataObject **  to 
)

Definition at line 28 of file KeyedObject.cpp.

29 {
30  DataObject* src = const_cast<DataObject*>( from );
31  DataObject* tar = nullptr;
32  if ( src ) {
33  LinkManager* mgr = src->linkMgr();
34  if ( mgr ) {
35  LinkManager::Link* link = mgr->link( long( 0 ) );
36  if ( link ) {
37  tar = link->object();
38  if ( !tar ) {
39  IRegistry* reg = src->registry();
40  if ( reg ) {
41  IDataProviderSvc* ds = reg->dataSvc();
42  if ( ds && ds->retrieveObject( link->path(), tar ).isSuccess() ) {
43  link->setObject( tar );
44  }
45  }
46  }
47  }
48  }
49  }
50  *to = tar;
51  return tar != nullptr;
52 }
Data provider interface definition.
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
LinkManager * linkMgr() const
Retrieve Link manager.
Definition: DataObject.h:74
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:29
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 21 of file KeyedObject.cpp.

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