Go to the documentation of this file.
4 #ifndef tools_rroot_branch_element
5 #define tools_rroot_branch_element
22 static const std::string s_v(
"tools::rroot::branch_element");
26 virtual void*
cast(
const std::string& a_class)
const {
27 if(
void* p = cmp_cast<branch_element>(
this,a_class))
return p;
34 if(
void* p = cmp_cast<branch_element>(
this,a_class)) {
return p;}
48 m_out <<
"tools::rroot::branch_element::stream : parent::stream() failed." << std::endl;
55 if(!a_buffer.
read(
fID))
return false;
61 std::string fParentName;
62 if(!a_buffer.
read(fParentName))
return false;
64 std::string fCloneName;
65 if(!a_buffer.
read(fCloneName))
return false;
68 if(!a_buffer.
read(dummy_int))
return false;
73 if(!a_buffer.
read(dummy_short))
return false;
76 if(!a_buffer.
read(dummy_int))
return false;
79 if(!a_buffer.
read(
fID))
return false;
86 if(!a_buffer.
read(dummy_int))
return false;
92 m_out <<
"tools::rroot::branch_element::stream : "
93 <<
"can't read fBranchCount."
100 m_out <<
"tools::rroot::branch_element::stream : "
101 <<
"can't read fBranchCount2."
118 static int kDouble = 8;
119 static int kDouble32 = 9;
120 static int kUInt = 13;
121 static int kBits = 15;
122 static int kObject = 61;
123 static int kObjectP = 64;
128 if(!a_buffer.
read(n))
return false;
154 }
else if(
fType==31) {
157 #ifdef TOOLS_RROOT_BRANCH_ELEMENT_DUMP
158 ::printf(
"debug : %s : fClassName %s : fID %d : kObject : ndata %d\n",
m_name.c_str(),
fClassName.c_str(),
fID,ndata);
162 m_out <<
"tools::rroot::branch_element::read_leaves : " <<
sout(
m_name) <<
" :"
163 <<
" read(kObject) : streamer_infos for ref_cls " <<
fClassName <<
" not found."
169 m_out <<
"tools::rroot::branch_element::read_leaves : " <<
sout(
m_name) <<
" :"
170 <<
" read(kObject) : for ref_cls " <<
fClassName <<
", fID " <<
fID <<
" streamer element not found."
181 _list = id_cast<iro,obj_list>(*
m_obj);
183 m_out <<
"tools::rroot::branch_element::read_leaves : " <<
sout(
m_name) <<
" :"
184 <<
" read(kObject) : m_obj is not an obj_list."
192 for(
int index=0;index<ndata;index++) {
196 if(!_obj->
stream(a_buffer)){
197 m_out <<
"tools::rroot::branch_element::read_leaves : " <<
sout(
m_name) <<
" :"
198 <<
" kObject : obj stream of class " <<
sout(_element->
type_name())
199 <<
" failed at index " << index <<
" (" << ndata <<
")." << std::endl;
212 #ifdef TOOLS_RROOT_BRANCH_ELEMENT_DUMP
213 ::printf(
"debug : %s : fID %d : double32 : ndata %d\n",
m_name.c_str(),
fID,ndata);
220 vec = id_cast<iro, stl_vector<double> >(*m_obj);
222 m_out <<
"tools::rroot::branch_element::read_leaves : " <<
sout(
m_name) <<
" :"
223 <<
" read(kDouble32) : m_obj is not a stl_vector<double>."
231 for(
int ii=0;ii<ndata;ii++) {
232 if(!a_buffer.
read(afloat)) {
233 m_out <<
"tools::rroot::branch_element::read_leaves : " <<
sout(
m_name) <<
" :"
234 <<
" read(float) failed."
247 #ifdef TOOLS_RROOT_BRANCH_ELEMENT_DUMP
248 ::printf(
"debug : %s : fID %d : double : ndata %d\n",
m_name.c_str(),
fID,ndata);
255 vec = id_cast<iro, stl_vector<double> >(*m_obj);
257 m_out <<
"tools::rroot::branch_element::read_leaves : " <<
sout(
m_name) <<
" :"
258 <<
" read(kDouble) : m_obj is not a stl_vector<double>."
267 m_out <<
"tools::rroot::branch_element::read_leaves : " <<
sout(
m_name) <<
" :"
268 <<
" read_fast_array(double) failed."
278 #ifdef TOOLS_RROOT_BRANCH_ELEMENT_DUMP
279 ::printf(
"debug : %s : fID %d : int : ndata %d\n",
m_name.c_str(),
fID,ndata);
286 vec = id_cast<iro, stl_vector<int> >(*m_obj);
288 m_out <<
"tools::rroot::branch_element::read_leaves : " <<
sout(
m_name) <<
" :"
289 <<
" read(kInt) : m_obj is not a stl_vector<int>."
298 m_out <<
"tools::rroot::branch_element::read_leaves : " <<
sout(
m_name) <<
" :"
299 <<
" read_fast_array(int) failed."
309 #ifdef TOOLS_RROOT_BRANCH_ELEMENT_DUMP
311 else ::printf(
"debug : %s : fID %d : bits : ndata %d\n",
m_name.c_str(),
fID,ndata);
318 vec = id_cast<iro, stl_vector<uint32> >(*m_obj);
320 m_out <<
"tools::rroot::branch_element::read_leaves : " <<
sout(
m_name) <<
" :"
321 <<
" read(kUInt) : m_obj is not a stl_vector<uint32>."
330 m_out <<
"tools::rroot::branch_element::read_leaves : " <<
sout(
m_name) <<
" :"
331 <<
" read_fast_array(uint) failed."
340 m_out <<
"tools::rroot::branch_element::read_leaves :"
358 }
else if(
fType==0) {
382 bool created =
false;
386 if(!
m_obj)
return false;
391 m_out <<
"tools::rroot::branch_element::read_leaves :"
393 <<
" obj stream failed."
402 m_out <<
"tools::rroot::branch_element::read_leaves :"
404 <<
" type 0 with ID " <<
fID <<
" not treated."
411 m_out <<
"tools::rroot::branch_element::read_leaves :"
598 if(!(*it)->find_entry(a_file,a_entry,n))
return false;
608 if(!
find_entry(a_file,a_entry,n))
return false;
615 a_out <<
m_obj << std::endl;
653 m_out <<
"tools::rroot::branch_element::object_to_stl_vector : there is no object." << std::endl;
658 m_out <<
"tools::rroot::branch_element::object_to_stl_vector :"
659 <<
" object of class " <<
sout(
m_obj->
s_cls()) <<
" not a tools::rroot::stl_vector<T>."
668 m_out <<
"tools::rroot::branch_element::object_to_obj_list : there is no object." << std::endl;
673 m_out <<
"tools::rroot::branch_element::object_to_obj_list :"
674 <<
" object of class " <<
sout(
m_obj->
s_cls()) <<
" not a tools::rroot::obj_list."
685 m_out <<
"tools::rroot::branch_element::find_entry_vec : find_entry() failed." << std::endl;
689 m_out <<
"tools::rroot::branch_element::find_entry_vec : no object found." << std::endl;
694 m_out <<
"tools::rroot::branch_element::find_entry_vec :"
695 <<
" object not a tools::rroot::stl_vector<T>."
724 #ifdef TOOLS_RROOT_BRANCH_ELEMENT_DUMP
725 #undef TOOLS_RROOT_BRANCH_ELEMENT_DUMP
#define tools_vforcit(a__T, a__v, a__it)