| The Gaudi Framework v32r1 (f65d50dc)

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. More...
void | operator() (TBuffer &b, void *obj) override
| 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

## ◆ IOHandler()

template<class T >

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

Initializing constructor.

Definition at line 61 of file RootIOHandler.cpp.

61 : m_root( c ) {}
gaudirun.c
c
Definition: gaudirun.py:487
GaudiRoot::IOHandler::m_root
TClass * m_root
ROOT persistent class description.
Definition: RootIOHandler.cpp:57

## Member Function Documentation

## ◆ get() [1/4]

template<class T >

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

Callback for reading the object.

## ◆ get() [2/4]

template<>

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

Definition at line 85 of file RootIOHandler.cpp.

85 {
86 RefAccessor r( obj );
87 UInt_t start, count;
88 Version_t version = b.ReadVersion( &start, &count, m_root );
89 m_root->ReadBuffer( b, obj, version, start, count );
90 switch ( r.Base->objectType() ) {
91 case SmartRefBase::DATAOBJECT:
92 ( *r.ObjectRef )( Gaudi::getCurrentDataObject() );
93 break;
94 case SmartRefBase::CONTAINEDOBJECT:
95 ( *r.ContainedRef )( Gaudi::getCurrentDataObject() );
96 break;
97 default:
98 cout << "Hit uninitialized smartRef!!!!" << endl;
99 break;
100 }
101 }
Gaudi::getCurrentDataObject
GAUDI_API DataObject * getCurrentDataObject()
std::endl
T endl(T... args)
GaudiRoot::IOHandler::m_root
TClass * m_root
ROOT persistent class description.
Definition: RootIOHandler.cpp:57
SmartRefBase::DATAOBJECT
Definition: SmartRefBase.h:60
IOTest.start
def start
Definition: IOTest.py:97
SmartRefBase::CONTAINEDOBJECT
Definition: SmartRefBase.h:60
std::count
T count(T... args)
std::cout

## ◆ get() [3/4]

template<>

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

Definition at line 161 of file RootIOHandler.cpp.

161 {
162 UInt_t start, count;
163 Version_t version = b.ReadVersion( &start, &count, m_root );
164 m_root->ReadBuffer( b, obj, version, start, count );
165 ContainedObject* p = (ContainedObject*)obj;
166 p->setParent( (ObjectContainerBase*)Gaudi::getCurrentDataObject() );
167 }
Gaudi::getCurrentDataObject
GAUDI_API DataObject * getCurrentDataObject()
GaudiRoot::IOHandler::m_root
TClass * m_root
ROOT persistent class description.
Definition: RootIOHandler.cpp:57
IOTest.start
def start
Definition: IOTest.py:97
std::count
T count(T... args)
ContainedObject
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
Definition: ContainedObject.h:31
ContainedObject::setParent
void setParent(ObjectContainerBase *value)
Update parent member.
Definition: ContainedObject.h:53
ObjectContainerBase
ObjectContainerBase is the base class for Gaudi container classes.
Definition: ObjectContainerBase.h:19

## ◆ get() [4/4]

template<>

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

Definition at line 175 of file RootIOHandler.cpp.

175 {
176 UInt_t start, count;
177 pool::Token* t = (pool::Token*)obj;
178 b.ReadVersion( &start, &count, m_root );
179 b.ReadFastArray( &t->m_oid.first, 2 );
180 b.CheckByteCount( start, count, m_root );
181 }
GaudiRoot::IOHandler::m_root
TClass * m_root
ROOT persistent class description.
Definition: RootIOHandler.cpp:57
IOTest.start
def start
Definition: IOTest.py:97
pool::Token::m_oid
std::pair< int, int > m_oid
Object global identifier.
Definition: PoolClasses.h:31
pool::Token
Shadow class to mimik POOL tokens.
Definition: PoolClasses.h:24
std::count
T count(T... args)

## ◆ operator()()

template<class T >

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

ROOT I/O callback.

Definition at line 63 of file RootIOHandler.cpp.

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

## ◆ put() [1/4]

template<class T >

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

Callback for writing the object.

## ◆ put() [2/4]

template<>

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

Definition at line 104 of file RootIOHandler.cpp.

104 {
105 RefAccessor r( obj );
106 ContainedObject* p;
107 DataObject * curr, *pDO;
108 int hint, link;
109
110 curr = Gaudi::getCurrentDataObject();
111 pDO = r.ObjectRef->data();
112 hint = r.ObjectRef->hintID();
113 link = r.ObjectRef->linkID();
114 if ( pDO ) {
115 switch ( r.Base->objectType() ) {
116 case SmartRefBase::CONTAINEDOBJECT:
117 p = r.ContainedRef->data();
118 if ( p ) {
119 const ObjectContainerBase* parent = p->parent();
120 if ( parent ) {
121 link = p->index();
122 pDO = const_cast<ObjectContainerBase*>( parent );
123 break;
124 }
125 }
126 pDO = nullptr;
127 cout << "IOHandler<SmartRefBase>::onWrite> "
128 << "Found invalid smart reference with object "
129 << "having no parent." << endl;
130 throw runtime_error( "IOHandler<SmartRefBase>::onWrite> "
131 "Found invalid smart reference with object "
132 "having no parent." );
133 break;
134 case SmartRefBase::DATAOBJECT:
135 link = StreamBuffer::INVALID;
136 break;
137 default:
138 break;
139 }
140 if ( pDO == last_link_object ) {
141 r.Base->set( curr, last_link_hint, link );
142 m_root->WriteBuffer( b, obj );
143 return;
144 } else if ( pDO ) {
145 LinkManager* mgr = curr->linkMgr();
146 IRegistry* reg = pDO->registry();
147 if ( reg && mgr ) {
148 hint = mgr->addLink( reg->identifier(), pDO );
149 last_link_hint = hint;
150 last_link_object = pDO;
151 }
152 } else {
153 hint = link = StreamBuffer::INVALID;
154 }
155 }
156 r.Base->set( curr, hint, link );
157 m_root->WriteBuffer( b, obj );
158 }
DataObject::registry
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
Gaudi::getCurrentDataObject
GAUDI_API DataObject * getCurrentDataObject()
DataObject::linkMgr
LinkManager * linkMgr() const
Retrieve Link manager.
Definition: DataObject.h:74
std::endl
T endl(T... args)
GaudiRoot::IOHandler::m_root
TClass * m_root
ROOT persistent class description.
Definition: RootIOHandler.cpp:57
SmartRefBase::DATAOBJECT
Definition: SmartRefBase.h:60
SmartRefBase::CONTAINEDOBJECT
Definition: SmartRefBase.h:60
std::runtime_error
STL class.
IRegistry
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
ContainedObject::index
virtual long index() const
Distance in the parent container.
Definition: ContainedObject.h:56
ContainedObject
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
Definition: ContainedObject.h:31
ContainedObject::parent
const ObjectContainerBase * parent() const
Access to parent object.
Definition: ContainedObject.h:51
IRegistry::identifier
virtual const id_type & identifier() const =0
Full identifier (or key)
ObjectContainerBase
ObjectContainerBase is the base class for Gaudi container classes.
Definition: ObjectContainerBase.h:19
StreamBuffer::INVALID
Definition: StreamBuffer.h:111
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
std::cout
LinkManager
A LinkManager is the object aggregated into a DataObject, which is responsible for the handling of no...
Definition: LinkManager.h:21
LinkManager::addLink
long addLink(const std::string &path, const DataObject *pObject) const
Add link by object reference and path.
Definition: LinkManager.cpp:54

## ◆ put() [3/4]

template<>

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

Definition at line 170 of file RootIOHandler.cpp.

170 {
171 m_root->WriteBuffer( b, obj );
172 }
GaudiRoot::IOHandler::m_root
TClass * m_root
ROOT persistent class description.
Definition: RootIOHandler.cpp:57

## ◆ put() [4/4]

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 }
std::runtime_error
STL class.

## Member Data Documentation

## ◆ m_root

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:

- RootCnv/src/RootIOHandler.cpp