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