| The Gaudi Framework v27r1

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

## Constructor & Destructor Documentation

template<class T >

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

Initializing constructor.

Definition at line 59 of file RootIOHandler.cpp.

59 : m_root(c) { }
gaudirun.c
tuple c
Definition: gaudirun.py:391
GaudiRoot::IOHandler::m_root
TClass * m_root
ROOT persistent class description.
Definition: RootIOHandler.cpp:56
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 86 of file RootIOHandler.cpp.

86 {
87 RefAccessor r(obj);
88 UInt_t start, count;
89 Version_t version = b.ReadVersion(&start, &count, m_root);
90 m_root->ReadBuffer(b, obj, version, start, count);
91 switch( r.Base->objectType() ) {
92 case SmartRefBase::DATAOBJECT:
93 (*r.ObjectRef)(Gaudi::getCurrentDataObject());
94 break;
95 case SmartRefBase::CONTAINEDOBJECT:
96 (*r.ContainedRef)(Gaudi::getCurrentDataObject());
97 break;
98 default:
99 cout << "Hit uninitialized smartRef!!!!" << endl;
100 break;
101 }
102 }
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:56
SmartRefBase::CONTAINEDOBJECT
Definition: SmartRefBase.h:60
std::count
T count(T...args)
SmartRefBase::DATAOBJECT
Definition: SmartRefBase.h:60
std::cout
IOTest.start
tuple start
Definition: IOTest.py:88
template<>

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

Definition at line 163 of file RootIOHandler.cpp.

163 {
164 UInt_t start, count;
165 Version_t version = b.ReadVersion(&start, &count, m_root);
166 m_root->ReadBuffer(b, obj, version, start, count);
167 ContainedObject* p = (ContainedObject*)obj;
168 p->setParent((ObjectContainerBase*)Gaudi::getCurrentDataObject());
169 }
Gaudi::getCurrentDataObject
GAUDI_API DataObject * getCurrentDataObject()
GaudiRoot::IOHandler::m_root
TClass * m_root
ROOT persistent class description.
Definition: RootIOHandler.cpp:56
std::count
T count(T...args)
ContainedObject
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
Definition: ContainedObject.h:29
ContainedObject::setParent
void setParent(ObjectContainerBase *value)
Update parent member.
Definition: ContainedObject.h:51
ObjectContainerBase
ObjectContainerBase is the base class for Gaudi container classes.
Definition: ObjectContainerBase.h:19
IOTest.start
tuple start
Definition: IOTest.py:88
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:56
pool::Token::m_oid
std::pair< int, int > m_oid
Object global identifier.
Definition: PoolClasses.h:27
pool::Token
Shadow class to mimik POOL tokens.
Definition: PoolClasses.h:20
std::count
T count(T...args)
IOTest.start
tuple start
Definition: IOTest.py:88
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 }
70 catch( const exception& e ) {
71 string err = "Class:" + string(m_root->GetName()) + "> Exception in object I/O";
72 err += e.what();
73 throw runtime_error(err);
74 }
75 catch( ... ) {
76 string err = "Class:" + string(m_root->GetName()) + "> Exception in object I/O";
77 throw runtime_error(err);
78 }
79 }
GaudiRoot::IOHandler::m_root
TClass * m_root
ROOT persistent class description.
Definition: RootIOHandler.cpp:56
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 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."
130 << endl;
131 throw runtime_error("IOHandler<SmartRefBase>::onWrite> "
132 "Found invalid smart reference with object "
133 "having no parent.");
134 break;
135 case SmartRefBase::DATAOBJECT:
136 link = StreamBuffer::INVALID;
137 break;
138 default:
139 break;
140 }
141 if ( pDO == last_link_object ) {
142 r.Base->set(curr, last_link_hint, link);
143 m_root->WriteBuffer(b, obj);
144 return;
145 }
146 else if ( pDO ) {
147 LinkManager* mgr = curr->linkMgr();
148 IRegistry* reg = pDO->registry();
149 if ( reg && mgr ) {
150 hint = mgr->addLink(reg->identifier(), pDO);
151 last_link_hint = hint;
152 last_link_object = pDO;
153 }
154 }
155 else {
156 hint = link = StreamBuffer::INVALID;
157 }
158 }
159 r.Base->set(curr, hint, link);
160 m_root->WriteBuffer(b, obj);
161 }
Gaudi::getCurrentDataObject
GAUDI_API DataObject * getCurrentDataObject()
std::endl
T endl(T...args)
ContainedObject::index
virtual long index() const
Distance in the parent container.
Definition: ContainedObject.h:54
LinkManager::addLink
long addLink(const std::string &path, const DataObject *pObject) const
Add link by object reference and path.
Definition: LinkManager.cpp:58
GaudiRoot::IOHandler::m_root
TClass * m_root
ROOT persistent class description.
Definition: RootIOHandler.cpp:56
ContainedObject::parent
const ObjectContainerBase * parent() const
Access to parent object.
Definition: ContainedObject.h:49
DataObject::registry
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:74
DataObject::linkMgr
LinkManager * linkMgr() const
Retrieve Link manager.
Definition: DataObject.h:78
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
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
Definition: ContainedObject.h:29
SmartRefBase::DATAOBJECT
Definition: SmartRefBase.h:60
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:117
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
template<>

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

Definition at line 171 of file RootIOHandler.cpp.

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

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

Definition at line 183 of file RootIOHandler.cpp.

183 {
184 throw runtime_error("Writing POOL files is not implemented!");
185 }
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 56 of file RootIOHandler.cpp.

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

- RootCnv/src/RootIOHandler.cpp