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"
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
46TGenCollectionStreamer::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
64template <typename T>
66
67template <>
69{
70 return &itm.boolean;
71}
72
73template <>
75{
76 return &itm.s_char;
77}
78
79template <>
81{
82 return &itm.s_short;
83}
84
85template <>
87{
88 return &itm.s_int;
89}
90
91template <>
93{
94 return &itm.s_long;
95}
96
97template <>
99{
100 return &itm.s_longlong;
101}
102
103template <>
105{
106 return &itm.flt;
107}
108
109template <>
111{
112 return &itm.dbl;
113}
114
115template <>
117{
118 return &itm.u_char;
119}
120
121template <>
123{
124 return &itm.u_short;
125}
126
127template <>
129{
130 return &itm.u_int;
131}
132
133template <>
135{
136 return &itm.u_long;
137}
138
139template <>
141{
142 return &itm.u_longlong;
143}
144
145template <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
156template <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;
187 case kUChar_t:
188 ConvertArray<From,UChar_t>(read,write,nElements);
189 break;
190 case kUShort_t:
191 ConvertArray<From,UShort_t>(read,write,nElements);
192 break;
193 case kUInt_t:
194 ConvertArray<From,UInt_t>(read,write,nElements);
195 break;
196 case kULong_t:
197 ConvertArray<From,ULong_t>(read,write,nElements);
198 break;
199 case kULong64_t:
200 ConvertArray<From,ULong64_t>(read,write,nElements);
201 break;
202 case kDouble32_t:
203 ConvertArray<From,Double32_t>(read,write,nElements);
204 break;
205 case kchar:
206 case kNoType_t:
207 case kOther_t:
208 Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", writeType);
209 }
210}
211
212void TGenCollectionStreamer::ReadPrimitives(int nElements, TBuffer &b, const TClass *onFileClass)
213{
214 // Primitive input streamer.
215 size_t len = fValDiff * nElements;
216 char buffer[8096];
217 Bool_t feed = false;
218 void* memory = 0;
219 StreamHelper* itmstore = 0;
220 StreamHelper* itmconv = 0;
221 fEnv->fSize = nElements;
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#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)TGenCollectionProxy::At(idx); { x ;} ++idx;} break;}
411 fEnv->fIdx = 0;
412 fEnv->fStart = 0;
413 switch (fVal->fCase) {
414 case kIsClass:
415 DOLOOP(b.StreamObject(i, fVal->fType, onFileValClass));
416 case kBIT_ISSTRING:
417 DOLOOP(i->read_std_string(b));
418 case kIsPointer | kIsClass:
419 DOLOOP(i->set(b.ReadObjectAny(fVal->fType)));
421 DOLOOP(i->read_std_string_pointer(b));
423 DOLOOP(i->read_tstring_pointer(vsn3, b));
424 }
425#undef DOLOOP
426 break;
427
428 // Rather troublesome case: Objects can only be fed into the container
429 // Once they are created. Need to take memory from stack or heap.
431 case ROOT::kSTLset:
434#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;}}
435 fEnv->fStart = itm = (StreamHelper*)(len < sizeof(buffer) ? buffer : memory =::operator new(len));
436 fConstruct(itm,nElements);
437 switch (fVal->fCase) {
438 case kIsClass:
439 DOLOOP(b.StreamObject(i, fVal->fType, onFileValClass));
442 break;
444 DOLOOP(i->read_std_string(b))
447 break;
449 DOLOOP(i->set(b.ReadObjectAny(fVal->fType)));
451 break;
453 DOLOOP(i->read_std_string_pointer(b))
455 break;
457 DOLOOP(i->read_tstring_pointer(vsn3, b));
459 break;
460 }
461#undef DOLOOP
462 break;
463 default:
464 break;
465 }
466 if (memory) {
467 ::operator delete(memory);
468 }
469}
470
472{
473 // Input streamer to convert a map into another collection
474
475 Bool_t vsn3 = b.GetInfo() && b.GetInfo()->GetOldVersion() <= 3;
476 size_t len = fValDiff * nElements;
477 StreamHelper* itm = 0;
478 char buffer[8096];
479 void* memory = 0;
480
482 R__ASSERT(pinfo);
484
485 int nested = 0;
486 std::vector<std::string> inside;
487 TClassEdit::GetSplit(pinfo->GetName(), inside, nested);
488 Value first(inside[1],kFALSE);
489 Value second(inside[2],kFALSE);
490 fValOffset = ((TStreamerElement*)pinfo->GetElements()->At(1))->GetOffset();
491
492 fEnv->fSize = nElements;
493 switch (fSTL_type) {
494 // Simple case: contiguous memory. get address of first, then jump.
495 case ROOT::kSTLvector:
496#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
498 fEnv->fIdx = 0;
499
500 {
502 iterators.CreateIterators(fEnv->fObject);
503 itm = (StreamHelper*)iterators.fBegin;
504 }
505 fEnv->fStart = itm;
506 switch (fVal->fCase) {
507 case kIsClass:
508 DOLOOP(
509 ReadMapHelper(i, &first, vsn3, b);
510 ReadMapHelper((StreamHelper*)(((char*)i) + fValOffset), &second, vsn3, b)
511 );
512 }
513#undef DOLOOP
514 break;
515
516 // No contiguous memory, but resize is possible
517 // Hence accessing objects using At(i) should be not too much an overhead
518 case ROOT::kSTLlist:
520 case ROOT::kSTLdeque:
521#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)TGenCollectionProxy::At(idx); { x ;} ++idx;} break;}
523 fEnv->fIdx = 0;
524 {
526 iterators.CreateIterators(fEnv->fObject);
527 fEnv->fStart = iterators.fBegin;
528 }
529 switch (fVal->fCase) {
530 case kIsClass:
531 DOLOOP(
532 char **where = (char**)(void*) & i;
533 b.ApplySequence(*(pinfo->GetReadObjectWiseActions()), where);
534 );
535 }
536#undef DOLOOP
537 break;
538
539 // Rather troublesome case: Objects can only be fed into the container
540 // Once they are created. Need to take memory from stack or heap.
542 case ROOT::kSTLset:
545#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;}}
546 fEnv->fStart = itm = (StreamHelper*)(len < sizeof(buffer) ? buffer : memory =::operator new(len));
547 fConstruct(itm,nElements);
548 switch (fVal->fCase) {
549 case kIsClass:
550 DOLOOP(
551 char **where = (char**)(void*) & i;
552 b.ApplySequence(*(pinfo->GetReadObjectWiseActions()), where);
553 );
556 break;
557 }
558#undef DOLOOP
559 break;
560 default:
561 break;
562 }
563 if (memory) {
564 ::operator delete(memory);
565 }
566}
567
568
570{
571 // helper class to read std::map
572
573 float f;
574
575 switch (v->fCase) {
576 case kIsFundamental: // Only handle primitives this way
577 case kIsEnum:
578 switch (int(v->fKind)) {
579 case kBool_t:
580 b >> i->boolean;
581 break;
582 case kChar_t:
583 b >> i->s_char;
584 break;
585 case kShort_t:
586 b >> i->s_short;
587 break;
588 case kInt_t:
589 b >> i->s_int;
590 break;
591 case kLong_t:
592 b >> i->s_long;
593 break;
594 case kLong64_t:
595 b >> i->s_longlong;
596 break;
597 case kFloat_t:
598 b >> i->flt;
599 break;
600 case kFloat16_t:
601 b >> f;
602 i->flt = float(f);
603 break;
604 case kDouble_t:
605 b >> i->dbl;
606 break;
607 case kUChar_t:
608 b >> i->u_char;
609 break;
610 case kUShort_t:
611 b >> i->u_short;
612 break;
613 case kUInt_t:
614 b >> i->u_int;
615 break;
616 case kULong_t:
617 b >> i->u_long;
618 break;
619 case kULong64_t:
620 b >> i->u_longlong;
621 break;
622 case kDouble32_t:
623 b >> f;
624 i->dbl = double(f);
625 break;
626 case kchar:
627 case kNoType_t:
628 case kOther_t:
629 Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", v->fKind);
630 }
631 break;
632 case kIsClass:
633 b.StreamObject(i, v->fType);
634 break;
635 case kBIT_ISSTRING:
636 i->read_std_string(b);
637 break;
638 case kIsPointer | kIsClass:
639 i->set(b.ReadObjectAny(v->fType));
640 break;
643 break;
645 i->read_tstring_pointer(vsn3, b);
646 break;
647 }
648}
649
650template <typename To>
651To readOneValue(TBuffer &b, int readtype) {
654 switch (readtype) {
655 case kBool_t:
656 b >> i->boolean;
657 return (To)i->boolean;
658 break;
659 case kChar_t:
660 b >> i->s_char;
661 return (To)i->s_char;
662 break;
663 case kShort_t:
664 b >> i->s_short;
665 return (To)i->s_short;
666 break;
667 case kInt_t:
668 b >> i->s_int;
669 return (To)i->s_int;
670 break;
671 case kLong_t:
672 b >> i->s_long;
673 return (To)i->s_long;
674 break;
675 case kLong64_t:
676 b >> i->s_longlong;
677 return (To)i->s_longlong;
678 break;
679 case kFloat_t:
680 b >> i->flt;
681 return (To)i->flt;
682 break;
683 case kFloat16_t:
684 b >> i->flt;
685 return (To)i->flt;
686 break;
687 case kDouble_t:
688 b >> i->dbl;
689 return (To)i->dbl;
690 break;
691 case kUChar_t:
692 b >> i->u_char;
693 return (To)i->u_char;
694 break;
695 case kUShort_t:
696 b >> i->u_short;
697 return (To)i->u_short;
698 break;
699 case kUInt_t:
700 b >> i->u_int;
701 return (To)i->u_int;
702 break;
703 case kULong_t:
704 b >> i->u_long;
705 return (To)i->u_long;
706 break;
707 case kULong64_t:
708 b >> i->u_longlong;
709 return (To)i->u_longlong;
710 break;
711 case kDouble32_t: {
712 float f;
713 b >> f;
714 i->dbl = double(f);
715 return (To)i->dbl;
716 break;
717 }
718 case kchar:
719 case kNoType_t:
720 case kOther_t:
721 Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", readtype);
722 }
723 return 0;
724}
725
726
727void TGenCollectionStreamer::ReadMap(int nElements, TBuffer &b, const TClass *onFileClass)
728{
729 // Map input streamer.
730 Bool_t vsn3 = b.GetInfo() && b.GetInfo()->GetOldVersion() <= 3;
731 size_t len = fValDiff * nElements;
732 Value *v;
733 char buffer[8096], *addr, *temp;
734 void* memory = 0;
735 StreamHelper* i;
736 float f;
737 fEnv->fSize = nElements;
738 fEnv->fStart = (len < sizeof(buffer) ? buffer : memory =::operator new(len));
739 addr = temp = (char*)fEnv->fStart;
740 fConstruct(addr,nElements);
741
742 int onFileValueKind[2];
743 if (onFileClass) {
744 TClass *onFileValueClass = onFileClass->GetCollectionProxy()->GetValueClass();
745 TVirtualStreamerInfo *sourceInfo = onFileValueClass->GetStreamerInfo();
746 onFileValueKind[0] = ((TStreamerElement*)sourceInfo->GetElements()->At(0))->GetType();
747 onFileValueKind[1] = ((TStreamerElement*)sourceInfo->GetElements()->At(1))->GetType();
748 }
749 for (int loop, idx = 0; idx < nElements; ++idx) {
750 addr = temp + fValDiff * idx;
751 v = fKey;
752 for (loop = 0; loop < 2; loop++) {
753 i = (StreamHelper*)addr;
754 switch (v->fCase) {
755 case kIsFundamental: // Only handle primitives this way
756 case kIsEnum:
757 if (onFileClass) {
758 int readtype = (int)(onFileValueKind[loop]);
759 switch (int(v->fKind)) {
760 case kBool_t:
761 i->boolean = readOneValue<bool>(b,readtype);
762 break;
763 case kChar_t:
764 i->s_char = readOneValue<Char_t>(b,readtype);
765 break;
766 case kShort_t:
767 i->s_short = readOneValue<Short_t>(b,readtype);
768 break;
769 case kInt_t:
770 i->s_int = readOneValue<Int_t>(b,readtype);
771 break;
772 case kLong_t:
773 i->s_long = readOneValue<Long_t>(b,readtype);
774 break;
775 case kLong64_t:
776 i->s_longlong = readOneValue<Long64_t>(b,readtype);
777 break;
778 case kFloat_t:
779 i->flt = readOneValue<Float_t>(b,readtype);
780 break;
781 case kFloat16_t:
782 i->flt = readOneValue<Float16_t>(b,readtype);
783 break;
784 case kDouble_t:
785 i->dbl = readOneValue<Double_t>(b,readtype);
786 break;
787 case kUChar_t:
788 i->u_char = readOneValue<UChar_t>(b,readtype);
789 break;
790 case kUShort_t:
791 i->u_short = readOneValue<UShort_t>(b,readtype);
792 break;
793 case kUInt_t:
794 i->u_int = readOneValue<UInt_t>(b,readtype);
795 break;
796 case kULong_t:
797 i->u_long = readOneValue<ULong_t>(b,readtype);
798 break;
799 case kULong64_t:
800 i->u_longlong = readOneValue<ULong64_t>(b,readtype);
801 break;
802 case kDouble32_t:
803 i->dbl = readOneValue<Double32_t>(b,readtype);
804 break;
805 case kchar:
806 case kNoType_t:
807 case kOther_t:
808 Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", v->fKind);
809 }
810 } else {
811 switch (int(v->fKind)) {
812 case kBool_t:
813 b >> i->boolean;
814 break;
815 case kChar_t:
816 b >> i->s_char;
817 break;
818 case kShort_t:
819 b >> i->s_short;
820 break;
821 case kInt_t:
822 b >> i->s_int;
823 break;
824 case kLong_t:
825 b >> i->s_long;
826 break;
827 case kLong64_t:
828 b >> i->s_longlong;
829 break;
830 case kFloat_t:
831 b >> i->flt;
832 break;
833 case kFloat16_t:
834 b >> f;
835 i->flt = float(f);
836 break;
837 case kDouble_t:
838 b >> i->dbl;
839 break;
840 case kUChar_t:
841 b >> i->u_char;
842 break;
843 case kUShort_t:
844 b >> i->u_short;
845 break;
846 case kUInt_t:
847 b >> i->u_int;
848 break;
849 case kULong_t:
850 b >> i->u_long;
851 break;
852 case kULong64_t:
853 b >> i->u_longlong;
854 break;
855 case kDouble32_t:
856 b >> f;
857 i->dbl = double(f);
858 break;
859 case kchar:
860 case kNoType_t:
861 case kOther_t:
862 Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", v->fKind);
863 }
864 }
865 break;
866 case kIsClass:
867 b.StreamObject(i, v->fType);
868 break;
870 i->read_std_string(b);
871 break;
873 i->set(b.ReadObjectAny(v->fType));
874 break;
877 break;
879 i->read_tstring_pointer(vsn3, b);
880 break;
881 }
882 v = fVal;
883 addr += fValOffset;
884 }
885 }
888 if (memory) {
889 ::operator delete(memory);
890 }
891}
892
894{
895 // Primitive output streamer.
896 size_t len = fValDiff * nElements;
897 char buffer[8192];
898 void* memory = 0;
899 StreamHelper* itm = 0;
900 switch (fSTL_type) {
901 case ROOT::kSTLvector:
902 if (fVal->fKind != kBool_t) {
904 break;
905 }
906 default:
907 fEnv->fStart = itm = (StreamHelper*)(len < sizeof(buffer) ? buffer : memory =::operator new(len));
908 fCollect(fEnv->fObject,itm);
909 break;
910 }
911 switch (int(fVal->fKind)) {
912 case kBool_t:
913 b.WriteFastArray(&itm->boolean , nElements);
914 break;
915 case kChar_t:
916 b.WriteFastArray(&itm->s_char , nElements);
917 break;
918 case kShort_t:
919 b.WriteFastArray(&itm->s_short , nElements);
920 break;
921 case kInt_t:
922 b.WriteFastArray(&itm->s_int , nElements);
923 break;
924 case kLong_t:
925 b.WriteFastArray(&itm->s_long , nElements);
926 break;
927 case kLong64_t:
928 b.WriteFastArray(&itm->s_longlong, nElements);
929 break;
930 case kFloat_t:
931 b.WriteFastArray(&itm->flt , nElements);
932 break;
933 case kFloat16_t:
934 b.WriteFastArrayFloat16(&itm->flt, nElements);
935 break;
936 case kDouble_t:
937 b.WriteFastArray(&itm->dbl , nElements);
938 break;
939 case kUChar_t:
940 b.WriteFastArray(&itm->u_char , nElements);
941 break;
942 case kUShort_t:
943 b.WriteFastArray(&itm->u_short , nElements);
944 break;
945 case kUInt_t:
946 b.WriteFastArray(&itm->u_int , nElements);
947 break;
948 case kULong_t:
949 b.WriteFastArray(&itm->u_long , nElements);
950 break;
951 case kULong64_t:
952 b.WriteFastArray(&itm->u_longlong, nElements);
953 break;
954 case kDouble32_t:
955 b.WriteFastArrayDouble32(&itm->dbl, nElements);
956 break;
957 case kchar:
958 case kNoType_t:
959 case kOther_t:
960 Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", fVal->fKind);
961 }
962 if (memory) {
963 ::operator delete(memory);
964 }
965}
966
968{
969 // Object output streamer.
970 StreamHelper* itm = 0;
971 switch (fSTL_type) {
972 // Simple case: contiguous memory. get address of first, then jump.
973 case ROOT::kSTLvector:
974#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
976 switch (fVal->fCase) {
977 case kIsClass:
978 DOLOOP(b.StreamObject(i, fVal->fType));
979 break;
980 case kBIT_ISSTRING:
981 DOLOOP(TString(i->c_str()).Streamer(b));
982 break;
983 case kIsPointer | kIsClass:
984 DOLOOP(b.WriteObjectAny(i->ptr(), fVal->fType));
985 break;
987 DOLOOP(i->write_std_string_pointer(b));
988 break;
990 DOLOOP(i->write_tstring_pointer(b));
991 break;
992 }
993#undef DOLOOP
994 break;
995
996 // No contiguous memory, but resize is possible
997 // Hence accessing objects using At(i) should be not too much an overhead
998 case ROOT::kSTLlist:
1000 case ROOT::kSTLdeque:
1001 case ROOT::kSTLmultiset:
1002 case ROOT::kSTLset:
1005#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)TGenCollectionProxy::At(idx); { x ;} ++idx;} break;}
1006 switch (fVal->fCase) {
1007 case kIsClass:
1008 DOLOOP(b.StreamObject(i, fVal->fType));
1009 case kBIT_ISSTRING:
1010 DOLOOP(TString(i->c_str()).Streamer(b));
1011 case kIsPointer | kIsClass:
1012 DOLOOP(b.WriteObjectAny(i->ptr(), fVal->fType));
1014 DOLOOP(i->write_std_string_pointer(b));
1016 DOLOOP(i->write_tstring_pointer(b));
1017 }
1018#undef DOLOOP
1019 break;
1020 default:
1021 break;
1022 }
1023}
1024
1026{
1027 // Map output streamer
1028 StreamHelper* i;
1029 Value *v;
1030
1031 for (int loop, idx = 0; idx < nElements; ++idx) {
1032 char* addr = (char*)TGenCollectionProxy::At(idx);
1033 v = fKey;
1034 for (loop = 0; loop < 2; ++loop) {
1035 i = (StreamHelper*)addr;
1036 switch (v->fCase) {
1037 case kIsFundamental: // Only handle primitives this way
1038 case kIsEnum:
1039 switch (int(v->fKind)) {
1040 case kBool_t:
1041 b << i->boolean;
1042 break;
1043 case kChar_t:
1044 b << i->s_char;
1045 break;
1046 case kShort_t:
1047 b << i->s_short;
1048 break;
1049 case kInt_t:
1050 b << i->s_int;
1051 break;
1052 case kLong_t:
1053 b << i->s_long;
1054 break;
1055 case kLong64_t:
1056 b << i->s_longlong;
1057 break;
1058 case kFloat_t:
1059 b << i->flt;
1060 break;
1061 case kFloat16_t:
1062 b << float(i->flt);
1063 break;
1064 case kDouble_t:
1065 b << i->dbl;
1066 break;
1067 case kUChar_t:
1068 b << i->u_char;
1069 break;
1070 case kUShort_t:
1071 b << i->u_short;
1072 break;
1073 case kUInt_t:
1074 b << i->u_int;
1075 break;
1076 case kULong_t:
1077 b << i->u_long;
1078 break;
1079 case kULong64_t:
1080 b << i->u_longlong;
1081 break;
1082 case kDouble32_t:
1083 b << float(i->dbl);
1084 break;
1085 case kchar:
1086 case kNoType_t:
1087 case kOther_t:
1088 Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", v->fKind);
1089 }
1090 break;
1091 case kIsClass:
1092 b.StreamObject(i, v->fType);
1093 break;
1094 case kBIT_ISSTRING:
1095 TString(i->c_str()).Streamer(b);
1096 break;
1097 case kIsPointer | kIsClass:
1098 b.WriteObjectAny(i->ptr(), v->fType);
1099 break;
1102 break;
1105 break;
1106 }
1107 addr += fValOffset;
1108 v = fVal;
1109 }
1110 }
1111}
1112
1113template <typename From, typename To>
1115{
1116 From *temp = new From[nElements];
1117 b.ReadFastArray(temp, nElements);
1118 std::vector<To> *const vec = (std::vector<To>*)(obj);
1119 for(Int_t ind = 0; ind < nElements; ++ind) {
1120 (*vec)[ind] = (To)temp[ind];
1121 }
1122 delete [] temp;
1123}
1124
1125template <typename To>
1127{
1128 Float16_t *temp = new Float16_t[nElements];
1129 b.ReadFastArrayFloat16(temp, nElements);
1130 std::vector<To> *const vec = (std::vector<To>*)(obj);
1131 for(Int_t ind = 0; ind < nElements; ++ind) {
1132 (*vec)[ind] = (To)temp[ind];
1133 }
1134 delete [] temp;
1135}
1136
1137template <typename To>
1139{
1140 Double32_t *temp = new Double32_t[nElements];
1141 b.ReadFastArrayDouble32(temp, nElements);
1142 std::vector<To> *const vec = (std::vector<To>*)(obj);
1143 for(Int_t ind = 0; ind < nElements; ++ind) {
1144 (*vec)[ind] = (To)temp[ind];
1145 }
1146 delete [] temp;
1147}
1148
1149template <typename To>
1151{
1152 switch ((TStreamerInfo::EReadWrite)onFileProxy->GetType()) {
1153 case TStreamerInfo::kBool: ConvertBufferVectorPrimitives<Bool_t ,To>(b,obj,nElements); break;
1154 case TStreamerInfo::kChar: ConvertBufferVectorPrimitives<Char_t ,To>(b,obj,nElements); break;
1155 case TStreamerInfo::kShort: ConvertBufferVectorPrimitives<Short_t ,To>(b,obj,nElements); break;
1156 case TStreamerInfo::kInt: ConvertBufferVectorPrimitives<Int_t ,To>(b,obj,nElements); break;
1157 case TStreamerInfo::kLong: ConvertBufferVectorPrimitives<Long_t ,To>(b,obj,nElements); break;
1158 case TStreamerInfo::kLong64: ConvertBufferVectorPrimitives<Long64_t ,To>(b,obj,nElements); break;
1159 case TStreamerInfo::kFloat: ConvertBufferVectorPrimitives<Float_t ,To>(b,obj,nElements); break;
1160 case TStreamerInfo::kFloat16: ConvertBufferVectorPrimitives<Float16_t ,To>(b,obj,nElements); break;
1161 case TStreamerInfo::kDouble: ConvertBufferVectorPrimitives<Double_t ,To>(b,obj,nElements); break;
1162 case TStreamerInfo::kDouble32: ConvertBufferVectorPrimitives<Double32_t,To>(b,obj,nElements); break;
1163 case TStreamerInfo::kUChar: ConvertBufferVectorPrimitives<UChar_t ,To>(b,obj,nElements); break;
1164 case TStreamerInfo::kUShort: ConvertBufferVectorPrimitives<UShort_t ,To>(b,obj,nElements); break;
1165 case TStreamerInfo::kUInt: ConvertBufferVectorPrimitives<UInt_t ,To>(b,obj,nElements); break;
1166 case TStreamerInfo::kULong: ConvertBufferVectorPrimitives<ULong_t ,To>(b,obj,nElements); break;
1167 case TStreamerInfo::kULong64: ConvertBufferVectorPrimitives<ULong64_t ,To>(b,obj,nElements); break;
1168 default: break;
1169 }
1170}
1171
1172template <typename basictype>
1174{
1175 int nElements = 0;
1176 b >> nElements;
1177 fResize(obj,nElements);
1178
1179 if (onFileClass) {
1180 DispatchConvertBufferVectorPrimitives<basictype>(b,obj,nElements,onFileClass->GetCollectionProxy());
1181 } else {
1183 iterators.CreateIterators(obj);
1184 b.ReadFastArray((basictype*)iterators.fBegin, nElements);
1185 }
1186}
1187
1189{
1190 int nElements = 0;
1191 b >> nElements;
1192 fResize(obj,nElements);
1193
1194 if (onFileClass) {
1195 DispatchConvertBufferVectorPrimitives<Float16_t>(b,obj,nElements,onFileClass->GetCollectionProxy());
1196 } else {
1198 iterators.CreateIterators(obj);
1199 b.ReadFastArrayFloat16((Float16_t*)iterators.fBegin, nElements);
1200 }
1201}
1202
1204{
1205 int nElements = 0;
1206 b >> nElements;
1207 fResize(obj,nElements);
1208
1209 if (onFileClass) {
1210 DispatchConvertBufferVectorPrimitives<Double32_t>(b,obj,nElements,onFileClass->GetCollectionProxy());
1211 } else {
1213 iterators.CreateIterators(obj);
1214 b.ReadFastArrayDouble32((Double32_t*)iterators.fBegin, nElements);
1215 }
1216}
1217
1218
1219
1220void TGenCollectionStreamer::ReadBuffer(TBuffer &b, void *obj, const TClass *onFileClass)
1221{
1222 // Call the specialized function. The first time this call ReadBufferDefault which
1223 // actually set to fReadBufferFunc to the 'right' specialized version.
1224
1225 (this->*fReadBufferFunc)(b,obj,onFileClass);
1226}
1227
1229{
1230 // Call the specialized function. The first time this call ReadBufferDefault which
1231 // actually set to fReadBufferFunc to the 'right' specialized version.
1232
1233 (this->*fReadBufferFunc)(b,obj,0);
1234}
1235
1236void TGenCollectionStreamer::ReadBufferDefault(TBuffer &b, void *obj, const TClass *onFileClass)
1237{
1238
1240
1241 // We will need this later, so let's make sure it is initialized.
1242 if ( !fValue.load() ) InitializeEx(kFALSE);
1244 Fatal("TGenCollectionStreamer::ReadBufferDefault","No CreateIterators function for %s",fName.c_str());
1245 }
1247 {
1248 // Only handle primitives this way
1249 switch (int(fVal->fKind)) {
1250 case kBool_t:
1251 // Nothing use generic for now
1252 break;
1253 case kChar_t:
1254 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Char_t>;
1255 break;
1256 case kShort_t:
1257 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Short_t>;
1258 break;
1259 case kInt_t:
1260 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Int_t>;
1261 break;
1262 case kLong_t:
1263 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Long_t>;
1264 break;
1265 case kLong64_t:
1266 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Long64_t>;
1267 break;
1268 case kFloat_t:
1269 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Float_t>;
1270 break;
1271 case kFloat16_t:
1273 break;
1274 case kDouble_t:
1275 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Double_t>;
1276 break;
1277 case kUChar_t:
1278 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<UChar_t>;
1279 break;
1280 case kUShort_t:
1281 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<UShort_t>;
1282 break;
1283 case kUInt_t:
1284 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<UInt_t>;
1285 break;
1286 case kULong_t:
1287 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<ULong_t>;
1288 break;
1289 case kULong64_t:
1290 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<ULong64_t>;
1291 break;
1292 case kDouble32_t:
1294 break;
1295 case kchar:
1296 case kNoType_t:
1297 case kOther_t:
1298 // Nothing use the generic for now
1299 break;
1300 }
1301 }
1302 (this->*fReadBufferFunc)(b,obj,onFileClass);
1303}
1304
1305void TGenCollectionStreamer::ReadBufferGeneric(TBuffer &b, void *obj, const TClass *onFileClass)
1306{
1307 TVirtualCollectionProxy::TPushPop env(this, obj);
1308
1309 int nElements = 0;
1310 b >> nElements;
1311
1312 if (nElements == 0) {
1313 if (obj) {
1315 }
1316 } else if (nElements > 0) {
1317 switch (fSTL_type) {
1318 case ROOT::kSTLbitset:
1319 if (obj) {
1320 if (fProperties & kNeedDelete) {
1322 } else {
1324 }
1325 }
1326 ReadPrimitives(nElements, b, onFileClass);
1327 return;
1328 case ROOT::kSTLvector:
1329 if (obj) {
1330 if (fProperties & kNeedDelete) {
1332 } // a resize will be called in ReadPrimitives/ReadObjects.
1333 else if (fVal->fKind == kBool_t) {
1335 }
1336 }
1337 switch (fVal->fCase) {
1338 case kIsFundamental: // Only handle primitives this way
1339 case kIsEnum:
1340 ReadPrimitives(nElements, b, onFileClass);
1341 return;
1342 default:
1343 ReadObjects(nElements, b, onFileClass);
1344 return;
1345 }
1346 break;
1347 case ROOT::kSTLlist:
1349 case ROOT::kSTLdeque:
1350 case ROOT::kSTLmultiset:
1351 case ROOT::kSTLset:
1354 if (obj) {
1355 if (fProperties & kNeedDelete) {
1357 } else {
1359 }
1360 }
1361 switch (fVal->fCase) {
1362 case kIsFundamental: // Only handle primitives this way
1363 case kIsEnum:
1364 ReadPrimitives(nElements, b, onFileClass);
1365 return;
1366 default:
1367 ReadObjects(nElements, b, onFileClass);
1368 return;
1369 }
1370 break;
1371 case ROOT::kSTLmap:
1372 case ROOT::kSTLmultimap:
1375 if (obj) {
1376 if (fProperties & kNeedDelete) {
1378 } else {
1380 }
1381 }
1382 ReadMap(nElements, b, onFileClass);
1383 break;
1384 }
1385 }
1386}
1387
1389{
1390 // TClassStreamer IO overload.
1391 if (b.IsReading()) { //Read mode
1392 int nElements = 0;
1393 b >> nElements;
1394 if (fEnv->fObject) {
1396 }
1397 if (nElements > 0) {
1398 switch (fSTL_type) {
1399 case ROOT::kSTLbitset:
1400 ReadPrimitives(nElements, b, fOnFileClass);
1401 return;
1402 case ROOT::kSTLvector:
1403 case ROOT::kSTLlist:
1404 case ROOT::kSTLdeque:
1405 case ROOT::kSTLmultiset:
1406 case ROOT::kSTLset:
1409 switch (fVal->fCase) {
1410 case kIsFundamental: // Only handle primitives this way
1411 case kIsEnum:
1412 ReadPrimitives(nElements, b, fOnFileClass);
1413 return;
1414 default:
1415 ReadObjects(nElements, b, fOnFileClass);
1416 return;
1417 }
1418 break;
1419 case ROOT::kSTLmap:
1420 case ROOT::kSTLmultimap:
1423 ReadMap(nElements, b, fOnFileClass);
1424 break;
1425 }
1426 }
1427 } else { // Write case
1428 int nElements = fEnv->fObject ? *(size_t*)fSize.invoke(fEnv) : 0;
1429 b << nElements;
1430 if (nElements > 0) {
1431 switch (fSTL_type) {
1432 case ROOT::kSTLbitset:
1433 WritePrimitives(nElements, b);
1434 return;
1435 case ROOT::kSTLvector:
1436 case ROOT::kSTLlist:
1438 case ROOT::kSTLdeque:
1439 case ROOT::kSTLmultiset:
1440 case ROOT::kSTLset:
1443 switch (fVal->fCase) {
1444 case kIsFundamental: // Only handle primitives this way
1445 case kIsEnum:
1446 WritePrimitives(nElements, b);
1447 return;
1448 default:
1449 WriteObjects(nElements, b);
1450 return;
1451 }
1452 break;
1453 case ROOT::kSTLmap:
1454 case ROOT::kSTLmultimap:
1457 WriteMap(nElements, b);
1458 break;
1459 }
1460 }
1461 }
1462}
1463
1465{
1466 // TClassStreamer IO overload.
1467 if (b.IsReading()) { //Read mode
1468 int nElements = 0;
1469 b >> nElements;
1470 if (fEnv->fObject) {
1472 }
1473 if (nElements > 0) {
1474 switch (fSTL_type) {
1475 case ROOT::kSTLmap:
1476 case ROOT::kSTLmultimap:
1479 ReadMap(nElements, b, fOnFileClass);
1480 break;
1481 case ROOT::kSTLvector:
1482 case ROOT::kSTLlist:
1484 case ROOT::kSTLdeque:
1485 case ROOT::kSTLmultiset:
1486 case ROOT::kSTLset:
1489 ReadPairFromMap(nElements, b);
1490 break;
1491 }
1492 default:
1493 break;
1494 }
1495 }
1496 } else { // Write case
1497 Streamer(b);
1498 }
1499}
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:54
unsigned short UShort_t
Definition: RtypesCore.h:36
double Double32_t
Definition: RtypesCore.h:56
int Int_t
Definition: RtypesCore.h:41
unsigned char UChar_t
Definition: RtypesCore.h:34
char Char_t
Definition: RtypesCore.h:29
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
unsigned long ULong_t
Definition: RtypesCore.h:51
long Long_t
Definition: RtypesCore.h:50
bool Bool_t
Definition: RtypesCore.h:59
short Short_t
Definition: RtypesCore.h:35
double Double_t
Definition: RtypesCore.h:55
long long Long64_t
Definition: RtypesCore.h:69
unsigned long long ULong64_t
Definition: RtypesCore.h:70
float Float_t
Definition: RtypesCore.h:53
@ 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:77
@ kIsClass
Definition: TDictionary.h:65
@ kIsEnum
Definition: TDictionary.h:68
@ kIsFundamental
Definition: TDictionary.h:70
#define R__ASSERT(e)
Definition: TError.h:96
void Error(const char *location, const char *msgfmt,...)
void Fatal(const char *location, const char *msgfmt,...)
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)
static T * getaddress(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)
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:42
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:75
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:4440
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
Definition: TClass.cxx:2835
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
Describe Streamer information for one class version.
Definition: TStreamerInfo.h:43
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:131
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
@ 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.
Definition: TClassEdit.cxx:995
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)
Helper class to facilitate I/O.
void read_tstring_pointer(Bool_t vsn3, TBuffer &b)