g4tools  5.4.0
buffer
Go to the documentation of this file.
1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
2 // See the file tools.license for terms.
3 
4 #ifndef tools_rroot_buffer
5 #define tools_rroot_buffer
6 
7 #include "rbuf"
8 #include "ifac"
9 #include "iro"
10 #include "../sout"
11 #include "../mapmanip"
12 #ifdef TOOLS_MEM
13 #include "../mem"
14 #endif
15 
16 #include <string>
17 #include <vector>
18 #include <ostream>
19 
20 // in TOOLS_STL, we don't have (yet) a performant map.
21 
22 #ifdef tools_stl_vector
23 #define TOOLS_RROOT_OBJ_MAP_HASH_TABLE
24 //#define TOOLS_RROOT_OBJ_MAP_OMAP
25 #else
26 #define TOOLS_RROOT_OBJ_MAP_STD_MAP
27 #endif
28 
29 #ifdef TOOLS_RROOT_OBJ_MAP_STD_MAP
30 #include <map>
31 #endif
32 #ifdef TOOLS_RROOT_OBJ_MAP_OMAP
33 #include "../omap"
34 #endif
35 #ifdef TOOLS_RROOT_OBJ_MAP_HASH_TABLE
36 #include "../hash_table"
37 #include "../hash"
38 #endif
39 
40 namespace tools {
41 namespace rroot {
42 
43 class buffer : public rbuf {
44  typedef rbuf parent;
45 
46  static const std::string& s_class() {
47  static const std::string s_v("tools::rroot::buffer");
48  return s_v;
49  }
50 
51 #ifdef TOOLS_RROOT_OBJ_MAP_STD_MAP
52  typedef std::map<uint32,iro*> obj_map;
53 #endif
54 #ifdef TOOLS_RROOT_OBJ_MAP_OMAP
55  typedef omap<uint32,iro*> obj_map;
56 #endif
57 #ifdef TOOLS_RROOT_OBJ_MAP_HASH_TABLE
58  class obj_map : public hash_table<uint32,iro*> {
59  typedef hash_table<uint32,iro*> parent;
60  protected:
61  virtual unsigned int hash(const uint32& a_key) {
62  return hash(&a_key,sizeof(uint32));
63  }
64  virtual bool cmp(const uint32& a_key1,const uint32& a_key2) {
65  return a_key1==a_key2?true:false;
66  }
67  public:
68  obj_map():parent(){}
69  virtual ~obj_map(){}
70  private:
71  obj_map(const obj_map& a_from):parent(a_from){}
72  obj_map& operator=(const obj_map& a_from){
73  parent::operator=(a_from);
74  return *this;
75  }
76  };
77 #endif
78 
79 public:
80  buffer(std::ostream& a_out,bool a_byte_swap,uint32 a_size,char* a_buffer,uint32 a_klen,bool a_verbose)
81  :parent(a_out,a_byte_swap,a_buffer+a_size,m_pos)
82  ,m_byte_swap(a_byte_swap)
83  ,m_verbose(a_verbose)
84  //,m_verbose(true)
85  ,m_size(a_size) //expect a not zero size.
86  ,m_buffer(a_buffer) //don't get ownership.
87  ,m_pos(a_buffer)
88  ,m_klen(a_klen) //to compute refs (used in read_class, read_object)
89 //,m_map_objs(false)
90  ,m_map_objs(true)
91  {
92 #ifdef TOOLS_MEM
93  mem::increment(s_class().c_str());
94 #endif
95  }
96  virtual ~buffer(){
97  m_objs.clear();
98 #ifdef TOOLS_MEM
99  mem::decrement(s_class().c_str());
100 #endif
101  }
102 protected:
103  buffer(const buffer& a_from)
104  :parent(a_from.m_out,a_from.m_byte_swap,0,m_pos)
105  ,m_byte_swap(a_from.m_byte_swap)
106  ,m_map_objs(a_from.m_map_objs)
107  {
108 #ifdef TOOLS_MEM
109  mem::increment(s_class().c_str());
110 #endif
111  }
112  buffer& operator=(const buffer&){return *this;}
113 public:
114  bool byte_swap() const {return m_byte_swap;}
115  bool verbose() const {return m_verbose;}
116 
117  void set_offset(unsigned int a_off) {m_pos = m_buffer+a_off;}
118 
119  //char* buffer() const {return m_buffer;}
120  uint32 length() const {return uint32(m_pos-m_buffer);}
121  uint32 size() const {return m_size;}
122 
123  void set_map_objs(bool a_value) {m_map_objs = a_value;}
124  bool map_objs() const {return m_map_objs;}
125 protected:
126  // on first_int :
127  static uint32 kNullTag() {return 0;}
128  static uint32 kByteCountMask() {return 0x40000000;}
129  // on tag :
130  static uint32 kNewClassTag() {return 0xFFFFFFFF;}
131  static uint32 kClassMask() {return 0x80000000; }
132  static uint32 kMapOffset() {return 2;}
133  static short kByteCountVMask() {return 0x4000;}
134 
135  bool read_class_tag(std::string& a_class) {
136  a_class.clear();
137 
138  uint32 tag;
139  if(!parent::read(tag)) return false;
140 
141  if(tag==kNewClassTag()) {
142  char s[80];
143  if(!read_string(s, 80)) {
144  m_out << "tools::rroot::read_class_tag :"
145  << " read string." << std::endl;
146  return false;
147  }
148  //m_out << "tools::rroot::read_class_tag :"
149  // << " tag kNewClassTag"
150  // << " class " << s
151  // << std::endl;
152  a_class = s;
153  return true;
154 
155  } else if(tag & kClassMask()) {
156  //m_out << "tools::rroot::read_class_tag :"
157  // << " tag & kClassMask"
158  // << " ref " << (uint32)(tag & ~kClassMask)
159  // << " recurse..."
160  // << std::endl;
161 
162  unsigned int cl_offset = (tag & ~kClassMask());
163  cl_offset -= kMapOffset();
164  cl_offset -= m_klen;
165  char* old_pos = m_pos;
166  m_pos = m_buffer + cl_offset;
167  //std::string scls;
168  //uint32 ref;
169  if(!read_class_tag(a_class)) return false;
170  m_pos = old_pos;
171 
172  return true;
173 
174  } else {
175 
176  std::ios::fmtflags old_flags = m_out.flags();
177  m_out << "tools::rroot::read_class_tag :"
178  << " tag unknown case ! "
179  << tag << " hex " << std::hex << tag
180  << std::endl;
181  m_out.flags(old_flags);
182 
183  return false;
184  }
185  }
186 
187  bool read_class(std::string& a_class,uint32& a_bcnt,bool& a_is_ref){
188  //m_verbose = true;
189  a_class.clear();
190  a_bcnt = 0;
191  a_is_ref = false;
192 
193  //uint32 fVersion = 0; //Buffer format version
194 
195  // read byte count and/or tag (older files don't have byte count)
196  uint32 first_int = 0;
197  if(!parent::read(first_int)) return false;
198 
199  if(m_verbose) {
200  std::ios::fmtflags old_flags = m_out.flags();
201  m_out << "tools::rroot::read_class :"
202  << " first_int " << std::hex << first_int
203  << std::endl;
204  m_out.flags(old_flags);
205  }
206 
207  if(first_int==kNullTag()) { //GB
208  if(m_verbose) {
209  m_out << "tools::rroot::read_class :"
210  << " first_int is kNullTag."
211  << std::endl;
212  }
213  a_bcnt = 0;
214  return true;
215 
216  //} else if(first_int==kNewClassTag()) { // class desc follows.
217  } else if(first_int & kByteCountMask()) {
218  // at write :
219  // skip int to store bcnt.
220  // + write class
221  // if(!write((clIdx | Rio_kClassMask))) return false;
222  // or
223  // if(!write(Rio_kNewClassTag)) return false;
224  // + write object
225  // + set byte cnt (cnt|kByteCountMask()) at skipped int.
226 
227  if(m_verbose) {
228  m_out << "tools::rroot::read_class :"
229  << " first_int & kByteCountMask."
230  << std::endl;
231  }
232 
233  uint32 bef_tag = uint32(m_pos-m_buffer);
234  //fVersion = 1;
235 
236  std::string scls;
237  if(!read_class_tag(scls)) return false;
238  if(scls.empty()) {
239  m_out << "tools::rroot::buffer::read_class :"
240  << " read_class_tag did not find a class name."
241  << std::endl;
242  return false;
243  }
244 
245  a_class = scls;
246  a_bcnt = (first_int & ~kByteCountMask());
247 
248  if(m_verbose) {
249  m_out << "tools::rroot::read_class :"
250  << " kNewClassTag : read class name " << sout(a_class)
251  << " a_bcnt " << a_bcnt
252  << " bef_tag " << bef_tag
253  << "." << std::endl;
254  }
255 
256  return true;
257 
258  } else {
259  if(m_verbose) {
260  std::ios::fmtflags old_flags = m_out.flags();
261  m_out << "tools::rroot::read_class :"
262  << " first_int " << std::hex << first_int
263  << ". first_int is position toward object."
264  << std::endl;
265  m_out.flags(old_flags);
266  }
267  a_bcnt = first_int; //pos toward object.
268  a_is_ref = true;
269  a_class.clear();
270  return true;
271  }
272 
273  return false;
274  }
275 public:
276  void remove_in_map(iro* a_obj) {
277 #ifdef TOOLS_RROOT_OBJ_MAP_HASH_TABLE
278  m_out << "tools::rroot::remove_in_map : dummy." << std::endl;
279 #else
281 #endif
282  }
283  bool read_object(ifac& a_fac,const ifac::args& a_args,iro*& a_obj,bool& a_created){
284  a_obj = 0;
285  a_created = false;
286 
287  //m_out << "debug : tools::rroot::buffer::read_object : begin :" << std::endl;
288 
289  // before reading object save start position
290  uint32 startpos = (uint32)(m_pos-m_buffer);
291 
292  uint32 bcnt;
293  std::string sclass;
294  bool is_ref;
295  if(!read_class(sclass,bcnt,is_ref)) {
296  m_out << "tools::rroot::buffer::read_object :"
297  << " can't read class." << std::endl;
298  return false;
299  }
300  //::printf("debug : %d\n",length()-startpos);
301 
302  if(m_verbose) {
303  m_out << "tools::rroot::buffer::read_object :"
304  << " class " << sout(sclass) << ", is_ref " << is_ref
305  << ", bcnt " << bcnt
306  << std::endl;
307  }
308 
309  if(is_ref) { //bcnt is the position toward an object or an object ref.
310  //m_out << "debug : tools::rroot::buffer::read_object : is_ref : bcnt " << bcnt << std::endl;
311 
312  unsigned int obj_offset = bcnt;
313  obj_offset -= kMapOffset();
314  obj_offset -= m_klen;
315 
316  if(!m_map_objs) {
317  m_out << "tools::rroot::buffer::read_object : warning :"
318  << " class " << sout(sclass) << ", is_ref but map objs is not enabled on this buffer."
319  << std::endl;
320  }
321 
322  if(m_map_objs) {
323 #ifdef TOOLS_RROOT_OBJ_MAP_HASH_TABLE
324  if(m_objs.find(obj_offset,a_obj)) {
325  //m_out << "debug : tools::rroot::buffer::read_object : found object in map." << bcnt << std::endl;
326  return true;
327  }
328 #else
329  obj_map::const_iterator it = m_objs.find(obj_offset);
330  if(it!=m_objs.end()) {
331  a_obj = (*it).second;
332  //::printf("debug : find : %d %lu\n",obj_offset,a_obj);
333  //stay at current m_pos ?
334  return true;
335  }
336 #endif
337  }
338 
339  {char* old_pos = m_pos;
340 
341  m_pos = m_buffer + obj_offset;
342 
343  uint32 first_int;
344  if(!parent::read(first_int)) {
345  m_out << "tools::rroot::buffer::read_object : parent::read(first_int) failed." << std::endl;
346  return false;
347  }
348  if(first_int & kByteCountMask()) {
349  std::string scls;
350  if(!read_class_tag(scls)) {
351  m_out << "tools::rroot::buffer::read_object : read_class_tag() failed." << std::endl;
352  return false;
353  }
354  if(scls.empty()) {
355  m_out << "tools::rroot::buffer::read_object :"
356  << " read_class_tag did not find a class name."
357  << std::endl;
358  return false;
359  }
360 
361  //m_out << "tools::rroot::buffer::read_object :"
362  // << " is_ref : class " << sout(scls)
363  // << std::endl;
364 
365  iro* obj = a_fac.create(scls,a_args);
366  if(!obj) {
367  m_out << "tools::rroot::buffer::read_object : is_ref : creation of object"
368  << " of class " << sout(sclass) << " failed." << std::endl;
369  return false;
370  }
371 
372  if(m_map_objs) {
373  //must be done before stream()
374 #ifdef TOOLS_RROOT_OBJ_MAP_HASH_TABLE
375  if(!m_objs.insert(obj_offset,obj)) {
376  m_out << "tools::rroot::buffer::read_object :"
377  << " map insert failed."
378  << std::endl;
379  }
380 #else
381  m_objs[obj_offset] = obj;
382 #endif
383  }
384 
385  if(!obj->stream(*this)) {
386  m_out << "tools::rroot::buffer::read_object :"
387  << " is_ref : streamed failed for class " << sout(scls)
388  << std::endl;
389  //restore a good buffer position :
390  //m_pos = m_buffer+startpos+sizeof(unsigned int);
391  delete obj;
392  return false;
393  }
394 
395  //m_out << "tools::rroot::buffer::read_object :"
396  // << " is_ref : streamed ok for class " << sout(scls)
397  // << std::endl;
398 
399  a_obj = obj;
400  a_created = true;
401 
402  } else {
403  m_out << "tools::rroot::buffer::read_object :"
404  << " is_ref : zzz"
405  << std::endl;
406  }
407 
408  m_pos = old_pos;}
409 
410  // in principle at this point m_pos should be
411  // m_buffer+startpos+sizeof(unsigned int)
412  // but enforce it anyway :
413  m_pos = m_buffer+startpos+sizeof(unsigned int);
414  //check_byte_count(startpos,0,sclass) would always be ok.
415 
416  //a_obj = ???
417 
418  } else {
419  if(sclass.empty()) {
420  //m_out << "debug : tools::rroot::buffer::read_object : found empty class name." << std::endl;
421 
422  m_pos = m_buffer+startpos+bcnt+sizeof(unsigned int);
423 
424  } else {
425  //m_out << "debug : tools::rroot::buffer::read_object : not a ref, create object." << std::endl;
426 
427  // Being not a ref, it must NOT be in the map.
428  // We gain a lot by not doing the below find.
429 /*
430  if(m_map_objs) {
431 #ifdef TOOLS_RROOT_OBJ_MAP_HASH_TABLE
432  if(m_objs.find(startpos,a_obj)) return true;
433 #else
434  obj_map::const_iterator it = m_objs.find(startpos);
435  if(it!=m_objs.end()) {
436  a_obj = (*it).second;
437  ::printf("debug : find xxx : %d %lu\n",startpos,a_obj);
438  //stay at current m_pos ?
439  return true;
440  }
441 #endif
442  }
443 */
444 
445  iro* obj = a_fac.create(sclass,a_args);
446  if(!obj) {
447  m_out << "tools::rroot::buffer::read_object : creation of object"
448  << " of class " << sout(sclass) << " failed." << std::endl;
449  return false;
450  }
451  //m_out << "debug : tools::rroot::buffer::read_object : object created." << std::endl;
452 
453  if(m_map_objs) {
454  //must be done before stream()
455 #ifdef TOOLS_RROOT_OBJ_MAP_HASH_TABLE
456  if(!m_objs.insert(startpos,obj)) {
457  m_out << "tools::rroot::buffer::read_object :"
458  << " map insert failed."
459  << std::endl;
460  }
461 #else
462  m_objs[startpos] = obj;
463 #endif
464  }
465 
466  //::printf("debug : map : %d %lu\n",startpos,obj);
467 
468  //NOTE : if class ref, "up there"-startpos = 8.
469  if(!obj->stream(*this)) {
470  m_out << "tools::rroot::buffer::read_object : object.stream() failed"
471  << " for object of class " << sout(sclass) << "." << std::endl;
472  //restore a good buffer position :
473  //m_pos = m_buffer+startpos+bcnt+sizeof(unsigned int);
474  delete obj;
475  return false;
476  }
477 
478  //NOTE : if obj stream ok, the below line is not needed.
479  //m_pos = m_buffer+startpos+bcnt+sizeof(unsigned int);
480 
481  if(!check_byte_count(startpos,bcnt,sclass)) {
482  m_out << "tools::rroot::buffer::read_object :"
483  << " check_byte_count failed "
484  << "for object of class "
485  << sout(sclass) << "." << std::endl;
486  delete obj;
487  return false;
488  }
489 
490  a_obj = obj;
491  a_created = true;
492  }
493 
494  }
495 
496  if(m_verbose) {
497  m_out << "tools::rroot::buffer::read_object : end." << std::endl;
498  }
499 
500  return true;
501  }
502 public:
503  bool read_version(short& a_version){
504  // Read class version from I/O buffer.
505  // Is read a short or three shorts.
506  a_version = 0;
507  short version = 0;
508  // not interested in byte count
509  if(!parent::read(version)) return false;
510 
511  // if this is a byte count, then skip next short and read version
512  if(version & kByteCountVMask()) {
513  if(!parent::read(version)) return false;
514  if(!parent::read(version)) return false;
515  }
516 
517  a_version = version;
518  return true;
519  }
520 
521  bool read_version(short& a_version,uint32& a_start_pos,uint32& a_byte_count){
522  // Read class version from I/O buffer.
523  // Is read one or three shorts.
524  a_version = 0;
525  a_start_pos = 0;
526  a_byte_count = 0;
527 
528  short version = 0;
529 
530  // before reading object save start position
531  uint32 startpos = (uint32)(m_pos-m_buffer);
532 
533  // read byte count (older files don't have byte count)
534  // byte count is packed in two individual shorts, this to be
535  // backward compatible with old files that have at this location
536  // only a single short (i.e. the version)
537  union {
538  unsigned int cnt;
539  short vers[2];
540  } v;
541 
542  if(m_byte_swap) {
543  if(!parent::read(v.vers[1])) return false;
544  if(!parent::read(v.vers[0])) return false;
545  } else {
546  if(!parent::read(v.vers[0])) return false;
547  if(!parent::read(v.vers[1])) return false;
548  }
549 
550  // no bytecount, backup and read version
551  uint32 bcnt = 0;
552  if(v.cnt & kByteCountMask()) {
553  bcnt = (v.cnt & ~kByteCountMask());
554  } else {
555  m_pos -= sizeof(unsigned int);
556  }
557  if(!parent::read(version)) return false;
558  //printf("Reading version=%d at pos=%d, bytecount=%d\n",
559  //version,*startpos,*bcnt);
560 
561  a_version = version;
562  a_start_pos = startpos;
563  a_byte_count = bcnt;
564 
565  return true;
566  }
567 
568  bool check_byte_count(uint32 a_start_pos,uint32 a_byte_count,const std::string& a_store_cls){
569  if(!a_byte_count) return true;
570 
571  size_t len = a_start_pos + a_byte_count + sizeof(unsigned int);
572 
573  size_t diff = size_t(m_pos-m_buffer);
574 
575  if(diff==len) return true;
576 
577  if(diff<len) {
578  m_out << "tools::rroot::buffer::check_byte_count :"
579  << " object of class " << sout(a_store_cls)
580  << " read too few bytes ("
581  << long_out(long(len-diff)) << " missing)."
582  << std::endl;
583  }
584  if(diff>len) {
585  m_out << "tools::rroot::buffer::check_byte_count :"
586  << " object of class " << sout(a_store_cls)
587  << " read too many bytes ("
588  << long_out(long(diff-len)) << " in excess)." << std::endl;
589  }
590 
591  m_out << "tools::rroot::buffer::check_byte_count :"
592  << " " << sout(a_store_cls)
593  << " streamer not in sync with data on file, fix streamer."
594  << std::endl;
595 
596  m_pos = m_buffer+len;
597 
598  return false;
599  }
600 protected:
601  bool read_string(char* a_string,uint32 a_max) {
602  // Read string from I/O buffer. String is read till 0 character is
603  // found or till max-1 characters are read (i.e. string s has max
604  // bytes allocated).
605  int nr = 0;
606  while (nr < int(a_max-1)) {
607  char ch;
608  if(!parent::read(ch)) return false;
609  // stop when 0 read
610  if(ch == 0) break;
611  a_string[nr++] = ch;
612  }
613  a_string[nr] = 0;
614  return true;
615  }
616 protected:
617  // buffer objects cannot be copied or assigned
618  //void checkCount(unsigned int);
619  //unsigned int checkObject(unsigned int,const IClass*,bool = false);
620 protected:
622  bool m_verbose;
624  char* m_buffer;
625  char* m_pos;
628  obj_map m_objs;
629 };
630 
631 inline bool dummy_TXxx_pointer_stream(buffer& a_buffer,ifac& a_fac) {
633  iro* obj;
634  bool created;
635  bool status = a_buffer.read_object(a_fac,args,obj,created);
636  if(obj) {
637  if(created) {
638  if(a_buffer.map_objs()) a_buffer.remove_in_map(obj);
639  delete obj;
640  }
641  }
642  return status;
643 }
644 
645 template <class T>
646 inline bool pointer_stream(buffer& a_buffer,
647  ifac& a_fac,ifac::args& a_args,
648  const std::string& a_T_class,
649  T*& a_obj,bool& a_created){
650  iro* obj;
651  if(!a_buffer.read_object(a_fac,a_args,obj,a_created)) {
652  a_buffer.out() << "tools::rroot::pointer_stream : read_object failed." << std::endl;
653  a_obj = 0;
654  a_created = false;
655  return false;
656  }
657  if(!obj) {
658  a_obj = 0;
659  a_created = false;
660  } else {
661  a_obj = (T*)obj->cast(a_T_class);
662  if(!a_obj) {
663  a_buffer.out() << "tools::rroot::pointer_stream : "
664  << " inlib::cast to " << a_T_class << " failed."
665  << ". Object is a " << obj->s_cls() << "."
666  << std::endl;
667  if(a_created) delete obj;
668  a_created = false;
669  return false;
670  }
671  }
672  return true;
673 }
674 
675 template <class T>
676 inline bool pointer_stream(buffer& a_buffer,
677  ifac& a_fac,ifac::args& a_args,
678  cid a_T_class,
679  T*& a_obj,bool& a_created){
680  iro* obj;
681  if(!a_buffer.read_object(a_fac,a_args,obj,a_created)) {
682  a_buffer.out() << "tools::rroot::pointer_stream : read_object failed." << std::endl;
683  a_obj = 0;
684  a_created = false;
685  return false;
686  }
687  if(!obj) {
688  a_obj = 0;
689  a_created = false;
690  } else {
691  a_obj = (T*)obj->cast(a_T_class);
692  if(!a_obj) {
693  a_buffer.out() << "tools::rroot::pointer_stream : "
694  << " inlib::cast to " << a_T_class << " failed."
695  << ". Object is a " << obj->s_cls() << "."
696  << std::endl;
697  if(a_created) delete obj;
698  a_created = false;
699  return false;
700  }
701  }
702  return true;
703 }
704 
705 template <class T>
706 inline bool pointer_stream(buffer& a_buffer,ifac& a_fac,ifac::args& a_args,T*& a_obj,bool& a_created){
707  //return pointer_stream(a_buffer,a_fac,a_args,T::s_class(),a_obj,a_created);
708  return pointer_stream(a_buffer,a_fac,a_args,T::id_class(),a_obj,a_created);
709 }
710 
711 template <class T>
712 inline bool fixed_array_stream(buffer& a_buffer,int a_n,T*& a_v){
713  delete [] a_v;
714  a_v = 0;
715  char is_array;
716  if(!a_buffer.read(is_array)) return false;
717  if(!is_array) return true;
718  if(!a_n) return true;
719  a_v = new T[a_n];
720  if(!a_buffer.read_fast_array<T>(a_v,a_n)) {
721  delete [] a_v;
722  a_v = 0;
723  return false;
724  }
725  return true;
726 }
727 
728 }}
729 
730 #endif
tools::rroot::iro::cast
virtual void * cast(const std::string &) const =0
rbuf
tools::rroot::buffer::m_klen
uint32 m_klen
Definition: buffer:626
tools::rroot::iro::stream
virtual bool stream(buffer &)=0
tools::rroot::rbuf::read_fast_array
bool read_fast_array(bool *b, uint32 n)
Definition: rbuf:261
tools::rroot::buffer::read_object
bool read_object(ifac &a_fac, const ifac::args &a_args, iro *&a_obj, bool &a_created)
Definition: buffer:283
tools::rroot::buffer::check_byte_count
bool check_byte_count(uint32 a_start_pos, uint32 a_byte_count, const std::string &a_store_cls)
Definition: buffer:568
tools::rroot::buffer::kMapOffset
static uint32 kMapOffset()
Definition: buffer:132
tools::rroot::buffer::m_size
uint32 m_size
Definition: buffer:623
tools::rroot::rbuf::operator=
rbuf & operator=(const rbuf &a_from)
Definition: rbuf:115
tools::rroot::buffer::operator=
buffer & operator=(const buffer &)
Definition: buffer:112
iro
tools::rroot::buffer::m_byte_swap
bool m_byte_swap
Definition: buffer:621
tools::rroot::buffer::size
uint32 size() const
Definition: buffer:121
tools::rroot::buffer::kByteCountMask
static uint32 kByteCountMask()
Definition: buffer:128
tools::cmp
bool cmp(std::ostream &a_out, const T &a_what, const T &a_ref, const T &a_error=T())
Definition: cmp:12
tools::rroot::buffer::kNullTag
static uint32 kNullTag()
Definition: buffer:127
tools::rroot::buffer::byte_swap
bool byte_swap() const
Definition: buffer:114
tools::rroot::rbuf::out
std::ostream & out() const
Definition: rbuf:125
tools::rroot::buffer::m_objs
obj_map m_objs
Definition: buffer:628
tools::rroot::buffer::read_version
bool read_version(short &a_version)
Definition: buffer:503
tools::args
Definition: args:24
tools::rroot::buffer::read_class
bool read_class(std::string &a_class, uint32 &a_bcnt, bool &a_is_ref)
Definition: buffer:187
tools::rroot::buffer::read_version
bool read_version(short &a_version, uint32 &a_start_pos, uint32 &a_byte_count)
Definition: buffer:521
tools::sout
Definition: sout:17
tools::long_out
Definition: long_out:12
tools::version
unsigned int version()
Definition: version:14
tools::rroot::pointer_stream
bool pointer_stream(buffer &a_buffer, ifac &a_fac, ifac::args &a_args, const std::string &a_T_class, T *&a_obj, bool &a_created)
Definition: buffer:646
tools::rroot::buffer::m_verbose
bool m_verbose
Definition: buffer:622
tools::rroot::buffer::buffer
buffer(const buffer &a_from)
Definition: buffer:103
tools::rroot::ifac::create
virtual iro * create(const std::string &a_class, const args &)=0
tools::rroot::buffer::read_string
bool read_string(char *a_string, uint32 a_max)
Definition: buffer:601
tools::rroot::buffer::length
uint32 length() const
Definition: buffer:120
tools::rroot::rbuf
Definition: rbuf:22
tools::rroot::buffer::set_map_objs
void set_map_objs(bool a_value)
Definition: buffer:123
tools::rroot::buffer::map_objs
bool map_objs() const
Definition: buffer:124
tools::rroot::buffer::read_class_tag
bool read_class_tag(std::string &a_class)
Definition: buffer:135
tools::rroot::buffer::m_pos
char * m_pos
Definition: buffer:625
tools::rroot::ifac
Definition: ifac:19
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26
tools::rroot::buffer::set_offset
void set_offset(unsigned int a_off)
Definition: buffer:117
tools::rroot::buffer::kByteCountVMask
static short kByteCountVMask()
Definition: buffer:133
tools::rroot::buffer::kNewClassTag
static uint32 kNewClassTag()
Definition: buffer:130
tools::rroot::buffer
Definition: buffer:43
tools::diff
void diff(std::ostream &a_out, const array< T > &aA, const array< T > &aB, T a_epsilon)
Definition: array:529
tools::rroot::buffer::kClassMask
static uint32 kClassMask()
Definition: buffer:131
tools::rroot::rbuf::read
bool read(unsigned char &a_x)
Definition: rbuf:146
tools::find_and_remove_value
void find_and_remove_value(std::map< K, V * > &a_m, V *a_value)
Definition: mapmanip:25
tools::rroot::buffer::m_buffer
char * m_buffer
Definition: buffer:624
tools::rroot::buffer::buffer
buffer(std::ostream &a_out, bool a_byte_swap, uint32 a_size, char *a_buffer, uint32 a_klen, bool a_verbose)
Definition: buffer:80
tools::rroot::iro
Definition: iro:19
tools::rroot::ifac::args
std::map< char, void * > args
Definition: ifac:21
tools::rroot::dummy_TXxx_pointer_stream
bool dummy_TXxx_pointer_stream(buffer &a_buffer, ifac &a_fac)
Definition: buffer:631
tools::rroot::buffer::m_map_objs
bool m_map_objs
Definition: buffer:627
tools::rroot::iro::s_cls
virtual const std::string & s_cls() const =0
tools::uint32
unsigned int uint32
Definition: typedefs:71
tools::rroot::buffer::remove_in_map
void remove_in_map(iro *a_obj)
Definition: buffer:276
tools::rroot::fixed_array_stream
bool fixed_array_stream(buffer &a_buffer, int a_n, T *&a_v)
Definition: buffer:712
tools::rroot::buffer::~buffer
virtual ~buffer()
Definition: buffer:96
tools::rroot::rbuf::m_out
std::ostream & m_out
Definition: rbuf:400
tools::rroot::buffer::verbose
bool verbose() const
Definition: buffer:115
tools::cid
unsigned short cid
Definition: cid:9
ifac