|
inlib
1.2.0
|

Public Member Functions | |
| tree (ifile &a_file, ifac &a_fac) | |
| virtual | ~tree () |
| ifile & | file () |
| const std::string & | name () const |
| const std::string & | title () const |
| const std::vector< branch * > & | branches () const |
| bool | find_entry (uint32 a_entry, uint32 &a_nbytes) |
| void | dump (std::ostream &a_out, const std::string &a_spaces="", const std::string &a_indent=" ") |
| branch * | find_branch (const std::string &a_name, bool a_recursive=false) const |
| std::vector< base_leaf * > | find_leaves () |
| bool | show (std::ostream &a_out, uint32 a_entry) |
| uint64 | entries () const |
| bool | stream (buffer &a_buffer) |
Protected Member Functions | |
| tree (const tree &a_from) | |
| tree & | operator= (const tree &) |
| void | _dump_branches (std::ostream &a_out, const std::vector< branch * > &a_bs, const std::string &a_spaces="", const std::string &a_indent=" ") |
| branch * | _find_branch (const std::vector< branch * > &a_bs, const std::string &a_name, bool a_recursive) const |
| void | _find_leaves (const std::vector< branch * > &a_bs, std::vector< base_leaf * > &a_leaves) |
Protected Attributes | |
| ifile & | m_file |
| ifac & | m_fac |
| std::ostream & | m_out |
| std::string | m_name |
| std::string | m_title |
| ObjArray< branch > | m_branches |
| uint64 | m_entries |
| virtual inlib::rroot::tree::~tree | ( | ) | [inline, virtual] |
| inlib::rroot::tree::tree | ( | const tree & | a_from | ) | [inline, protected] |
| void inlib::rroot::tree::_dump_branches | ( | std::ostream & | a_out, |
| const std::vector< branch * > & | a_bs, | ||
| const std::string & | a_spaces = "", |
||
| const std::string & | a_indent = " " |
||
| ) | [inline, protected] |
Definition at line 347 of file tree.
{
std::vector<branch*>::const_iterator it;
for(it=a_bs.begin();it!=a_bs.end();++it) {
if(branch_element* be = inlib::cast<branch,branch_element>(*(*it))) {
a_out << a_spaces
<< "branch_element :"
<< " name=" << sout((*it)->name())
<< " title=" << sout((*it)->title())
<< " entry_number=" << be->entry_number()
<< " ref_cls=" << sout(be->class_name())
<< " (type=" << be->type()
<< ",id=" << be->id()
<< ",stype=" << be->streamer_type()
<< ")."
<< std::endl;
} else {
a_out << a_spaces
<< "branch :"
<< " name=" << sout((*it)->name())
<< " title=" << sout((*it)->title())
<< " entry_number=" << (*it)->entry_number()
<< std::endl;
}
{const std::vector<base_leaf*>& lvs = (*it)->leaves();
std::vector<base_leaf*>::const_iterator itl;
for(itl=lvs.begin();itl!=lvs.end();++itl) {
a_out << a_spaces << a_indent
<< "leave :"
<< " name=" << sout((*itl)->name())
<< " title=" << sout((*itl)->title())
<< " cls=" << sout((*itl)->s_cls())
<< std::endl;
}}
_dump_branches(a_out,(*it)->branches(),a_spaces+a_indent,a_indent);
}
}
| branch* inlib::rroot::tree::_find_branch | ( | const std::vector< branch * > & | a_bs, |
| const std::string & | a_name, | ||
| bool | a_recursive | ||
| ) | const [inline, protected] |
Definition at line 390 of file tree.
{
std::vector<branch*>::const_iterator it;
for(it=a_bs.begin();it!=a_bs.end();++it) {
if((*it)->name()==a_name) return *it;
if(a_recursive) {
branch* br = _find_branch((*it)->branches(),a_name,a_recursive);
if(br) return br;
}
}
return 0;
}
| void inlib::rroot::tree::_find_leaves | ( | const std::vector< branch * > & | a_bs, |
| std::vector< base_leaf * > & | a_leaves | ||
| ) | [inline, protected] |
Definition at line 404 of file tree.
{
std::vector<branch*>::const_iterator it;
for(it=a_bs.begin();it!=a_bs.end();++it) {
{const std::vector<base_leaf*>& lvs = (*it)->leaves();
std::vector<base_leaf*>::const_iterator itl;
for(itl=lvs.begin();itl!=lvs.end();++itl) {
a_leaves.push_back(*itl);
}}
_find_leaves((*it)->branches(),a_leaves);
}
}
| const std::vector<branch*>& inlib::rroot::tree::branches | ( | ) | const [inline] |
Definition at line 57 of file tree.
{return m_branches;}
| void inlib::rroot::tree::dump | ( | std::ostream & | a_out, |
| const std::string & | a_spaces = "", |
||
| const std::string & | a_indent = " " |
||
| ) | [inline] |
Definition at line 74 of file tree.
{
a_out << a_spaces
<< "tree :"
<< " name=" << sout(m_name)
<< " title=" << sout(m_title)
<< " entries=" << m_entries
<< std::endl;
_dump_branches(a_out,m_branches,a_spaces+a_indent,a_indent);
}
| uint64 inlib::rroot::tree::entries | ( | ) | const [inline] |
| branch* inlib::rroot::tree::find_branch | ( | const std::string & | a_name, |
| bool | a_recursive = false |
||
| ) | const [inline] |
Definition at line 86 of file tree.
{
return _find_branch(m_branches,a_name,a_recursive);
}
Definition at line 59 of file tree.
{
a_nbytes = 0;
if(a_entry>=m_entries) return false;
int nbytes = 0;
//fReadEntry = a_entry;
std::vector<branch*>::const_iterator it;
for(it=m_branches.begin();it!=m_branches.end();++it) {
uint32 n;
if(!(*it)->find_entry(a_entry,n)) return false;
nbytes += n;
}
a_nbytes = nbytes;
return true;
}
| std::vector<base_leaf*> inlib::rroot::tree::find_leaves | ( | ) | [inline] |
Definition at line 91 of file tree.
{
std::vector<base_leaf*> leaves;
_find_leaves(m_branches,leaves);
return leaves;
}
| const std::string& inlib::rroot::tree::name | ( | ) | const [inline] |
| bool inlib::rroot::tree::show | ( | std::ostream & | a_out, |
| uint32 | a_entry | ||
| ) | [inline] |
Definition at line 101 of file tree.
{
a_out << "======> EVENT:" << a_entry << std::endl;
std::vector<branch*>::const_iterator it;
for(it=m_branches.begin();it!=m_branches.end();++it) {
if(!(*it)->show(a_out,a_entry)) return false;
}
return true;
}
| bool inlib::rroot::tree::stream | ( | buffer & | a_buffer | ) | [inline] |
Definition at line 112 of file tree.
{
uint64 m_tot_bytes;
uint64 m_zip_bytes;
uint64 m_saved_bytes;
short v;
unsigned int s, c;
if(!a_buffer.read_version(v,s,c)) return false;
//::printf("debug : tree::stream : version %d count %d\n",v,c);
//if (v > 4) {
//TTree::Class()->ReadBuffer(b, this, v, s, c);
//if (fEstimate <= 10000) fEstimate = 1000000;
//m_saved_bytes = m_tot_bytes;
//fDirectory = gDirectory;
//gDirectory->Append(this);
//return;
//}
if(!Named_stream(a_buffer,m_name,m_title)) return false;
if(!AttLine_stream(a_buffer)) return false;
if(!AttFill_stream(a_buffer)) return false;
if(!AttMarker_stream(a_buffer)) return false;
if(v<=4) {
int dummy_int;
if(!a_buffer.read(dummy_int)) return false; //fScanField
if(!a_buffer.read(dummy_int)) return false; //fMaxEntryLoop
{int fMaxVirtualSize;
if(!a_buffer.read(fMaxVirtualSize)) return false;}
{double v;
if(!a_buffer.read(v)) return false;
m_entries = uint64(v);}
{double v;
if(!a_buffer.read(v)) return false;
m_tot_bytes = uint64(v);}
{double v;
if(!a_buffer.read(v)) return false;
m_zip_bytes = uint64(v);}
{int fAutoSave;
if(!a_buffer.read(fAutoSave)) return false;}
if(!a_buffer.read(dummy_int)) return false; //fEstimate
} else if(v<=9) {
{double v;
if(!a_buffer.read(v)) return false;
m_entries = uint64(v);}
{double v;
if(!a_buffer.read(v)) return false;
m_tot_bytes = uint64(v);}
{double v;
if(!a_buffer.read(v)) return false;
m_zip_bytes = uint64(v);}
{double v;
if(!a_buffer.read(v)) return false;
m_saved_bytes = uint64(v);}
int dummy_int;
if(!a_buffer.read(dummy_int)) return false; //fTimerInterval
if(!a_buffer.read(dummy_int)) return false; //fScanField
if(!a_buffer.read(dummy_int)) return false; //fUpdate
if(!a_buffer.read(dummy_int)) return false; //fMaxEntryLoop
{int fMaxVirtualSize;
if(!a_buffer.read(fMaxVirtualSize)) return false;}
{int fAutoSave;
if(!a_buffer.read(fAutoSave)) return false;}
if(!a_buffer.read(dummy_int)) return false; //fEstimate
} else if(v<16) { //FIXME : what is the exact version ?
double dummy_double;
int dummy_int;
{double v;
if(!a_buffer.read(v)) return false;
m_entries = uint64(v);}
{double v;
if(!a_buffer.read(v)) return false;
m_tot_bytes = uint64(v);}
{double v;
if(!a_buffer.read(v)) return false;
m_zip_bytes = uint64(v);}
{double v;
if(!a_buffer.read(v)) return false;
m_saved_bytes = uint64(v);}
if(!a_buffer.read(dummy_double)) return false; //fWeight
if(!a_buffer.read(dummy_int)) return false; //fTimerInterval
if(!a_buffer.read(dummy_int)) return false; //fScanField
if(!a_buffer.read(dummy_int)) return false; //fUpdate
if(!a_buffer.read(dummy_int)) return false; //fMaxEntryLoop
{int fMaxVirtualSize;
if(!a_buffer.read(fMaxVirtualSize)) return false;}
{int fAutoSave;
if(!a_buffer.read(fAutoSave)) return false;}
if(!a_buffer.read(dummy_int)) return false; //fEstimate
} else { //v>=16
double dummy_double;
int dummy_int;
int64 dummy_int64;
{uint64 v;
if(!a_buffer.read(v)) return false;
m_entries = v;}
{uint64 v;
if(!a_buffer.read(v)) return false;
m_tot_bytes = v;}
{uint64 v;
if(!a_buffer.read(v)) return false;
m_zip_bytes = v;}
{uint64 v;
if(!a_buffer.read(v)) return false;
m_saved_bytes = v;}
if(!a_buffer.read(dummy_double)) return false; //fWeight
if(!a_buffer.read(dummy_int)) return false; //fTimerInterval
if(!a_buffer.read(dummy_int)) return false; //fScanField
if(!a_buffer.read(dummy_int)) return false; //fUpdate
if(!a_buffer.read(dummy_int64)) return false; //fMaxEntries
if(!a_buffer.read(dummy_int64)) return false; //fMaxEntryLoop
{uint64 fMaxVirtualSize;
if(!a_buffer.read(fMaxVirtualSize)) return false;}
{uint64 fAutoSave;
if(!a_buffer.read(fAutoSave)) return false;}
if(!a_buffer.read(dummy_int64)) return false; //fEstimate
}
//FIXME if (fEstimate <= 10000) fEstimate = 1000000;
//TObjArray
//The below m_branches.read will create leaves.
//::printf("debug : tree : read branches : begin\n");
{ifac::args args;
if(!m_branches.stream(a_buffer,m_fac,args)) {
m_out << "inlib::rroot::tree::stream : "
<< "can't read branches."
<< std::endl;
return false;
}}
//::printf("debug : tree : read branches : end\n");
//TObjArray
// We read leaves in order to keep streaming synchronisation.
// In fact m_leaves are references to existing leaves read by
// the branches in the upper line of code.
//::printf("debug : tree : read leaves : begin\n");
{ObjArray<base_leaf> m_leaves(true);
ifac::args args;
if(!m_leaves.stream(a_buffer,m_fac,args)) {
m_out << "inlib::rroot::tree::stream : "
<< "can't read leaves."
<< std::endl;
return false;
}}
//::printf("debug : tree : read leaves : end\n");
if(v>=10) {
//TList* fAliases
ifac::args args;
iro* obj;
if(!a_buffer.read_object(m_fac,args,obj)) {
m_out << "inlib::rroot::tree::stream : "
<< "can't read fAliases."
<< std::endl;
return false;
}
delete obj;
}
m_saved_bytes = m_tot_bytes;
{std::vector<double> v;
if(!Array_stream<double>(a_buffer,v)) return false;} //fIndexValues TArrayD
{std::vector<int> v;
if(!Array_stream<int>(a_buffer,v)) return false;} // fIndex (TArrayI).
if(v>=16) {
//TVirtualIndex* fTreeIndex //FIXME ???
ifac::args args;
iro* obj;
if(!a_buffer.read_object(m_fac,args,obj)) {
m_out << "inlib::rroot::tree::stream : "
<< "can't read fAliases."
<< std::endl;
return false;
}
delete obj;
}
if(v>=6) {
//TList* fFriends
ifac::args args;
iro* obj;
if(!a_buffer.read_object(m_fac,args,obj)) {
m_out << "inlib::rroot::tree::stream : "
<< "can't read fFriends."
<< std::endl;
return false;
}
delete obj;
}
if(v>=16) {
//TList* fUserInfo
{ifac::args args;
iro* obj;
if(!a_buffer.read_object(m_fac,args,obj)) {
m_out << "inlib::rroot::tree::stream : "
<< "can't read fUserInfo."
<< std::endl;
return false;
}
delete obj;}
//TBranchRef* fBranchRef
{ifac::args args;
iro* obj;
if(!a_buffer.read_object(m_fac,args,obj)) {
m_out << "inlib::rroot::tree::stream : "
<< "can't read fUserInfo."
<< std::endl;
return false;
}
delete obj;}
}
if(!a_buffer.check_byte_count(s,c,TTree_cls())) return false;
return true;
}
| const std::string& inlib::rroot::tree::title | ( | ) | const [inline] |
ObjArray<branch> inlib::rroot::tree::m_branches [protected] |
uint64 inlib::rroot::tree::m_entries [protected] |
ifac& inlib::rroot::tree::m_fac [protected] |
ifile& inlib::rroot::tree::m_file [protected] |
std::string inlib::rroot::tree::m_name [protected] |
std::ostream& inlib::rroot::tree::m_out [protected] |
std::string inlib::rroot::tree::m_title [protected] |
1.7.5.1