| The Gaudi Framework v29r0 (ff2e7097)

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

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

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...
| ~IOHandler () override=default
| Standard destructor. 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 58 of file RootIOHandler.cpp.

## Constructor & Destructor Documentation

template<class T >

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

Initializing constructor.

Definition at line 66 of file RootIOHandler.cpp.

66 : m_root( c ) {}
gaudirun.c
c
Definition: gaudirun.py:407
GaudiRoot::IOHandler::m_root
TClass * m_root
ROOT persistent class description.
Definition: RootIOHandler.cpp:62
template<class T >

GaudiRoot::IOHandler< T >::~IOHandler | ( |  | ) |
| override default

Standard destructor.

## 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 93 of file RootIOHandler.cpp.

94 {
95 RefAccessor r( obj );
96 UInt_t start, count;
97 Version_t version = b.ReadVersion( &start, &count, m_root );
98 m_root->ReadBuffer( b, obj, version, start, count );
99 switch ( r.Base->objectType() ) {
100 case SmartRefBase::DATAOBJECT:
101 ( *r.ObjectRef )( Gaudi::getCurrentDataObject() );
102 break;
103 case SmartRefBase::CONTAINEDOBJECT:
104 ( *r.ContainedRef )( Gaudi::getCurrentDataObject() );
105 break;
106 default:
107 cout << "Hit uninitialized smartRef!!!!" << endl;
108 break;
109 }
110 }
Gaudi::getCurrentDataObject
GAUDI_API DataObject * getCurrentDataObject()
SmartRefBase::CONTAINEDOBJECT
Definition: SmartRefBase.h:61
std::endl
T endl(T...args)
GaudiRoot::IOHandler::m_root
TClass * m_root
ROOT persistent class description.
Definition: RootIOHandler.cpp:62
IOTest.start
start
Definition: IOTest.py:99
SmartRefBase::DATAOBJECT
Definition: SmartRefBase.h:61
std::count
T count(T...args)
std::cout
template<>

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

Definition at line 171 of file RootIOHandler.cpp.

172 {
173 UInt_t start, count;
174 Version_t version = b.ReadVersion( &start, &count, m_root );
175 m_root->ReadBuffer( b, obj, version, start, count );
176 ContainedObject* p = (ContainedObject*)obj;
177 p->setParent( (ObjectContainerBase*)Gaudi::getCurrentDataObject() );
178 }
Gaudi::getCurrentDataObject
GAUDI_API DataObject * getCurrentDataObject()
GaudiRoot::IOHandler::m_root
TClass * m_root
ROOT persistent class description.
Definition: RootIOHandler.cpp:62
IOTest.start
start
Definition: IOTest.py:99
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:54
ObjectContainerBase
ObjectContainerBase is the base class for Gaudi container classes.
Definition: ObjectContainerBase.h:19
template<>

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

Definition at line 187 of file RootIOHandler.cpp.

188 {
189 UInt_t start, count;
190 pool::Token* t = (pool::Token*)obj;
191 b.ReadVersion( &start, &count, m_root );
192 b.ReadFastArray( &t->m_oid.first, 2 );
193 b.CheckByteCount( start, count, m_root );
194 }
GaudiRoot::IOHandler::m_root
TClass * m_root
ROOT persistent class description.
Definition: RootIOHandler.cpp:62
pool::Token::m_oid
std::pair< int, int > m_oid
Object global identifier.
Definition: PoolClasses.h:34
pool::Token
Shadow class to mimik POOL tokens.
Definition: PoolClasses.h:26
IOTest.start
start
Definition: IOTest.py:99
std::count
T count(T...args)
template<class T >

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

ROOT I/O callback.

Definition at line 70 of file RootIOHandler.cpp.

71 {
72 try {
73 if ( b.IsReading() )
74 get( b, obj );
75 else
76 put( b, obj );
77 } catch ( const exception& e ) {
78 string err = "Class:" + string( m_root->GetName() ) + "> Exception in object I/O";
79 err += e.what();
80 throw runtime_error( err );
81 } catch ( ... ) {
82 string err = "Class:" + string( m_root->GetName() ) + "> Exception in object I/O";
83 throw runtime_error( err );
84 }
85 }
GaudiRoot::IOHandler::m_root
TClass * m_root
ROOT persistent class description.
Definition: RootIOHandler.cpp:62
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.
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 113 of file RootIOHandler.cpp.

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

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

Definition at line 181 of file RootIOHandler.cpp.

182 {
183 m_root->WriteBuffer( b, obj );
184 }
GaudiRoot::IOHandler::m_root
TClass * m_root
ROOT persistent class description.
Definition: RootIOHandler.cpp:62
template<>

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

Definition at line 197 of file RootIOHandler.cpp.

198 {
199 throw runtime_error( "Writing POOL files is not implemented!" );
200 }
std::runtime_error
STL class.

## Member Data Documentation

template<class T >

TClass* GaudiRoot::IOHandler< T >::m_root
| protected

ROOT persistent class description.

Definition at line 62 of file RootIOHandler.cpp.

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

- RootCnv/src/RootIOHandler.cpp