| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Protected Attributes | List of all members
GaudiRoot::IOHandler< T > Class Template Reference
Inheritance diagram for GaudiRoot::IOHandler< T >:
[legend]
Collaboration diagram for GaudiRoot::IOHandler< T >:
[legend]

## Public Member Functions
| IOHandler (TClass *c)
| Initializing constructor.
virtual | ~IOHandler ()
| Standard destructor.
virtual void | operator() (TBuffer &b, void *obj)
| ROOT I/O callback.
virtual void | get (TBuffer &b, void *obj)
| Callback for reading the object.
virtual void | put (TBuffer &b, void *obj)
| Callback for writing the object.
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.

## 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.

: m_root(c) { }
template<class T >

virtual GaudiRoot::IOHandler< T >::~IOHandler | ( |  | ) |
| inline virtual

Standard destructor.

Definition at line 62 of file RootIOHandler.cpp.

{ }

## 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.

{
RefAccessor r(obj);
UInt_t start, count;
Version_t version = b.ReadVersion(&start, &count, m_root);
m_root->ReadBuffer(b, obj, version, start, count);
switch( r.Base->objectType() ) {
case SmartRefBase::DATAOBJECT:
(*r.ObjectRef)(Gaudi::getCurrentDataObject());
break;
case SmartRefBase::CONTAINEDOBJECT:
(*r.ContainedRef)(Gaudi::getCurrentDataObject());
break;
default:
cout << "Hit uninitialized smartRef!!!!" << endl;
break;
}
}
template<>

void GaudiRoot::IOHandler< ContainedObject >::get | ( | TBuffer & | b,
|  | void * | obj
| ) |  |

Definition at line 164 of file RootIOHandler.cpp.

{
UInt_t start, count;
Version_t version = b.ReadVersion(&start, &count, m_root);
m_root->ReadBuffer(b, obj, version, start, count);
ContainedObject* p = (ContainedObject*)obj;
p->setParent((ObjectContainerBase*)Gaudi::getCurrentDataObject());
}
template<>

void GaudiRoot::IOHandler< pool::Token >::get | ( | TBuffer & | b,
|  | void * | obj
| ) |  |

Definition at line 176 of file RootIOHandler.cpp.

{
UInt_t start, count;
pool::Token* t = (pool::Token*)obj;
b.ReadVersion(&start, &count, m_root);
b.ReadFastArray(&t->m_oid.first, 2);
b.CheckByteCount(start, count, m_root);
}
template<class T >

virtual void GaudiRoot::IOHandler< T >::operator() | ( | TBuffer & | b,
|  | void * | obj
| ) |  |
| inline virtual

ROOT I/O callback.

Definition at line 64 of file RootIOHandler.cpp.

{
try {
if ( b.IsReading() )
get(b,obj);
else
put(b,obj);
}
catch( const exception& e ) {
string err = "Class:" + string(m_root->GetName()) + "> Exception in object I/O";
err += e.what();
throw runtime_error(err);
}
catch( ... ) {
string err = "Class:" + string(m_root->GetName()) + "> Exception in object I/O";
throw runtime_error(err);
}
}
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.

{
RefAccessor r(obj);
ContainedObject* p;
DataObject* curr, *pDO;
int hint, link;
curr = Gaudi::getCurrentDataObject();
pDO = r.ObjectRef->data();
hint = r.ObjectRef->hintID();
link = r.ObjectRef->linkID();
if ( pDO ) {
switch( r.Base->objectType() ) {
case SmartRefBase::CONTAINEDOBJECT:
p = r.ContainedRef->data();
if ( p ) {
const ObjectContainerBase* parent = p->parent();
if ( parent ) {
link = p->index();
pDO = const_cast<ObjectContainerBase*>(parent);
break;
}
}
pDO = 0;
cout << "IOHandler<SmartRefBase>::onWrite> "
<< "Found invalid smart reference with object "
<< "having no parent."
<< endl;
throw runtime_error("IOHandler<SmartRefBase>::onWrite> "
"Found invalid smart reference with object "
"having no parent.");
break;
case SmartRefBase::DATAOBJECT:
link = StreamBuffer::INVALID;
break;
default:
break;
}
if ( pDO == last_link_object ) {
r.Base->set(curr, last_link_hint, link);
m_root->WriteBuffer(b, obj);
return;
}
else if ( pDO ) {
LinkManager* mgr = curr->linkMgr();
IRegistry* reg = pDO->registry();
if ( reg && mgr ) {
hint = mgr->addLink(reg->identifier(), pDO);
last_link_hint = hint;
last_link_object = pDO;
}
}
else {
hint = link = StreamBuffer::INVALID;
}
}
r.Base->set(curr, hint, link);
m_root->WriteBuffer(b, obj);
}
template<>

void GaudiRoot::IOHandler< ContainedObject >::put | ( | TBuffer & | b,
|  | void * | obj
| ) |  |

Definition at line 172 of file RootIOHandler.cpp.

{
m_root->WriteBuffer(b, obj);
}
template<>

void GaudiRoot::IOHandler< pool::Token >::put | ( | TBuffer & | ,
|  | void * |
| ) |  |

Definition at line 184 of file RootIOHandler.cpp.

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

## 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:

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/RootCnv/src/RootIOHandler.cpp