41 std::replace( begin( t ), end( t ),
'/',
'_' );
48 int loadRefs( std::string_view , std::string_view cnt,
unsigned long entry,
51 TTree* t = ( ti !=
sections().end() ? ti->second : nullptr );
52 if ( !t ) { t = (TTree*)
c->file()->Get(
_treeName( cnt ).c_str() ); }
54 TBranch* b1 = t->GetBranch(
"Links" );
55 TBranch* b2 = t->GetBranch(
"Refs" );
60 b1->SetAutoDelete( kFALSE );
61 b2->SetAutoDelete( kFALSE );
62 b1->SetAddress( &plm );
63 b2->SetAddress( &pmgr );
64 int nb1 = b1->GetEvent( entry );
65 int nb2 = b2->GetEvent( entry );
66 if ( nb1 > 1 && nb2 > 1 ) {
68 refs.refs.resize( ref_size );
70 for (
size_t j = 0; j < ref_size; ++j ) {
71 const pair<int, int>& oid = mgr.
references()[j]->m_oid;
72 string loc = mgr.
links()[j].substr( 1 );
74 if ( oid.first >= 0 ) {
77 r.
link =
c->makeLink( loc );
78 msg <<
"Add leaf:" << oid.first <<
"->" << loc <<
" from " <<
c->getDb( r.
dbase ) <<
"#"
79 <<
c->getCont( r.
container ) <<
" Link:" <<
c->getLink( r.
link ) <<
" CLID:" << hex << r.
clid
80 <<
" Typ:" << hex << int( r.
svc ) <<
" Ent:" << dec << r.
entry << endl;
83 for (
int i = 0, n = lm.
size(); i < n; ++i ) {
85 int link_id =
c->makeLink( lnk->
path() );
86 msg <<
"Add Link:" << lnk->
path() << endl;
87 refs.links.push_back( link_id );
92 msg <<
MSG::ERROR <<
"Failed to access POOL Ref/Link branches:" << cnt <<
" [" <<
_treeName( cnt ) <<
"]"
100 TBranch*
getBranch( std::string_view , std::string_view branch_name )
override {
101 auto ti =
sections().find( branch_name );
102 TTree* t = ( ti !=
sections().end() ? ti->second : nullptr );
103 if ( t ) {
return (TBranch*)t->GetListOfBranches()->At( 0 ); }
105 t = (TTree*)
c->file()->Get( tname.c_str() );
107 TBranch* b = (TBranch*)t->GetListOfBranches()->At( 0 );
109 sections()[std::string{ branch_name }] = t;
113 msgSvc() <<
MSG::ERROR <<
"Failed to access POOL branch:" << branch_name <<
" [" << tname <<
"]" <<
endmsg;
129 TTree* t = (TTree*)
c->file()->Get(
"##Params" );
131 TBranch* b = t->GetBranch(
"db_string" );
133 for ( i = 0, b->SetAddress( text ); i < b->GetEntries(); ++i ) {
135 char* id1 = strstr( text,
"[NAME=" );
136 char* id2 = strstr( text,
"[VALUE=" );
140 char* id11 = strstr( id1,
"]" );
141 char* id22 = strstr( id2,
"]" );
142 if ( id11 && id22 ) {
145 params().emplace_back( id1, id2 );
146 msgSvc() <<
"Param:" << id1 <<
"=" << id2 <<
"." <<
endmsg;
152 t = (TTree*)
c->file()->Get(
"##Links" );
154 b = t->GetBranch(
"db_string" );
157 for ( i = 0, b->SetAddress( text ); i < b->GetEntries(); ++i ) {
159 std::string db, container;
160 int clid = 1, technology = 0, ipar[2] = { -1, -1 };
161 for (
char* p1 = (
char*)text; p1; p1 = ::strchr( ++p1,
'[' ) ) {
162 char* p2 = ::strchr( p1,
'=' );
163 char* p3 = ::strchr( p1,
']' );
165 if ( ::strncmp(
"[DB=", p1, 4 ) == 0 ) {
168 }
else if ( ::strncmp(
"[CNT=", p1, 5 ) == 0 ) {
171 }
else if ( ::strncmp(
"[OID=", p1, 5 ) == 0 ) {
173 ::sscanf( p1 + 5,
"%08X,%08X", (
unsigned int*)&ipar[0], (
unsigned int*)&ipar[1] );
174 }
else if ( ::strncmp(
"[CLID=", p1, 6 ) == 0 ) {
176 ::sscanf( p1 + 6,
"%08X", (
unsigned int*)&clid );
177 }
else if ( ::strncmp(
"[TECH=", p1, 6 ) == 0 ) {
179 ::sscanf( p1 + 6,
"%08X", (
unsigned int*)&technology );
187 c->makeRef(
"", clid, technology, db, container, -1,
m_poolLinks[i + 2] );
189 msgSvc() <<
"Add link[" << i <<
"]:" << db << container <<
" [" << r.
dbase <<
"," << r.
container <<
"] "
190 <<
" tech:" << hex << setw( 8 ) << r.
svc <<
" CLID:" << setw( 8 ) << r.
clid << dec <<
endmsg;
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Concrete implementation of the IDataConnection interface to access ROOT files.
virtual void fireIncident(const Incident &incident)=0
Fire an Incident.
Base class for all Incidents (computing events).
Embedded class defining a symbolic link Note: No explicit copy constructor; implicit compiler generat...
const std::string & path() const
Access to path of object.
A LinkManager is the object aggregated into a DataObject, which is responsible for the handling of no...
long size() const
Retrieve number of link present.
const Link * link(long id) const
Retrieve symbolic link identified by ID.
Definition of the MsgStream class used to transmit messages.
Description: PoolDbLinkManager class implementation definition.
std::vector< pool::Token * > & references()
Access to token array.
std::vector< std::string > & links()
Access to link array.
This class is used for returning status codes from appropriate routines.
constexpr static const auto SUCCESS
constexpr static const auto FAILURE
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Persistent reference object containing all leafs and links corresponding to a Gaudi DataObject.
Persistent reference object.
int dbase
Data members to define object location in the persistent world.