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 66 of file KeyedObject.cpp.

67 {
68  *to = 0;
69  if ( from )
70  {
71  DataObject *tar = 0;
72  if ( access(from->parent(), &tar) )
73  {
74  ObjectContainerBase* cnt = dynamic_cast<ObjectContainerBase*>(tar);
75  if ( cnt )
76  {
77  *to = cnt->containedObject(from->index());
78  }
79  }
80  }
81  return (*to) != 0;
82 }
virtual long index() const
Distance in the parent container.
virtual ContainedObject * containedObject(long dist) const =0
Pointer to an object of a given distance.
bool access(const DataObject *from, DataObject **to)
Definition: KeyedObject.cpp:30
const ObjectContainerBase * parent() const
Access to parent object.
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:31
bool Objects::access ( const DataObject from,
DataObject **  to 
)

Definition at line 30 of file KeyedObject.cpp.

31 {
32  DataObject* src = const_cast<DataObject*>(from);
33  DataObject* tar = 0;
34  if ( src != 0 )
35  {
36  LinkManager* mgr = src->linkMgr();
37  if ( 0 != mgr )
38  {
39  LinkManager::Link* link = mgr->link(long(0));
40  if ( 0 != link )
41  {
42  tar = link->object();
43  if ( 0 == tar )
44  {
45  IRegistry* reg = src->registry();
46  if ( 0 != reg )
47  {
48  IDataProviderSvc* ds = reg->dataSvc();
49  if ( 0 != ds )
50  {
51  if ( ds->retrieveObject(link->path(), tar).isSuccess() )
52  {
53  link->setObject(tar);
54  }
55  }
56  }
57  }
58  }
59  }
60  }
61  *to = tar;
62  return tar != 0;
63 }
Data provider interface definition.
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:69
LinkManager * linkMgr() const
Retrieve Link manager.
Definition: DataObject.h:73
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
virtual IDataProviderSvc * dataSvc() const =0
Retrieve pointer to Transient Store.
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:31
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.

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