27#include <TClassStreamer.h>
28#include <TInterpreter.h>
38 static const DataObject* last_link_object =
nullptr;
39 static int last_link_hint = -1;
41 last_link_object =
nullptr;
79 }
catch (
const exception& e ) {
80 string err =
"Class:" + string(
m_root->GetName() ) +
"> Exception in object I/O";
82 throw runtime_error( err );
84 string err =
"Class:" + string(
m_root->GetName() ) +
"> Exception in object I/O";
85 throw runtime_error( err );
89 virtual void get( TBuffer& b,
void* obj );
91 virtual void put( TBuffer& b,
void* obj );
99 Version_t version = b.ReadVersion( &start, &count,
m_root );
100 m_root->ReadBuffer( b, obj, version, start, count );
109 cout <<
"Hit uninitialized smartRef!!!!" << endl;
138 cout <<
"IOHandler<SmartRefBase>::onWrite> "
139 <<
"Found invalid smart reference with object "
140 <<
"having no parent." << endl;
141 throw runtime_error(
"IOHandler<SmartRefBase>::onWrite> "
142 "Found invalid smart reference with object "
143 "having no parent." );
151 if ( pDO == last_link_object ) {
152 r.
Base->
set( curr, last_link_hint, link );
153 m_root->WriteBuffer( b, obj );
160 last_link_hint = hint;
161 last_link_object = pDO;
167 r.
Base->
set( curr, hint, link );
168 m_root->WriteBuffer( b, obj );
174 Version_t version = b.ReadVersion( &start, &count,
m_root );
175 m_root->ReadBuffer( b, obj, version, start, count );
182 m_root->WriteBuffer( b, obj );
189 b.ReadVersion( &start, &count,
m_root );
190 b.ReadFastArray( &t->m_oid.first, 2 );
191 b.CheckByteCount( start, count,
m_root );
196 throw runtime_error(
"Writing POOL files is not implemented!" );
200 static bool makeStreamer(
MsgStream& log ) {
202 TClass* c = gROOT->GetClass( cl_name.c_str() );
208 log <<
MSG::ERROR <<
"[No ROOT TClass] Failed to install IOHandler for class " << cl_name <<
endmsg;
213 static bool first =
true;
216 gInterpreter->LoadLibraryMap();
217 gInterpreter->AutoLoad(
"DataObject" );
218 gInterpreter->AutoLoad(
"PoolDbLinkManager" );
220 bool b1 = makeStreamer<SmartRefBase>( s );
221 bool b2 = makeStreamer<ContainedObject>( s );
222 bool b3 = makeStreamer<pool::Token>( s );
223 return b1 && b2 && b3;
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
void setParent(ObjectContainerBase *value)
Update parent member.
const ObjectContainerBase * parent() const
Access to parent object.
virtual long index() const
Distance in the parent container.
A DataObject is the base class of any identifiable object on any data store.
IRegistry * registry() const
Get pointer to Registry.
LinkManager * linkMgr()
Retrieve Link manager.
TClass * m_root
ROOT persistent class description.
TClassStreamer * Generate() const override
virtual void get(TBuffer &b, void *obj)
Callback for reading the object.
IOHandler(TClass *c)
Initializing constructor.
void operator()(TBuffer &b, void *obj) override
ROOT I/O callback.
virtual void put(TBuffer &b, void *obj)
Callback for writing the object.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
virtual const id_type & identifier() const =0
Full identifier (or key)
A LinkManager is the object aggregated into a DataObject, which is responsible for the handling of no...
long addLink(const std::string &path, const DataObject *pObject)
Add link by object reference and path.
Definition of the MsgStream class used to transmit messages.
ObjectContainerBase is the base class for Gaudi container classes.
User example objects: SmartRefBase.
void set(DataObject *pObj, long hint_id, long link_id)
Setup smart reference when reading. Must be allowed from external sources.
Kernel objects: SmartRef.
Shadow class to mimik POOL tokens.
GAUDI_API void pushCurrentDataObject(DataObject **pobjAddr)
GAUDI_API void popCurrentDataObject()
GAUDI_API DataObject * getCurrentDataObject()
void popCurrentDataObject()
bool patchStreamers(MsgStream &log)
void pushCurrentDataObject(DataObject **pobjAddr)
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
SmartRef< DataObject > * ObjectRef
SmartRef< ContainedObject > * ContainedRef