ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TGenCollectionStreamer.cxx
Go to the documentation of this file.
1 // @(#)root/io:$Id$
2 // Author: Markus Frank 28/10/04
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 /*
13 \class TGenCollectionStreamer
14 \ingroup IO
15 
16 Streamer around an arbitrary container, which implements basic
17 functionality and iteration.
18 
19 In particular this is used to implement splitting and abstract
20 element access of any container. Access to compiled code is necessary
21 to implement the abstract iteration sequence and functionality like
22 size(), clear(), resize(). resize() may be a void operation.
23 **/
24 
25 #include "TGenCollectionStreamer.h"
26 #include "TClassEdit.h"
27 #include "TError.h"
28 #include "TROOT.h"
29 #include "TStreamerInfo.h"
30 #include "TStreamerElement.h"
31 #include "Riostream.h"
33 
35  : TGenCollectionProxy(copy), fReadBufferFunc(&TGenCollectionStreamer::ReadBufferDefault)
36 {
37  // Build a Streamer for an emulated vector whose type is 'name'.
38 }
39 
41  : TGenCollectionProxy(info, iter_size), fReadBufferFunc(&TGenCollectionStreamer::ReadBufferDefault)
42 {
43  // Build a Streamer for a collection whose type is described by 'collectionClass'.
44 }
45 
46 TGenCollectionStreamer::TGenCollectionStreamer(const ::ROOT::TCollectionProxyInfo &info, TClass *cl)
47  : TGenCollectionProxy(info, cl), fReadBufferFunc(&TGenCollectionStreamer::ReadBufferDefault)
48 {
49  // Build a Streamer for a collection whose type is described by 'collectionClass'.
50 }
51 
53 {
54  // Standard destructor.
55 }
56 
58 {
59  // Virtual copy constructor.
60  if (!fValue.load()) Initialize(kFALSE);
61  return new TGenCollectionStreamer(*this);
62 }
63 
64 template <typename T>
66 
67 template <>
69 {
70  return &itm.boolean;
71 }
72 
73 template <>
75 {
76  return &itm.s_char;
77 }
78 
79 template <>
81 {
82  return &itm.s_short;
83 }
84 
85 template <>
87 {
88  return &itm.s_int;
89 }
90 
91 template <>
93 {
94  return &itm.s_long;
95 }
96 
97 template <>
99 {
100  return &itm.s_longlong;
101 }
102 
103 template <>
105 {
106  return &itm.flt;
107 }
108 
109 template <>
111 {
112  return &itm.dbl;
113 }
114 
115 template <>
117 {
118  return &itm.u_char;
119 }
120 
121 template <>
123 {
124  return &itm.u_short;
125 }
126 
127 template <>
129 {
130  return &itm.u_int;
131 }
132 
133 template <>
135 {
136  return &itm.u_long;
137 }
138 
139 template <>
141 {
142  return &itm.u_longlong;
143 }
144 
145 template <typename From, typename To>
147 {
148  From *r = getaddress<From>( *read );
149  To *w = getaddress<To>( *write );
150  for(int i = 0; i < nElements; ++i) {
151  // getvalue<To>( write[i] ) = (To) getvalue<From>( read[i] );
152  w[i] = (To)r[i];
153  }
154 }
155 
156 template <typename From>
158 {
159  switch(writeType) {
160  case kBool_t:
161  ConvertArray<From,bool>(read,write,nElements);
162  break;
163  case kChar_t:
164  ConvertArray<From,Char_t>(read,write,nElements);
165  break;
166  case kShort_t:
167  ConvertArray<From,Short_t>(read,write,nElements);
168  break;
169  case kInt_t:
170  ConvertArray<From,Int_t>(read,write,nElements);
171  break;
172  case kLong_t:
173  ConvertArray<From,Long64_t>(read,write,nElements);
174  break;
175  case kLong64_t:
176  ConvertArray<From,Long64_t>(read,write,nElements);
177  break;
178  case kFloat_t:
179  ConvertArray<From,Float_t>(read,write,nElements);
180  break;
181  case kFloat16_t:
182  ConvertArray<From,Float16_t>(read,write,nElements);
183  break;
184  case kDouble_t:
185  ConvertArray<From,Double_t>(read,write,nElements);
186  break;
188  ConvertArray<From,bool>(read,write,nElements);
189  break;
190  case kUChar_t:
191  ConvertArray<From,UChar_t>(read,write,nElements);
192  break;
193  case kUShort_t:
194  ConvertArray<From,UShort_t>(read,write,nElements);
195  break;
196  case kUInt_t:
197  ConvertArray<From,UInt_t>(read,write,nElements);
198  break;
199  case kULong_t:
200  ConvertArray<From,ULong_t>(read,write,nElements);
201  break;
202  case kULong64_t:
203  ConvertArray<From,ULong64_t>(read,write,nElements);
204  break;
205  case kDouble32_t:
206  ConvertArray<From,Double32_t>(read,write,nElements);
207  break;
208  case kchar:
209  case kNoType_t:
210  case kOther_t:
211  Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", writeType);
212  }
213 }
214 
215 void TGenCollectionStreamer::ReadPrimitives(int nElements, TBuffer &b, const TClass *onFileClass)
216 {
217  // Primitive input streamer.
218  size_t len = fValDiff * nElements;
219  char buffer[8096];
220  Bool_t feed = false;
221  void* memory = 0;
222  StreamHelper* itmstore = 0;
223  StreamHelper* itmconv = 0;
224  fEnv->fSize = nElements;
225  switch (fSTL_type) {
226  case ROOT::kSTLvector:
227  if (fVal->fKind != EDataType(kBOOL_t)) {
229  fEnv->fIdx = 0;
230 
232  iterators.CreateIterators(fEnv->fObject);
233  itmstore = (StreamHelper*)iterators.fBegin;
234  fEnv->fStart = itmstore;
235  break;
236  }
237  default:
238  feed = true;
239  itmstore = (StreamHelper*)(len < sizeof(buffer) ? buffer : memory =::operator new(len));
240  break;
241  }
242  fEnv->fStart = itmstore;
243 
244  StreamHelper *itmread;
245  int readkind;
246  if (onFileClass) {
247  readkind = onFileClass->GetCollectionProxy()->GetType();
248  itmconv = (StreamHelper*) ::operator new( nElements * onFileClass->GetCollectionProxy()->GetIncrement() );
249  itmread = itmconv;
250  } else {
251  itmread = itmstore;
252  readkind = fVal->fKind;
253  }
254  switch (readkind) {
255  case kBool_t:
256  b.ReadFastArray(&itmread->boolean , nElements);
257  break;
258  case kChar_t:
259  b.ReadFastArray(&itmread->s_char , nElements);
260  break;
261  case kShort_t:
262  b.ReadFastArray(&itmread->s_short , nElements);
263  break;
264  case kInt_t:
265  b.ReadFastArray(&itmread->s_int , nElements);
266  break;
267  case kLong_t:
268  b.ReadFastArray(&itmread->s_long , nElements);
269  break;
270  case kLong64_t:
271  b.ReadFastArray(&itmread->s_longlong, nElements);
272  break;
273  case kFloat_t:
274  b.ReadFastArray(&itmread->flt , nElements);
275  break;
276  case kFloat16_t:
277  b.ReadFastArrayFloat16(&itmread->flt, nElements);
278  break;
279  case kDouble_t:
280  b.ReadFastArray(&itmread->dbl , nElements);
281  break;
282  case EDataType(kBOOL_t):
283  b.ReadFastArray(&itmread->boolean , nElements);
284  break;
285  case kUChar_t:
286  b.ReadFastArray(&itmread->u_char , nElements);
287  break;
288  case kUShort_t:
289  b.ReadFastArray(&itmread->u_short , nElements);
290  break;
291  case kUInt_t:
292  b.ReadFastArray(&itmread->u_int , nElements);
293  break;
294  case kULong_t:
295  b.ReadFastArray(&itmread->u_long , nElements);
296  break;
297  case kULong64_t:
298  b.ReadFastArray(&itmread->u_longlong, nElements);
299  break;
300  case kDouble32_t:
301  b.ReadFastArrayDouble32(&itmread->dbl, nElements);
302  break;
303  case kchar:
304  case kNoType_t:
305  case kOther_t:
306  Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", readkind);
307  }
308  if (onFileClass) {
309  switch (readkind) {
310  case kBool_t:
311  DispatchConvertArray<bool>(fVal->fKind, itmread, itmstore, nElements);
312  break;
313  case kChar_t:
314  DispatchConvertArray<Char_t>(fVal->fKind, itmread, itmstore, nElements);
315  break;
316  case kShort_t:
317  DispatchConvertArray<Short_t>(fVal->fKind, itmread, itmstore, nElements);
318  break;
319  case kInt_t:
320  DispatchConvertArray<Int_t>(fVal->fKind, itmread, itmstore, nElements);
321  break;
322  case kLong_t:
323  DispatchConvertArray<Long_t>(fVal->fKind, itmread, itmstore, nElements);
324  break;
325  case kLong64_t:
326  DispatchConvertArray<Long64_t>(fVal->fKind, itmread, itmstore, nElements);
327  break;
328  case kFloat_t:
329  DispatchConvertArray<Float_t>(fVal->fKind, itmread, itmstore, nElements);
330  break;
331  case kFloat16_t:
332  DispatchConvertArray<Float16_t>(fVal->fKind, itmread, itmstore, nElements);
333  break;
334  case kDouble_t:
335  DispatchConvertArray<Double_t>(fVal->fKind, itmread, itmstore, nElements);
336  break;
337  case EDataType(kBOOL_t):
338  DispatchConvertArray<bool>(fVal->fKind, itmread, itmstore, nElements);
339  break;
340  case kUChar_t:
341  DispatchConvertArray<UChar_t>(fVal->fKind, itmread, itmstore, nElements);
342  break;
343  case kUShort_t:
344  DispatchConvertArray<UShort_t>(fVal->fKind, itmread, itmstore, nElements);
345  break;
346  case kUInt_t:
347  DispatchConvertArray<UInt_t>(fVal->fKind, itmread, itmstore, nElements);
348  break;
349  case kULong_t:
350  DispatchConvertArray<ULong_t>(fVal->fKind, itmread, itmstore, nElements);
351  break;
352  case kULong64_t:
353  DispatchConvertArray<ULong64_t>(fVal->fKind, itmread, itmstore, nElements);
354  break;
355  case kDouble32_t:
356  DispatchConvertArray<Double_t>(fVal->fKind, itmread, itmstore, nElements);
357  break;
358  case kchar:
359  case kNoType_t:
360  case kOther_t:
361  Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", readkind);
362  }
363  ::operator delete((void*)itmconv);
364  }
365  if (feed) { // need to feed in data...
366  fEnv->fStart = fFeed(itmstore,fEnv->fObject,fEnv->fSize);
367  if (memory) {
368  ::operator delete(memory);
369  }
370  }
371 }
372 
373 void TGenCollectionStreamer::ReadObjects(int nElements, TBuffer &b, const TClass *onFileClass)
374 {
375  // Object input streamer.
376  Bool_t vsn3 = b.GetInfo() && b.GetInfo()->GetOldVersion() <= 3;
377  size_t len = fValDiff * nElements;
378  StreamHelper* itm = 0;
379  char buffer[8096];
380  void* memory = 0;
381 
382  TClass* onFileValClass = (onFileClass ? onFileClass->GetCollectionProxy()->GetValueClass() : 0);
383 
384  fEnv->fSize = nElements;
385  switch (fSTL_type) {
386  // Simple case: contiguous memory. get address of first, then jump.
387  case ROOT::kSTLvector:
388 #define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
390  fEnv->fIdx = 0;
391 
392  {
394  iterators.CreateIterators(fEnv->fObject);
395  itm = (StreamHelper*)iterators.fBegin;
396  }
397  fEnv->fStart = itm;
398  switch (fVal->fCase) {
399  case kIsClass:
400  DOLOOP(b.StreamObject(i, fVal->fType, onFileValClass ));
401  case EProperty(kBIT_ISSTRING):
402  DOLOOP(i->read_std_string(b));
403  case EProperty(kIsPointer | kIsClass):
404  DOLOOP(i->set(b.ReadObjectAny(fVal->fType)));
406  DOLOOP(i->read_std_string_pointer(b));
408  DOLOOP(i->read_tstring_pointer(vsn3, b));
409  }
410 #undef DOLOOP
411  break;
412 
413  // No contiguous memory, but resize is possible
414  // Hence accessing objects using At(i) should be not too much an overhead
415  case ROOT::kSTLlist:
417  case ROOT::kSTLdeque:
418 #define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)TGenCollectionProxy::At(idx); { x ;} ++idx;} break;}
420  fEnv->fIdx = 0;
421  fEnv->fStart = 0;
422  switch (fVal->fCase) {
423  case kIsClass:
424  DOLOOP(b.StreamObject(i, fVal->fType, onFileValClass));
425  case kBIT_ISSTRING:
426  DOLOOP(i->read_std_string(b));
427  case kIsPointer | kIsClass:
428  DOLOOP(i->set(b.ReadObjectAny(fVal->fType)));
429  case kIsPointer | kBIT_ISSTRING:
430  DOLOOP(i->read_std_string_pointer(b));
432  DOLOOP(i->read_tstring_pointer(vsn3, b));
433  }
434 #undef DOLOOP
435  break;
436 
437  // Rather troublesome case: Objects can only be fed into the container
438  // Once they are created. Need to take memory from stack or heap.
439  case ROOT::kSTLmultiset:
440  case ROOT::kSTLset:
443 #define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;}}
444  fEnv->fStart = itm = (StreamHelper*)(len < sizeof(buffer) ? buffer : memory =::operator new(len));
445  fConstruct(itm,nElements);
446  switch (fVal->fCase) {
447  case kIsClass:
448  DOLOOP(b.StreamObject(i, fVal->fType, onFileValClass));
451  break;
452  case EProperty(kBIT_ISSTRING):
453  DOLOOP(i->read_std_string(b))
456  break;
457  case EProperty(kIsPointer | kIsClass):
458  DOLOOP(i->set(b.ReadObjectAny(fVal->fType)));
460  break;
462  DOLOOP(i->read_std_string_pointer(b))
464  break;
466  DOLOOP(i->read_tstring_pointer(vsn3, b));
468  break;
469  }
470 #undef DOLOOP
471  break;
472  default:
473  break;
474  }
475  if (memory) {
476  ::operator delete(memory);
477  }
478 }
479 
481 {
482  // Input streamer to convert a map into another collection
483 
484  Bool_t vsn3 = b.GetInfo() && b.GetInfo()->GetOldVersion() <= 3;
485  size_t len = fValDiff * nElements;
486  StreamHelper* itm = 0;
487  char buffer[8096];
488  void* memory = 0;
489 
491  R__ASSERT(pinfo);
493 
494  int nested = 0;
495  std::vector<std::string> inside;
496  TClassEdit::GetSplit(pinfo->GetName(), inside, nested);
497  Value first(inside[1],kFALSE);
498  Value second(inside[2],kFALSE);
499  fValOffset = ((TStreamerElement*)pinfo->GetElements()->At(1))->GetOffset();
500 
501  fEnv->fSize = nElements;
502  switch (fSTL_type) {
503  // Simple case: contiguous memory. get address of first, then jump.
504  case ROOT::kSTLvector:
505 #define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
507  fEnv->fIdx = 0;
508 
509  {
511  iterators.CreateIterators(fEnv->fObject);
512  itm = (StreamHelper*)iterators.fBegin;
513  }
514  fEnv->fStart = itm;
515  switch (fVal->fCase) {
516  case kIsClass:
517  DOLOOP(
518  ReadMapHelper(i, &first, vsn3, b);
519  ReadMapHelper((StreamHelper*)(((char*)i) + fValOffset), &second, vsn3, b)
520  );
521  }
522 #undef DOLOOP
523  break;
524 
525  // No contiguous memory, but resize is possible
526  // Hence accessing objects using At(i) should be not too much an overhead
527  case ROOT::kSTLlist:
529  case ROOT::kSTLdeque:
530 #define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)TGenCollectionProxy::At(idx); { x ;} ++idx;} break;}
532  fEnv->fIdx = 0;
533  {
535  iterators.CreateIterators(fEnv->fObject);
536  fEnv->fStart = iterators.fBegin;
537  }
538  switch (fVal->fCase) {
539  case kIsClass:
540  DOLOOP(
541  char **where = (char**)(void*) & i;
542  b.ApplySequence(*(pinfo->GetReadObjectWiseActions()), where);
543  );
544  }
545 #undef DOLOOP
546  break;
547 
548  // Rather troublesome case: Objects can only be fed into the container
549  // Once they are created. Need to take memory from stack or heap.
550  case ROOT::kSTLmultiset:
551  case ROOT::kSTLset:
554 #define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;}}
555  fEnv->fStart = itm = (StreamHelper*)(len < sizeof(buffer) ? buffer : memory =::operator new(len));
556  fConstruct(itm,nElements);
557  switch (fVal->fCase) {
558  case kIsClass:
559  DOLOOP(
560  char **where = (char**)(void*) & i;
561  b.ApplySequence(*(pinfo->GetReadObjectWiseActions()), where);
562  );
565  break;
566  }
567 #undef DOLOOP
568  break;
569  default:
570  break;
571  }
572  if (memory) {
573  ::operator delete(memory);
574  }
575 }
576 
577 
579 {
580  // helper class to read std::map
581 
582  float f;
583 
584  switch (v->fCase) {
585  case kIsFundamental: // Only handle primitives this way
586  case kIsEnum:
587  switch (int(v->fKind)) {
588  case kBool_t:
589  b >> i->boolean;
590  break;
591  case kChar_t:
592  b >> i->s_char;
593  break;
594  case kShort_t:
595  b >> i->s_short;
596  break;
597  case kInt_t:
598  b >> i->s_int;
599  break;
600  case kLong_t:
601  b >> i->s_long;
602  break;
603  case kLong64_t:
604  b >> i->s_longlong;
605  break;
606  case kFloat_t:
607  b >> i->flt;
608  break;
609  case kFloat16_t:
610  b >> f;
611  i->flt = float(f);
612  break;
613  case kDouble_t:
614  b >> i->dbl;
615  break;
616  case EDataType(kBOOL_t):
617  b >> i->boolean;
618  break;
619  case kUChar_t:
620  b >> i->u_char;
621  break;
622  case kUShort_t:
623  b >> i->u_short;
624  break;
625  case kUInt_t:
626  b >> i->u_int;
627  break;
628  case kULong_t:
629  b >> i->u_long;
630  break;
631  case kULong64_t:
632  b >> i->u_longlong;
633  break;
634  case kDouble32_t:
635  b >> f;
636  i->dbl = double(f);
637  break;
638  case kchar:
639  case kNoType_t:
640  case kOther_t:
641  Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", v->fKind);
642  }
643  break;
644  case kIsClass:
645  b.StreamObject(i, v->fType);
646  break;
647  case kBIT_ISSTRING:
648  i->read_std_string(b);
649  break;
650  case kIsPointer | kIsClass:
651  i->set(b.ReadObjectAny(v->fType));
652  break;
653  case kIsPointer | kBIT_ISSTRING:
655  break;
657  i->read_tstring_pointer(vsn3, b);
658  break;
659  }
660 }
661 
662 template <typename To>
663 To readOneValue(TBuffer &b, int readtype) {
666  switch (readtype) {
667  case kBool_t:
668  b >> i->boolean;
669  return (To)i->boolean;
670  break;
671  case kChar_t:
672  b >> i->s_char;
673  return (To)i->s_char;
674  break;
675  case kShort_t:
676  b >> i->s_short;
677  return (To)i->s_short;
678  break;
679  case kInt_t:
680  b >> i->s_int;
681  return (To)i->s_int;
682  break;
683  case kLong_t:
684  b >> i->s_long;
685  return (To)i->s_long;
686  break;
687  case kLong64_t:
688  b >> i->s_longlong;
689  return (To)i->s_longlong;
690  break;
691  case kFloat_t:
692  b >> i->flt;
693  return (To)i->flt;
694  break;
695  case kFloat16_t:
696  b >> i->flt;
697  return (To)i->flt;
698  break;
699  case kDouble_t:
700  b >> i->dbl;
701  return (To)i->dbl;
702  break;
704  b >> i->boolean;
705  return (To)i->boolean;
706  break;
707  case kUChar_t:
708  b >> i->u_char;
709  return (To)i->u_char;
710  break;
711  case kUShort_t:
712  b >> i->u_short;
713  return (To)i->u_short;
714  break;
715  case kUInt_t:
716  b >> i->u_int;
717  return (To)i->u_int;
718  break;
719  case kULong_t:
720  b >> i->u_long;
721  return (To)i->u_long;
722  break;
723  case kULong64_t:
724  b >> i->u_longlong;
725  return (To)i->u_longlong;
726  break;
727  case kDouble32_t: {
728  float f;
729  b >> f;
730  i->dbl = double(f);
731  return (To)i->dbl;
732  break;
733  }
734  case kchar:
735  case kNoType_t:
736  case kOther_t:
737  Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", readtype);
738  }
739  return 0;
740 }
741 
742 
743 void TGenCollectionStreamer::ReadMap(int nElements, TBuffer &b, const TClass *onFileClass)
744 {
745  // Map input streamer.
746  Bool_t vsn3 = b.GetInfo() && b.GetInfo()->GetOldVersion() <= 3;
747  size_t len = fValDiff * nElements;
748  Value *v;
749  char buffer[8096], *addr, *temp;
750  void* memory = 0;
751  StreamHelper* i;
752  float f;
753  fEnv->fSize = nElements;
754  fEnv->fStart = (len < sizeof(buffer) ? buffer : memory =::operator new(len));
755  addr = temp = (char*)fEnv->fStart;
756  fConstruct(addr,nElements);
757 
758  int onFileValueKind[2];
759  if (onFileClass) {
760  TClass *onFileValueClass = onFileClass->GetCollectionProxy()->GetValueClass();
761  TVirtualStreamerInfo *sourceInfo = onFileValueClass->GetStreamerInfo();
762  onFileValueKind[0] = ((TStreamerElement*)sourceInfo->GetElements()->At(0))->GetType();
763  onFileValueKind[1] = ((TStreamerElement*)sourceInfo->GetElements()->At(1))->GetType();
764  }
765  for (int loop, idx = 0; idx < nElements; ++idx) {
766  addr = temp + fValDiff * idx;
767  v = fKey;
768  for (loop = 0; loop < 2; loop++) {
769  i = (StreamHelper*)addr;
770  switch (v->fCase) {
771  case kIsFundamental: // Only handle primitives this way
772  case kIsEnum:
773  if (onFileClass) {
774  int readtype = (int)(onFileValueKind[loop]);
775  switch (int(v->fKind)) {
776  case kBool_t:
777  i->boolean = readOneValue<bool>(b,readtype);
778  break;
779  case kChar_t:
780  i->s_char = readOneValue<Char_t>(b,readtype);
781  break;
782  case kShort_t:
783  i->s_short = readOneValue<Short_t>(b,readtype);
784  break;
785  case kInt_t:
786  i->s_int = readOneValue<Int_t>(b,readtype);
787  break;
788  case kLong_t:
789  i->s_long = readOneValue<Long_t>(b,readtype);
790  break;
791  case kLong64_t:
792  i->s_longlong = readOneValue<Long64_t>(b,readtype);
793  break;
794  case kFloat_t:
795  i->flt = readOneValue<Float_t>(b,readtype);
796  break;
797  case kFloat16_t:
798  i->flt = readOneValue<Float16_t>(b,readtype);
799  break;
800  case kDouble_t:
801  i->dbl = readOneValue<Double_t>(b,readtype);
802  break;
803  case EDataType(kBOOL_t):
804  i->boolean = readOneValue<bool>(b,readtype);
805  break;
806  case kUChar_t:
807  i->u_char = readOneValue<UChar_t>(b,readtype);
808  break;
809  case kUShort_t:
810  i->u_short = readOneValue<UShort_t>(b,readtype);
811  break;
812  case kUInt_t:
813  i->u_int = readOneValue<UInt_t>(b,readtype);
814  break;
815  case kULong_t:
816  i->u_long = readOneValue<ULong_t>(b,readtype);
817  break;
818  case kULong64_t:
819  i->u_longlong = readOneValue<ULong64_t>(b,readtype);
820  break;
821  case kDouble32_t:
822  i->dbl = readOneValue<Double32_t>(b,readtype);
823  break;
824  case kchar:
825  case kNoType_t:
826  case kOther_t:
827  Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", v->fKind);
828  }
829  } else {
830  switch (int(v->fKind)) {
831  case kBool_t:
832  b >> i->boolean;
833  break;
834  case kChar_t:
835  b >> i->s_char;
836  break;
837  case kShort_t:
838  b >> i->s_short;
839  break;
840  case kInt_t:
841  b >> i->s_int;
842  break;
843  case kLong_t:
844  b >> i->s_long;
845  break;
846  case kLong64_t:
847  b >> i->s_longlong;
848  break;
849  case kFloat_t:
850  b >> i->flt;
851  break;
852  case kFloat16_t:
853  b >> f;
854  i->flt = float(f);
855  break;
856  case kDouble_t:
857  b >> i->dbl;
858  break;
859  case EDataType(kBOOL_t):
860  b >> i->boolean;
861  break;
862  case kUChar_t:
863  b >> i->u_char;
864  break;
865  case kUShort_t:
866  b >> i->u_short;
867  break;
868  case kUInt_t:
869  b >> i->u_int;
870  break;
871  case kULong_t:
872  b >> i->u_long;
873  break;
874  case kULong64_t:
875  b >> i->u_longlong;
876  break;
877  case kDouble32_t:
878  b >> f;
879  i->dbl = double(f);
880  break;
881  case kchar:
882  case kNoType_t:
883  case kOther_t:
884  Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", v->fKind);
885  }
886  }
887  break;
888  case kIsClass:
889  b.StreamObject(i, v->fType);
890  break;
891  case EProperty(kBIT_ISSTRING):
892  i->read_std_string(b);
893  break;
894  case EProperty(kIsPointer | kIsClass):
895  i->set(b.ReadObjectAny(v->fType));
896  break;
899  break;
901  i->read_tstring_pointer(vsn3, b);
902  break;
903  }
904  v = fVal;
905  addr += fValOffset;
906  }
907  }
910  if (memory) {
911  ::operator delete(memory);
912  }
913 }
914 
916 {
917  // Primitive output streamer.
918  size_t len = fValDiff * nElements;
919  char buffer[8192];
920  void* memory = 0;
921  StreamHelper* itm = 0;
922  switch (fSTL_type) {
923  case ROOT::kSTLvector:
924  if (fVal->fKind != EDataType(kBOOL_t)) {
925  itm = (StreamHelper*)(fEnv->fStart = fFirst.invoke(fEnv));
926  break;
927  }
928  default:
929  fEnv->fStart = itm = (StreamHelper*)(len < sizeof(buffer) ? buffer : memory =::operator new(len));
930  fCollect(fEnv->fObject,itm);
931  break;
932  }
933  switch (int(fVal->fKind)) {
934  case kBool_t:
935  b.WriteFastArray(&itm->boolean , nElements);
936  break;
937  case kChar_t:
938  b.WriteFastArray(&itm->s_char , nElements);
939  break;
940  case kShort_t:
941  b.WriteFastArray(&itm->s_short , nElements);
942  break;
943  case kInt_t:
944  b.WriteFastArray(&itm->s_int , nElements);
945  break;
946  case kLong_t:
947  b.WriteFastArray(&itm->s_long , nElements);
948  break;
949  case kLong64_t:
950  b.WriteFastArray(&itm->s_longlong, nElements);
951  break;
952  case kFloat_t:
953  b.WriteFastArray(&itm->flt , nElements);
954  break;
955  case kFloat16_t:
956  b.WriteFastArrayFloat16(&itm->flt, nElements);
957  break;
958  case kDouble_t:
959  b.WriteFastArray(&itm->dbl , nElements);
960  break;
961  case EDataType(kBOOL_t):
962  b.WriteFastArray(&itm->boolean , nElements);
963  break;
964  case kUChar_t:
965  b.WriteFastArray(&itm->u_char , nElements);
966  break;
967  case kUShort_t:
968  b.WriteFastArray(&itm->u_short , nElements);
969  break;
970  case kUInt_t:
971  b.WriteFastArray(&itm->u_int , nElements);
972  break;
973  case kULong_t:
974  b.WriteFastArray(&itm->u_long , nElements);
975  break;
976  case kULong64_t:
977  b.WriteFastArray(&itm->u_longlong, nElements);
978  break;
979  case kDouble32_t:
980  b.WriteFastArrayDouble32(&itm->dbl, nElements);
981  break;
982  case kchar:
983  case kNoType_t:
984  case kOther_t:
985  Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", fVal->fKind);
986  }
987  if (memory) {
988  ::operator delete(memory);
989  }
990 }
991 
993 {
994  // Object output streamer.
995  StreamHelper* itm = 0;
996  switch (fSTL_type) {
997  // Simple case: contiguous memory. get address of first, then jump.
998  case ROOT::kSTLvector:
999 #define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
1000  itm = (StreamHelper*)fFirst.invoke(fEnv);
1001  switch (fVal->fCase) {
1002  case kIsClass:
1003  DOLOOP(b.StreamObject(i, fVal->fType));
1004  break;
1005  case kBIT_ISSTRING:
1006  DOLOOP(TString(i->c_str()).Streamer(b));
1007  break;
1008  case kIsPointer | kIsClass:
1009  DOLOOP(b.WriteObjectAny(i->ptr(), fVal->fType));
1010  break;
1011  case kBIT_ISSTRING | kIsPointer:
1012  DOLOOP(i->write_std_string_pointer(b));
1013  break;
1015  DOLOOP(i->write_tstring_pointer(b));
1016  break;
1017  }
1018 #undef DOLOOP
1019  break;
1020 
1021  // No contiguous memory, but resize is possible
1022  // Hence accessing objects using At(i) should be not too much an overhead
1023  case ROOT::kSTLlist:
1024  case ROOT::kSTLforwardlist:
1025  case ROOT::kSTLdeque:
1026  case ROOT::kSTLmultiset:
1027  case ROOT::kSTLset:
1030 #define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)TGenCollectionProxy::At(idx); { x ;} ++idx;} break;}
1031  switch (fVal->fCase) {
1032  case kIsClass:
1033  DOLOOP(b.StreamObject(i, fVal->fType));
1034  case kBIT_ISSTRING:
1035  DOLOOP(TString(i->c_str()).Streamer(b));
1036  case kIsPointer | kIsClass:
1037  DOLOOP(b.WriteObjectAny(i->ptr(), fVal->fType));
1038  case kBIT_ISSTRING | kIsPointer:
1039  DOLOOP(i->write_std_string_pointer(b));
1041  DOLOOP(i->write_tstring_pointer(b));
1042  }
1043 #undef DOLOOP
1044  break;
1045  default:
1046  break;
1047  }
1048 }
1049 
1051 {
1052  // Map output streamer
1053  StreamHelper* i;
1054  Value *v;
1055 
1056  for (int loop, idx = 0; idx < nElements; ++idx) {
1057  char* addr = (char*)TGenCollectionProxy::At(idx);
1058  v = fKey;
1059  for (loop = 0; loop < 2; ++loop) {
1060  i = (StreamHelper*)addr;
1061  switch (v->fCase) {
1062  case kIsFundamental: // Only handle primitives this way
1063  case kIsEnum:
1064  switch (int(v->fKind)) {
1065  case kBool_t:
1066  b << i->boolean;
1067  break;
1068  case kChar_t:
1069  b << i->s_char;
1070  break;
1071  case kShort_t:
1072  b << i->s_short;
1073  break;
1074  case kInt_t:
1075  b << i->s_int;
1076  break;
1077  case kLong_t:
1078  b << i->s_long;
1079  break;
1080  case kLong64_t:
1081  b << i->s_longlong;
1082  break;
1083  case kFloat_t:
1084  b << i->flt;
1085  break;
1086  case kFloat16_t:
1087  b << float(i->flt);
1088  break;
1089  case kDouble_t:
1090  b << i->dbl;
1091  break;
1092  case EDataType(kBOOL_t):
1093  b << i->boolean;
1094  break;
1095  case kUChar_t:
1096  b << i->u_char;
1097  break;
1098  case kUShort_t:
1099  b << i->u_short;
1100  break;
1101  case kUInt_t:
1102  b << i->u_int;
1103  break;
1104  case kULong_t:
1105  b << i->u_long;
1106  break;
1107  case kULong64_t:
1108  b << i->u_longlong;
1109  break;
1110  case kDouble32_t:
1111  b << float(i->dbl);
1112  break;
1113  case kchar:
1114  case kNoType_t:
1115  case kOther_t:
1116  Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", v->fKind);
1117  }
1118  break;
1119  case kIsClass:
1120  b.StreamObject(i, v->fType);
1121  break;
1122  case kBIT_ISSTRING:
1123  TString(i->c_str()).Streamer(b);
1124  break;
1125  case kIsPointer | kIsClass:
1126  b.WriteObjectAny(i->ptr(), v->fType);
1127  break;
1128  case kBIT_ISSTRING | kIsPointer:
1130  break;
1132  i->write_tstring_pointer(b);
1133  break;
1134  }
1135  addr += fValOffset;
1136  v = fVal;
1137  }
1138  }
1139 }
1140 
1141 template <typename From, typename To>
1143 {
1144  From *temp = new From[nElements];
1145  b.ReadFastArray(temp, nElements);
1146  std::vector<To> *const vec = (std::vector<To>*)(obj);
1147  for(Int_t ind = 0; ind < nElements; ++ind) {
1148  (*vec)[ind] = (To)temp[ind];
1149  }
1150  delete [] temp;
1151 }
1152 
1153 template <typename To>
1155 {
1156  Float16_t *temp = new Float16_t[nElements];
1157  b.ReadFastArrayFloat16(temp, nElements);
1158  std::vector<To> *const vec = (std::vector<To>*)(obj);
1159  for(Int_t ind = 0; ind < nElements; ++ind) {
1160  (*vec)[ind] = (To)temp[ind];
1161  }
1162  delete [] temp;
1163 }
1164 
1165 template <typename To>
1167 {
1168  Double32_t *temp = new Double32_t[nElements];
1169  b.ReadFastArrayDouble32(temp, nElements);
1170  std::vector<To> *const vec = (std::vector<To>*)(obj);
1171  for(Int_t ind = 0; ind < nElements; ++ind) {
1172  (*vec)[ind] = (To)temp[ind];
1173  }
1174  delete [] temp;
1175 }
1176 
1177 template <typename To>
1179 {
1180  switch ((TStreamerInfo::EReadWrite)onFileProxy->GetType()) {
1181  case TStreamerInfo::kBool: ConvertBufferVectorPrimitives<Bool_t ,To>(b,obj,nElements); break;
1182  case TStreamerInfo::kChar: ConvertBufferVectorPrimitives<Char_t ,To>(b,obj,nElements); break;
1183  case TStreamerInfo::kShort: ConvertBufferVectorPrimitives<Short_t ,To>(b,obj,nElements); break;
1184  case TStreamerInfo::kInt: ConvertBufferVectorPrimitives<Int_t ,To>(b,obj,nElements); break;
1185  case TStreamerInfo::kLong: ConvertBufferVectorPrimitives<Long_t ,To>(b,obj,nElements); break;
1186  case TStreamerInfo::kLong64: ConvertBufferVectorPrimitives<Long64_t ,To>(b,obj,nElements); break;
1187  case TStreamerInfo::kFloat: ConvertBufferVectorPrimitives<Float_t ,To>(b,obj,nElements); break;
1188  case TStreamerInfo::kFloat16: ConvertBufferVectorPrimitives<Float16_t ,To>(b,obj,nElements); break;
1189  case TStreamerInfo::kDouble: ConvertBufferVectorPrimitives<Double_t ,To>(b,obj,nElements); break;
1190  case TStreamerInfo::kDouble32: ConvertBufferVectorPrimitives<Double32_t,To>(b,obj,nElements); break;
1191  case TStreamerInfo::kUChar: ConvertBufferVectorPrimitives<UChar_t ,To>(b,obj,nElements); break;
1192  case TStreamerInfo::kUShort: ConvertBufferVectorPrimitives<UShort_t ,To>(b,obj,nElements); break;
1193  case TStreamerInfo::kUInt: ConvertBufferVectorPrimitives<UInt_t ,To>(b,obj,nElements); break;
1194  case TStreamerInfo::kULong: ConvertBufferVectorPrimitives<ULong_t ,To>(b,obj,nElements); break;
1195  case TStreamerInfo::kULong64: ConvertBufferVectorPrimitives<ULong64_t ,To>(b,obj,nElements); break;
1196  default: break;
1197  }
1198 }
1199 
1200 template <typename basictype>
1202 {
1203  int nElements = 0;
1204  b >> nElements;
1205  fResize(obj,nElements);
1206 
1207  if (onFileClass) {
1208  DispatchConvertBufferVectorPrimitives<basictype>(b,obj,nElements,onFileClass->GetCollectionProxy());
1209  } else {
1211  iterators.CreateIterators(obj);
1212  b.ReadFastArray((basictype*)iterators.fBegin, nElements);
1213  }
1214 }
1215 
1217 {
1218  int nElements = 0;
1219  b >> nElements;
1220  fResize(obj,nElements);
1221 
1222  if (onFileClass) {
1223  DispatchConvertBufferVectorPrimitives<Float16_t>(b,obj,nElements,onFileClass->GetCollectionProxy());
1224  } else {
1226  iterators.CreateIterators(obj);
1227  b.ReadFastArrayFloat16((Float16_t*)iterators.fBegin, nElements);
1228  }
1229 }
1230 
1232 {
1233  int nElements = 0;
1234  b >> nElements;
1235  fResize(obj,nElements);
1236 
1237  if (onFileClass) {
1238  DispatchConvertBufferVectorPrimitives<Double32_t>(b,obj,nElements,onFileClass->GetCollectionProxy());
1239  } else {
1241  iterators.CreateIterators(obj);
1242  b.ReadFastArrayDouble32((Double32_t*)iterators.fBegin, nElements);
1243  }
1244 }
1245 
1246 
1247 
1248 void TGenCollectionStreamer::ReadBuffer(TBuffer &b, void *obj, const TClass *onFileClass)
1249 {
1250  // Call the specialized function. The first time this call ReadBufferDefault which
1251  // actually set to fReadBufferFunc to the 'right' specialized version.
1252 
1253  (this->*fReadBufferFunc)(b,obj,onFileClass);
1254 }
1255 
1257 {
1258  // Call the specialized function. The first time this call ReadBufferDefault which
1259  // actually set to fReadBufferFunc to the 'right' specialized version.
1260 
1261  (this->*fReadBufferFunc)(b,obj,0);
1262 }
1263 
1265 {
1266 
1268 
1269  // We will need this later, so let's make sure it is initialized.
1270  if ( !fValue.load() ) InitializeEx(kFALSE);
1271  if (!GetFunctionCreateIterators()) {
1272  Fatal("TGenCollectionStreamer::ReadBufferDefault","No CreateIterators function for %s",fName.c_str());
1273  }
1275  {
1276  // Only handle primitives this way
1277  switch (int(fVal->fKind)) {
1278  case kBool_t:
1279  // Nothing use generic for now
1280  break;
1281  case kChar_t:
1282  fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Char_t>;
1283  break;
1284  case kShort_t:
1285  fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Short_t>;
1286  break;
1287  case kInt_t:
1288  fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Int_t>;
1289  break;
1290  case kLong_t:
1291  fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Long_t>;
1292  break;
1293  case kLong64_t:
1294  fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Long64_t>;
1295  break;
1296  case kFloat_t:
1297  fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Float_t>;
1298  break;
1299  case kFloat16_t:
1301  break;
1302  case kDouble_t:
1303  fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Double_t>;
1304  break;
1305 // case EDataType_t(kBOOL_t):
1306 // fReadBufferFunc = &ReadBufferVectorPrimitives<>;
1307 // break;
1308  case kUChar_t:
1309  fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<UChar_t>;
1310  break;
1311  case kUShort_t:
1312  fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<UShort_t>;
1313  break;
1314  case kUInt_t:
1315  fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<UInt_t>;
1316  break;
1317  case kULong_t:
1318  fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<ULong_t>;
1319  break;
1320  case kULong64_t:
1321  fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<ULong64_t>;
1322  break;
1323  case kDouble32_t:
1325  break;
1326  case kchar:
1327  case kNoType_t:
1328  case kOther_t:
1329  // Nothing use the generic for now
1330  break;
1331  }
1332  }
1333  (this->*fReadBufferFunc)(b,obj,onFileClass);
1334 }
1335 
1337 {
1338  TVirtualCollectionProxy::TPushPop env(this, obj);
1339 
1340  int nElements = 0;
1341  b >> nElements;
1342 
1343  if (nElements == 0) {
1344  if (obj) {
1345  TGenCollectionProxy::Clear("force");
1346  }
1347  } else if (nElements > 0) {
1348  switch (fSTL_type) {
1349  case ROOT::kSTLbitset:
1350  if (obj) {
1351  if (fProperties & kNeedDelete) {
1352  TGenCollectionProxy::Clear("force");
1353  } else {
1354  fClear.invoke(fEnv);
1355  }
1356  }
1357  ReadPrimitives(nElements, b, onFileClass);
1358  return;
1359  case ROOT::kSTLvector:
1360  if (obj) {
1361  if (fProperties & kNeedDelete) {
1362  TGenCollectionProxy::Clear("force");
1363  } // a resize will be called in ReadPrimitives/ReadObjects.
1364  else if (fVal->fKind == EDataType(kBOOL_t)) {
1365  fClear.invoke(fEnv);
1366  }
1367  }
1368  switch (fVal->fCase) {
1369  case kIsFundamental: // Only handle primitives this way
1370  case kIsEnum:
1371  ReadPrimitives(nElements, b, onFileClass);
1372  return;
1373  default:
1374  ReadObjects(nElements, b, onFileClass);
1375  return;
1376  }
1377  break;
1378  case ROOT::kSTLlist:
1379  case ROOT::kSTLforwardlist:
1380  case ROOT::kSTLdeque:
1381  case ROOT::kSTLmultiset:
1382  case ROOT::kSTLset:
1385  if (obj) {
1386  if (fProperties & kNeedDelete) {
1387  TGenCollectionProxy::Clear("force");
1388  } else {
1389  fClear.invoke(fEnv);
1390  }
1391  }
1392  switch (fVal->fCase) {
1393  case kIsFundamental: // Only handle primitives this way
1394  case kIsEnum:
1395  ReadPrimitives(nElements, b, onFileClass);
1396  return;
1397  default:
1398  ReadObjects(nElements, b, onFileClass);
1399  return;
1400  }
1401  break;
1402  case ROOT::kSTLmap:
1403  case ROOT::kSTLmultimap:
1406  if (obj) {
1407  if (fProperties & kNeedDelete) {
1408  TGenCollectionProxy::Clear("force");
1409  } else {
1410  fClear.invoke(fEnv);
1411  }
1412  }
1413  ReadMap(nElements, b, onFileClass);
1414  break;
1415  }
1416  }
1417 }
1418 
1420 {
1421  // TClassStreamer IO overload.
1422  if (b.IsReading()) { //Read mode
1423  int nElements = 0;
1424  b >> nElements;
1425  if (fEnv->fObject) {
1426  TGenCollectionProxy::Clear("force");
1427  }
1428  if (nElements > 0) {
1429  switch (fSTL_type) {
1430  case ROOT::kSTLbitset:
1431  ReadPrimitives(nElements, b, fOnFileClass);
1432  return;
1433  case ROOT::kSTLvector:
1434  case ROOT::kSTLlist:
1435  case ROOT::kSTLdeque:
1436  case ROOT::kSTLmultiset:
1437  case ROOT::kSTLset:
1440  switch (fVal->fCase) {
1441  case kIsFundamental: // Only handle primitives this way
1442  case kIsEnum:
1443  ReadPrimitives(nElements, b, fOnFileClass);
1444  return;
1445  default:
1446  ReadObjects(nElements, b, fOnFileClass);
1447  return;
1448  }
1449  break;
1450  case ROOT::kSTLmap:
1451  case ROOT::kSTLmultimap:
1454  ReadMap(nElements, b, fOnFileClass);
1455  break;
1456  }
1457  }
1458  } else { // Write case
1459  int nElements = fEnv->fObject ? *(size_t*)fSize.invoke(fEnv) : 0;
1460  b << nElements;
1461  if (nElements > 0) {
1462  switch (fSTL_type) {
1463  case ROOT::kSTLbitset:
1464  WritePrimitives(nElements, b);
1465  return;
1466  case ROOT::kSTLvector:
1467  case ROOT::kSTLlist:
1468  case ROOT::kSTLforwardlist:
1469  case ROOT::kSTLdeque:
1470  case ROOT::kSTLmultiset:
1471  case ROOT::kSTLset:
1474  switch (fVal->fCase) {
1475  case kIsFundamental: // Only handle primitives this way
1476  case kIsEnum:
1477  WritePrimitives(nElements, b);
1478  return;
1479  default:
1480  WriteObjects(nElements, b);
1481  return;
1482  }
1483  break;
1484  case ROOT::kSTLmap:
1485  case ROOT::kSTLmultimap:
1488  WriteMap(nElements, b);
1489  break;
1490  }
1491  }
1492  }
1493 }
1494 
1496 {
1497  // TClassStreamer IO overload.
1498  if (b.IsReading()) { //Read mode
1499  int nElements = 0;
1500  b >> nElements;
1501  if (fEnv->fObject) {
1502  TGenCollectionProxy::Clear("force");
1503  }
1504  if (nElements > 0) {
1505  switch (fSTL_type) {
1506  case ROOT::kSTLmap:
1507  case ROOT::kSTLmultimap:
1510  ReadMap(nElements, b, fOnFileClass);
1511  break;
1512  case ROOT::kSTLvector:
1513  case ROOT::kSTLlist:
1514  case ROOT::kSTLforwardlist:
1515  case ROOT::kSTLdeque:
1516  case ROOT::kSTLmultiset:
1517  case ROOT::kSTLset:
1520  ReadPairFromMap(nElements, b);
1521  break;
1522  }
1523  default:
1524  break;
1525  }
1526  }
1527  } else { // Write case
1528  Streamer(b);
1529  }
1530 }
Describe Streamer information for one class version.
Definition: TStreamerInfo.h:47
Method fSize
Container accessors: size of container.
UShort_t * getaddress< UShort_t >(TGenCollectionProxy::StreamHelper &itm)
double read(const std::string &file_name)
reading
virtual void ReadBuffer(TBuffer &b, void *obj, const TClass *onfileClass)
virtual void WriteFastArrayFloat16(const Float_t *f, Int_t n, TStreamerElement *ele=0)=0
tuple buffer
Definition: tree.py:99
long long Long64_t
Definition: RtypesCore.h:69
void ReadBufferVectorPrimitivesDouble32(TBuffer &b, void *obj, const TClass *onFileClass)
void * invoke(void *obj) const
void CreateIterators(void *collection)
ULong_t * getaddress< ULong_t >(TGenCollectionProxy::StreamHelper &itm)
Bool_t IsReading() const
Definition: TBuffer.h:83
void WriteMap(int nElements, TBuffer &b)
double write(int n, const std::string &file_name, const std::string &vector_type, int compress=0)
writing
void Fatal(const char *location, const char *msgfmt,...)
float Float_t
Definition: RtypesCore.h:53
Equal to TDataType's kchar.
TGenCollectionProxy * Initialize(Bool_t silent) const
Proxy initializer.
Collectfunc_t fCollect
Method to collect objects from container.
virtual void StreamObject(void *obj, const type_info &typeinfo, const TClass *onFileClass=0)=0
std::string fName
Name of the class being proxied.
virtual TClass * GetValueClass() const =0
int GetSplit(const char *type, std::vector< std::string > &output, int &nestedLoc, EModType mode=TClassEdit::kNone)
Stores in output (after emptying it) the splited type.
Definition: TClassEdit.cxx:927
virtual Int_t WriteObjectAny(const void *obj, const TClass *ptrClass)=0
unsigned short UShort_t
Definition: RtypesCore.h:36
Char_t * getaddress< Char_t >(TGenCollectionProxy::StreamHelper &itm)
static T * getaddress(TGenCollectionProxy::StreamHelper &itm)
Method fFirst
Container accessors: generic iteration: first.
Buffer base class used for serializing objects.
Definition: TBuffer.h:42
void ReadBufferGeneric(TBuffer &b, void *obj, const TClass *onFileClass)
#define R__ASSERT(e)
Definition: TError.h:98
TClass * fOnFileClass
On file class.
Basic string class.
Definition: TString.h:137
Feedfunc_t fFeed
Container accessors: block feed.
TGenCollectionStreamer(const TGenCollectionStreamer &copy)
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
Definition: drr.cxx:518
void ReadPrimitives(int nElements, TBuffer &b, const TClass *onfileClass)
UInt_t fCase
type of data of Value_type
void DispatchConvertArray(int writeType, TGenCollectionProxy::StreamHelper *read, TGenCollectionProxy::StreamHelper *write, int nElements)
virtual EDataType GetType() const =0
Sizing_t fResize
Container accessors: resize container.
void ReadPairFromMap(int nElements, TBuffer &b)
virtual TVirtualStreamerInfo * GetInfo()=0
TFile * f
V GetOffset(E val1, E val2, V iso)
Long64_t * getaddress< Long64_t >(TGenCollectionProxy::StreamHelper &itm)
virtual void StreamerAsMap(TBuffer &refBuffer)
TTree * T
void ConvertBufferVectorPrimitives(TBuffer &b, void *obj, Int_t nElements)
float Float16_t
Definition: RtypesCore.h:54
To readOneValue(TBuffer &b, int readtype)
virtual CreateIterators_t GetFunctionCreateIterators(Bool_t read=kTRUE)
See typedef void (*CreateIterators_t)(void *collection, void *&begin_arena, void *&end_arena); begin_...
void WritePrimitives(int nElements, TBuffer &b)
Short_t * getaddress< Short_t >(TGenCollectionProxy::StreamHelper &itm)
void WriteObjects(int nElements, TBuffer &b)
Method fClear
Method cache for container accessors: clear container.
double Double32_t
Definition: RtypesCore.h:56
ArrIterfunc_t fConstruct
Container accessors: block construct.
void Error(const char *location, const char *msgfmt,...)
EDataType fKind
kind of ROOT-fundamental type
#define DOLOOP(x)
void ReadBufferDefault(TBuffer &b, void *obj, const TClass *onFileClass)
virtual EDataType GetType() const
If the content is a simple numerical value, return its type (see TDataType)
UChar_t * getaddress< UChar_t >(TGenCollectionProxy::StreamHelper &itm)
int fValOffset
Offset from key to value (in maps)
ROOT::R::TRInterface & r
Definition: Object.C:4
TObjArray * GetElements() const
virtual void ReadFastArrayDouble32(Double_t *d, Int_t n, TStreamerElement *ele=0)=0
int fSTL_type
STL container type.
TVirtualStreamerInfo * GetStreamerInfo(Int_t version=0) const
returns a pointer to the TVirtualStreamerInfo object for version If the object does not exist...
Definition: TClass.cxx:4256
SVector< double, 2 > v
Definition: Dict.h:5
Long_t * getaddress< Long_t >(TGenCollectionProxy::StreamHelper &itm)
virtual Int_t ApplySequence(const TStreamerInfoActions::TActionSequence &sequence, void *object)=0
virtual void ReadFastArrayFloat16(Float_t *f, Int_t n, TStreamerElement *ele=0)=0
unsigned int UInt_t
Definition: RtypesCore.h:42
bool first
Definition: line3Dfit.C:48
tuple w
Definition: qtexample.py:51
short Short_t
Definition: RtypesCore.h:35
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
void ReadBufferVectorPrimitivesFloat16(TBuffer &b, void *obj, const TClass *onFileClass)
CreateIterators_t fFunctionCreateIterators
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
void ReadMap(int nElements, TBuffer &b, const TClass *onfileClass)
virtual void ReadFastArray(Bool_t *b, Int_t n)=0
void ConvertBufferVectorPrimitivesDouble32(TBuffer &b, void *obj, Int_t nElements)
virtual void WriteFastArray(const Bool_t *b, Int_t n)=0
int fValDiff
Offset between two consecutive value_types (memory layout).
virtual ULong_t GetIncrement() const =0
long Long_t
Definition: RtypesCore.h:50
ULong64_t * getaddress< ULong64_t >(TGenCollectionProxy::StreamHelper &itm)
void ReadBufferVectorPrimitives(TBuffer &b, void *obj, const TClass *onFileClass)
double Double_t
Definition: RtypesCore.h:55
Float_t * getaddress< Float_t >(TGenCollectionProxy::StreamHelper &itm)
virtual TObjArray * GetElements() const =0
virtual TGenCollectionProxy * InitializeEx(Bool_t silent)
Proxy initializer.
unsigned long long ULong64_t
Definition: RtypesCore.h:70
unsigned long ULong_t
Definition: RtypesCore.h:51
UInt_t * getaddress< UInt_t >(TGenCollectionProxy::StreamHelper &itm)
EDataType
Definition: TDataType.h:30
virtual void * ReadObjectAny(const TClass *cast)=0
virtual Version_t GetOldVersion() const =0
std::atomic< Value * > fValue
Descriptor of the container value type.
TClassRef fType
TClass reference of Value_type in collection.
virtual void Clear(const char *opt="")
Clear the emulated collection.
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
Definition: TClass.cxx:2730
virtual void * At(UInt_t idx)
Return the address of the value at index 'idx'.
char Char_t
Definition: RtypesCore.h:29
Value * fKey
Descriptor of the key_type.
void ConvertBufferVectorPrimitivesFloat16(TBuffer &b, void *obj, Int_t nElements)
virtual void Streamer(TBuffer &refBuffer)
Streamer Function.
Helper class to facilitate I/O.
Proxy around an arbitrary container, which implements basic functionality and iteration.
EnvironBase_t * fEnv
Address of the currently proxied object.
Sizing_t fDestruct
Container accessors: block destruct.
bool * getaddress< bool >(TGenCollectionProxy::StreamHelper &itm)
Int_t * getaddress< Int_t >(TGenCollectionProxy::StreamHelper &itm)
unsigned char UChar_t
Definition: RtypesCore.h:34
TObject * At(Int_t idx) const
Definition: TObjArray.h:167
Double_t * getaddress< Double_t >(TGenCollectionProxy::StreamHelper &itm)
TStreamerInfoActions::TActionSequence * GetReadObjectWiseActions()
void ReadObjects(int nElements, TBuffer &b, const TClass *onfileClass)
Abstract Interface class describing Streamer information for one class.
TObject * obj
const std::type_info & Info_t
void ReadMapHelper(StreamHelper *i, Value *v, Bool_t vsn3, TBuffer &b)
void DispatchConvertBufferVectorPrimitives(TBuffer &b, void *obj, Int_t nElements, const TVirtualCollectionProxy *onfileProxy)
void ConvertArray(TGenCollectionProxy::StreamHelper *read, TGenCollectionProxy::StreamHelper *write, int nElements)
virtual void WriteFastArrayDouble32(const Double_t *d, Int_t n, TStreamerElement *ele=0)=0
Small helper to describe the Value_type or the key_type of an STL container.
void read_tstring_pointer(Bool_t vsn3, TBuffer &b)
Value * fVal
Descriptor of the Value_type.
virtual TVirtualCollectionProxy * Generate() const
Virtual copy constructor.
EReadWrite
EReadWrite Enumerator Enum Constant Description kBase Base class element kOffsetL Fixed size array k...