All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GaudiRoot::IOHandler< T > Class Template Reference
Inheritance diagram for GaudiRoot::IOHandler< T >:
Collaboration diagram for GaudiRoot::IOHandler< T >:

Public Member Functions

 IOHandler (TClass *c)
 Initializing constructor. More...
 
virtual ~IOHandler ()
 Standard destructor. More...
 
virtual void operator() (TBuffer &b, void *obj)
 ROOT I/O callback. More...
 
virtual void get (TBuffer &b, void *obj)
 Callback for reading the object. More...
 
virtual void put (TBuffer &b, void *obj)
 Callback for writing the object. More...
 
template<>
void get (TBuffer &b, void *obj)
 
template<>
void put (TBuffer &b, void *obj)
 
template<>
void get (TBuffer &b, void *obj)
 
template<>
void put (TBuffer &b, void *obj)
 
template<>
void get (TBuffer &b, void *obj)
 
template<>
void put (TBuffer &, void *)
 

Protected Attributes

TClass * m_root
 ROOT persistent class description. More...
 

Detailed Description

template<class T>
class GaudiRoot::IOHandler< T >

Definition at line 54 of file RootIOHandler.cpp.

Constructor & Destructor Documentation

template<class T >
GaudiRoot::IOHandler< T >::IOHandler ( TClass *  c)
inline

Initializing constructor.

Definition at line 60 of file RootIOHandler.cpp.

60 : m_root(c) { }
tuple c
Definition: gaudirun.py:341
TClass * m_root
ROOT persistent class description.
template<class T >
virtual GaudiRoot::IOHandler< T >::~IOHandler ( )
inlinevirtual

Standard destructor.

Definition at line 62 of file RootIOHandler.cpp.

62 { }

Member Function Documentation

template<class T >
virtual void GaudiRoot::IOHandler< T >::get ( TBuffer &  b,
void *  obj 
)
virtual

Callback for reading the object.

template<>
void GaudiRoot::IOHandler< SmartRefBase >::get ( TBuffer &  b,
void *  obj 
)

Definition at line 87 of file RootIOHandler.cpp.

87  {
88  RefAccessor r(obj);
89  UInt_t start, count;
90  Version_t version = b.ReadVersion(&start, &count, m_root);
91  m_root->ReadBuffer(b, obj, version, start, count);
92  switch( r.Base->objectType() ) {
94  (*r.ObjectRef)(Gaudi::getCurrentDataObject());
95  break;
97  (*r.ContainedRef)(Gaudi::getCurrentDataObject());
98  break;
99  default:
100  cout << "Hit uninitialized smartRef!!!!" << endl;
101  break;
102  }
103  }
GAUDI_API DataObject * getCurrentDataObject()
TClass * m_root
ROOT persistent class description.
tuple start
Definition: IOTest.py:88
template<>
void GaudiRoot::IOHandler< ContainedObject >::get ( TBuffer &  b,
void *  obj 
)

Definition at line 164 of file RootIOHandler.cpp.

164  {
165  UInt_t start, count;
166  Version_t version = b.ReadVersion(&start, &count, m_root);
167  m_root->ReadBuffer(b, obj, version, start, count);
168  ContainedObject* p = (ContainedObject*)obj;
170  }
GAUDI_API DataObject * getCurrentDataObject()
TClass * m_root
ROOT persistent class description.
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
void setParent(ObjectContainerBase *value)
Update parent member.
ObjectContainerBase is the base class for Gaudi container classes.
tuple start
Definition: IOTest.py:88
template<>
void GaudiRoot::IOHandler< pool::Token >::get ( TBuffer &  b,
void *  obj 
)

Definition at line 176 of file RootIOHandler.cpp.

176  {
177  UInt_t start, count;
178  pool::Token* t = (pool::Token*)obj;
179  b.ReadVersion(&start, &count, m_root);
180  b.ReadFastArray(&t->m_oid.first, 2);
181  b.CheckByteCount(start, count, m_root);
182  }
TClass * m_root
ROOT persistent class description.
std::pair< int, int > m_oid
POOL OID data member.
Definition: PoolClasses.h:17
Shadow class to mimik POOL tokens.
Definition: PoolClasses.h:14
tuple start
Definition: IOTest.py:88
template<class T >
virtual void GaudiRoot::IOHandler< T >::operator() ( TBuffer &  b,
void *  obj 
)
inlinevirtual

ROOT I/O callback.

Definition at line 64 of file RootIOHandler.cpp.

64  {
65  try {
66  if ( b.IsReading() )
67  get(b,obj);
68  else
69  put(b,obj);
70  }
71  catch( const exception& e ) {
72  string err = "Class:" + string(m_root->GetName()) + "> Exception in object I/O";
73  err += e.what();
74  throw runtime_error(err);
75  }
76  catch( ... ) {
77  string err = "Class:" + string(m_root->GetName()) + "> Exception in object I/O";
78  throw runtime_error(err);
79  }
80  }
TClass * m_root
ROOT persistent class description.
virtual void put(TBuffer &b, void *obj)
Callback for writing the object.
template<class T >
virtual void GaudiRoot::IOHandler< T >::put ( TBuffer &  b,
void *  obj 
)
virtual

Callback for writing the object.

template<>
void GaudiRoot::IOHandler< SmartRefBase >::put ( TBuffer &  b,
void *  obj 
)

Definition at line 105 of file RootIOHandler.cpp.

105  {
106  RefAccessor r(obj);
107  ContainedObject* p;
108  DataObject* curr, *pDO;
109  int hint, link;
110 
112  pDO = r.ObjectRef->data();
113  hint = r.ObjectRef->hintID();
114  link = r.ObjectRef->linkID();
115  if ( pDO ) {
116  switch( r.Base->objectType() ) {
118  p = r.ContainedRef->data();
119  if ( p ) {
120  const ObjectContainerBase* parent = p->parent();
121  if ( parent ) {
122  link = p->index();
123  pDO = const_cast<ObjectContainerBase*>(parent);
124  break;
125  }
126  }
127  pDO = 0;
128  cout << "IOHandler<SmartRefBase>::onWrite> "
129  << "Found invalid smart reference with object "
130  << "having no parent."
131  << endl;
132  throw runtime_error("IOHandler<SmartRefBase>::onWrite> "
133  "Found invalid smart reference with object "
134  "having no parent.");
135  break;
137  link = StreamBuffer::INVALID;
138  break;
139  default:
140  break;
141  }
142  if ( pDO == last_link_object ) {
143  r.Base->set(curr, last_link_hint, link);
144  m_root->WriteBuffer(b, obj);
145  return;
146  }
147  else if ( pDO ) {
148  LinkManager* mgr = curr->linkMgr();
149  IRegistry* reg = pDO->registry();
150  if ( reg && mgr ) {
151  hint = mgr->addLink(reg->identifier(), pDO);
152  last_link_hint = hint;
153  last_link_object = pDO;
154  }
155  }
156  else {
157  hint = link = StreamBuffer::INVALID;
158  }
159  }
160  r.Base->set(curr, hint, link);
161  m_root->WriteBuffer(b, obj);
162  }
GAUDI_API DataObject * getCurrentDataObject()
virtual long index() const
Distance in the parent container.
TClass * m_root
ROOT persistent class description.
const ObjectContainerBase * parent() const
Access to parent object.
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
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
virtual const id_type & identifier() const =0
Full identifier (or key)
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
template<>
void GaudiRoot::IOHandler< ContainedObject >::put ( TBuffer &  b,
void *  obj 
)

Definition at line 172 of file RootIOHandler.cpp.

172  {
173  m_root->WriteBuffer(b, obj);
174  }
TClass * m_root
ROOT persistent class description.
template<>
void GaudiRoot::IOHandler< pool::Token >::put ( TBuffer &  ,
void *   
)

Definition at line 184 of file RootIOHandler.cpp.

184  {
185  throw runtime_error("Writing POOL files is not implemented!");
186  }

Member Data Documentation

template<class T >
TClass* GaudiRoot::IOHandler< T >::m_root
protected

ROOT persistent class description.

Definition at line 57 of file RootIOHandler.cpp.


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