31 #include <TBufferFile.h>
33 #include <TInterpreter.h>
39 #define SERIALIZER_END "EOF"
42 struct DataObjectPush {
51 if ( level < m_currentItem->depth() ) {
52 if ( dir->
object() != 0 ) {
53 m_objects.push_back( dir->
object() );
65 , m_verifyItems( false )
67 , m_addressCreator( ac ) {}
91 status = m_TES->retrieveObject( m_currentItem->path(), obj );
93 m_TESMgr->traverseSubTree( obj,
this ).
ignore( );
95 string text(
"WARNING: Cannot retrieve TES object(s) for serialisation: " );
96 text += m_currentItem->path();
107 m_currentItem = item;
109 status = m_TES->retrieveObject( m_currentItem->path(), obj );
111 m_TESMgr->traverseSubTree( obj,
this ).
ignore( );
118 objects.
reserve( m_objects.size() );
119 for_each(
begin( m_objects ),
end( m_objects ), [
this, &objects](
auto obj ) {
124 buffer.WriteInt( objects.
size() );
126 for (
auto& [pObj, cl] : objects ) {
127 DataObjectPush p( pObj );
131 buffer.WriteString( loc.
c_str() );
132 buffer.WriteString( cl->GetName() );
133 cl->Streamer( pObj, buffer );
137 long int numLinks = linkMgr->
size();
138 buffer.WriteInt( numLinks );
140 for (
int it = 0; it != numLinks; it++ ) {
141 const string& link = linkMgr->
link( it )->
path();
142 buffer.WriteString( link.
c_str() );
149 buffer.WriteInt( 1 );
150 const string*
par = iop->
par();
152 long clid = iop->
clID();
153 buffer.WriteLong( svcType );
154 buffer.WriteLong( clid );
155 buffer.WriteString(
par->c_str() );
157 buffer.WriteInt( 0 );
186 StatusCode sc, registerStat, createAddressStat;
189 buffer.SetReadMode();
190 buffer.SetBufferOffset();
192 buffer.ReadInt( nObjects );
193 for (
int i = 0; i < nObjects; ++i ) {
195 buffer.ReadString( text,
sizeof( text ) );
196 string location( text );
197 if ( !location.
compare(
"EOF" ) ) {
202 buffer.ReadString( text,
sizeof( text ) );
203 TClass* cl = gROOT->GetClass( text );
208 cout <<
"TESSerializer WARNING : gROOT->GetClass fails for clname : " << location.
c_str() <<
endl;
215 DataObjectPush push( obj );
216 cl->Streamer( obj, buffer );
222 buffer.ReadInt( nlink );
224 for (
int j = 0;
j < nlink; ++
j ) {
225 buffer.ReadString( text,
sizeof( text ) );
231 registerStat = m_TES->registerObject( location, obj );
234 if ( location ==
"/Event" ) {
235 sc = m_TESMgr->setRoot( location, obj );
238 m_TES->findObject( location, dummy ).ignore( );
240 m_TES->registerObject( location, obj ).ignore( );
245 buffer.ReadInt( flag );
248 buffer.ReadLong( svcType );
250 buffer.ReadLong( clid );
251 buffer.ReadString( text,
sizeof( text ) );
263 buffer.ReadInt( flag );
271 buffer.ReadLong( svcType );
274 buffer.ReadLong( clid );
275 const CLID classid( clid );
278 cp = buffer.ReadString( text,
sizeof( text ) );
279 const string opaque(
cp );
282 const string&
p2 =
"";
283 unsigned long ip1( 0 );
284 unsigned long ip2( 0 );
289 m_addressCreator->createAddress( gadd.
svcType(), gadd.
clID(), gadd.
par(), gadd.
ipar(), iopref );
291 throw GaudiException(
"Failure in creating OpaqueAddress for reconstructed registry",
"", createAddressStat );
310 size_t sep = descriptor.
rfind(
"#" );
311 if ( sep > descriptor.
length() ) {
313 obj_path = descriptor;
317 obj_path = descriptor.
substr( 0, sep );
318 slevel = descriptor.
substr( sep + 1 );
322 if ( slevel ==
"*" ) {
329 if ( m_verifyItems ) {
330 size_t idx = obj_path.
find(
"/", 1 );
331 while ( idx != std::string::npos ) {
333 if ( 0 == findItem( sub_item ) ) {
334 cout <<
"... calling addItem with arg : " << sub_item <<
endl;
335 addItem( itms, sub_item );
337 idx = obj_path.
find(
"/", idx + 1 );
350 addItem( m_itemList,
path );
356 addItem( m_optItemList,
path );
361 cout <<
"TESSerializer m_itemList : " << m_itemList.size() <<
" Items" <<
endl;
362 for ( Items::const_iterator i = m_itemList.begin(); i != m_itemList.end(); ++i ) {
363 cout <<
"\tItem : " << ( *i )->path() <<
endl;
365 cout <<
"TESSerializer m_optItemList : " << m_optItemList.size() <<
" Items" <<
endl;
366 for ( Items::const_iterator i = m_optItemList.begin(); i != m_optItemList.end(); ++i ) {
367 cout <<
"\tItem : " << ( *i )->path() <<
endl;
373 for ( Items::const_iterator i = m_itemList.begin(); i != m_itemList.end(); ++i ) {
374 if ( ( *i )->path() ==
path )
return ( *i );
376 for ( Items::const_iterator
j = m_optItemList.begin();
j != m_optItemList.end(); ++
j ) {
377 if ( ( *j )->path() ==
path )
return ( *
j );