Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
33#include <memory>
34
36 : TGenCollectionProxy(copy), fReadBufferFunc(&TGenCollectionStreamer::ReadBufferDefault)
37{
38 // Build a Streamer for an emulated vector whose type is 'name'.
39}
40
42 : TGenCollectionProxy(info, iter_size), fReadBufferFunc(&TGenCollectionStreamer::ReadBufferDefault)
43{
44 // Build a Streamer for a collection whose type is described by 'collectionClass'.
45}
46
48 : TGenCollectionProxy(info, cl), fReadBufferFunc(&TGenCollectionStreamer::ReadBufferDefault)
49{
50 // Build a Streamer for a collection whose type is described by 'collectionClass'.
51}
52
54{
55 // Standard destructor.
56}
57
59{
60 // Virtual copy constructor.
61 if (!fValue.load()) Initialize(kFALSE);
62 return new TGenCollectionStreamer(*this);
63}
64
65template <typename T>
67
68template <>
70{
71 return &itm.boolean;
72}
73
74template <>
76{
77 return &itm.s_char;
78}
79
80template <>
82{
83 return &itm.s_short;
84}
85
86template <>
88{
89 return &itm.s_int;
90}
91
92template <>
94{
95 return &itm.s_long;
96}
97
98template <>
100{
101 return &itm.s_longlong;
102}
103
104template <>
106{
107 return &itm.flt;
108}
109
110template <>
112{
113 return &itm.dbl;
114}
115
116template <>
118{
119 return &itm.u_char;
120}
121
122template <>
124{
125 return &itm.u_short;
126}
127
128template <>
130{
131 return &itm.u_int;
132}
133
134template <>
136{
137 return &itm.u_long;
138}
139
140template <>
142{
143 return &itm.u_longlong;
144}
145
146template <typename From, typename To>
148{
149 From *r = getaddress<From>( *read );
150 To *w = getaddress<To>( *write );
151 for(int i = 0; i < nElements; ++i) {
152 // getvalue<To>( write[i] ) = (To) getvalue<From>( read[i] );
153 w[i] = (To)r[i];
154 }
155}
156
157template <typename From>
159{
160 switch(writeType) {
161 case kBool_t:
162 ConvertArray<From,bool>(read,write,nElements);
163 break;
164 case kChar_t:
165 ConvertArray<From,Char_t>(read,write,nElements);
166 break;
167 case kShort_t:
168 ConvertArray<From,Short_t>(read,write,nElements);
169 break;
170 case kInt_t:
171 ConvertArray<From,Int_t>(read,write,nElements);
172 break;
173 case kLong_t:
174 ConvertArray<From,Long64_t>(read,write,nElements);
175 break;
176 case kLong64_t:
177 ConvertArray<From,Long64_t>(read,write,nElements);
178 break;
179 case kFloat_t:
180 ConvertArray<From,Float_t>(read,write,nElements);
181 break;
182 case kFloat16_t:
183 ConvertArray<From,Float16_t>(read,write,nElements);
184 break;
185 case kDouble_t:
186 ConvertArray<From,Double_t>(read,write,nElements);
187 break;
188 case kUChar_t:
189 ConvertArray<From,UChar_t>(read,write,nElements);
190 break;
191 case kUShort_t:
192 ConvertArray<From,UShort_t>(read,write,nElements);
193 break;
194 case kUInt_t:
195 ConvertArray<From,UInt_t>(read,write,nElements);
196 break;
197 case kULong_t:
198 ConvertArray<From,ULong_t>(read,write,nElements);
199 break;
200 case kULong64_t:
201 ConvertArray<From,ULong64_t>(read,write,nElements);
202 break;
203 case kDouble32_t:
204 ConvertArray<From,Double32_t>(read,write,nElements);
205 break;
206 case kchar:
207 case kNoType_t:
208 case kOther_t:
209 Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", writeType);
210 }
211}
212
213void TGenCollectionStreamer::ReadPrimitives(int nElements, TBuffer &b, const TClass *onFileClass)
214{
215 // Primitive input streamer.
216 size_t len = fValDiff * nElements;
217 char buffer[8096];
218 Bool_t feed = false;
219 void* memory = 0;
220 StreamHelper* itmstore = 0;
221 StreamHelper* itmconv = 0;
222 fEnv->fSize = nElements;
223 // TODO could RVec use something faster the default?
224 switch (fSTL_type) {
225 case ROOT::kSTLvector:
226 if (fVal->fKind != kBool_t) {
228 fEnv->fIdx = 0;
229
231 iterators.CreateIterators(fEnv->fObject);
232 itmstore = (StreamHelper*)iterators.fBegin;
233 fEnv->fStart = itmstore;
234 break;
235 }
236 default:
237 feed = true;
238 itmstore = (StreamHelper*)(len < sizeof(buffer) ? buffer : memory =::operator new(len));
239 break;
240 }
241 fEnv->fStart = itmstore;
242
243 StreamHelper *itmread;
244 int readkind;
245 if (onFileClass) {
246 readkind = onFileClass->GetCollectionProxy()->GetType();
247 itmconv = (StreamHelper*) ::operator new( nElements * onFileClass->GetCollectionProxy()->GetIncrement() );
248 itmread = itmconv;
249 } else {
250 itmread = itmstore;
251 readkind = fVal->fKind;
252 }
253 switch (readkind) {
254 case kBool_t:
255 b.ReadFastArray(&itmread->boolean , nElements);
256 break;
257 case kChar_t:
258 b.ReadFastArray(&itmread->s_char , nElements);
259 break;
260 case kShort_t:
261 b.ReadFastArray(&itmread->s_short , nElements);
262 break;
263 case kInt_t:
264 b.ReadFastArray(&itmread->s_int , nElements);
265 break;
266 case kLong_t:
267 b.ReadFastArray(&itmread->s_long , nElements);
268 break;
269 case kLong64_t:
270 b.ReadFastArray(&itmread->s_longlong, nElements);
271 break;
272 case kFloat_t:
273 b.ReadFastArray(&itmread->flt , nElements);
274 break;
275 case kFloat16_t:
276 b.ReadFastArrayFloat16(&itmread->flt, nElements);
277 break;
278 case kDouble_t:
279 b.ReadFastArray(&itmread->dbl , nElements);
280 break;
281 case kUChar_t:
282 b.ReadFastArray(&itmread->u_char , nElements);
283 break;
284 case kUShort_t:
285 b.ReadFastArray(&itmread->u_short , nElements);
286 break;
287 case kUInt_t:
288 b.ReadFastArray(&itmread->u_int , nElements);
289 break;
290 case kULong_t:
291 b.ReadFastArray(&itmread->u_long , nElements);
292 break;
293 case kULong64_t:
294 b.ReadFastArray(&itmread->u_longlong, nElements);
295 break;
296 case kDouble32_t:
297 b.ReadFastArrayDouble32(&itmread->dbl, nElements);
298 break;
299 case kchar:
300 case kNoType_t:
301 case kOther_t:
302 Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", readkind);
303 }
304 if (onFileClass) {
305 switch (readkind) {
306 case kBool_t:
307 DispatchConvertArray<bool>(fVal->fKind, itmread, itmstore, nElements);
308 break;
309 case kChar_t:
310 DispatchConvertArray<Char_t>(fVal->fKind, itmread, itmstore, nElements);
311 break;
312 case kShort_t:
313 DispatchConvertArray<Short_t>(fVal->fKind, itmread, itmstore, nElements);
314 break;
315 case kInt_t:
316 DispatchConvertArray<Int_t>(fVal->fKind, itmread, itmstore, nElements);
317 break;
318 case kLong_t:
319 DispatchConvertArray<Long_t>(fVal->fKind, itmread, itmstore, nElements);
320 break;
321 case kLong64_t:
322 DispatchConvertArray<Long64_t>(fVal->fKind, itmread, itmstore, nElements);
323 break;
324 case kFloat_t:
325 DispatchConvertArray<Float_t>(fVal->fKind, itmread, itmstore, nElements);
326 break;
327 case kFloat16_t:
328 DispatchConvertArray<Float16_t>(fVal->fKind, itmread, itmstore, nElements);
329 break;
330 case kDouble_t:
331 DispatchConvertArray<Double_t>(fVal->fKind, itmread, itmstore, nElements);
332 break;
333 case kUChar_t:
334 DispatchConvertArray<UChar_t>(fVal->fKind, itmread, itmstore, nElements);
335 break;
336 case kUShort_t:
337 DispatchConvertArray<UShort_t>(fVal->fKind, itmread, itmstore, nElements);
338 break;
339 case kUInt_t:
340 DispatchConvertArray<UInt_t>(fVal->fKind, itmread, itmstore, nElements);
341 break;
342 case kULong_t:
343 DispatchConvertArray<ULong_t>(fVal->fKind, itmread, itmstore, nElements);
344 break;
345 case kULong64_t:
346 DispatchConvertArray<ULong64_t>(fVal->fKind, itmread, itmstore, nElements);
347 break;
348 case kDouble32_t:
349 DispatchConvertArray<Double_t>(fVal->fKind, itmread, itmstore, nElements);
350 break;
351 case kchar:
352 case kNoType_t:
353 case kOther_t:
354 Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", readkind);
355 }
356 ::operator delete((void*)itmconv);
357 }
358 if (feed) { // need to feed in data...
359 fEnv->fStart = fFeed(itmstore,fEnv->fObject,fEnv->fSize);
360 if (memory) {
361 ::operator delete(memory);
362 }
363 }
364}
365
366void TGenCollectionStreamer::ReadObjects(int nElements, TBuffer &b, const TClass *onFileClass)
367{
368 // Object input streamer.
369 Bool_t vsn3 = b.GetInfo() && b.GetInfo()->GetOldVersion() <= 3;
370 size_t len = fValDiff * nElements;
371 StreamHelper* itm = 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 ));
392 case kBIT_ISSTRING:
393 DOLOOP(i->read_std_string(b));
394 case kIsPointer | kIsClass:
395 DOLOOP(i->set(b.ReadObjectAny(fVal->fType)));
396 case 0U | kIsPointer | kBIT_ISSTRING:
397 DOLOOP(i->read_std_string_pointer(b));
398 case 0U | kIsPointer | kBIT_ISTSTRING | kIsClass:
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)));
421 case 0U | kIsPointer | kBIT_ISSTRING:
422 DOLOOP(i->read_std_string_pointer(b));
423 case 0U | kIsPointer | kBIT_ISTSTRING | kIsClass:
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 auto buffer = std::make_unique<char[]>(len);
437 fEnv->fStart = itm = reinterpret_cast<StreamHelper *>(buffer.get());
438 fConstruct(itm,nElements);
439 switch (fVal->fCase) {
440 case kIsClass:
441 DOLOOP(b.StreamObject(i, fVal->fType, onFileValClass));
444 break;
445 case kBIT_ISSTRING:
446 DOLOOP(i->read_std_string(b))
449 break;
450 case kIsPointer | kIsClass:
451 DOLOOP(i->set(b.ReadObjectAny(fVal->fType)));
453 break;
454 case 0U | kIsPointer | kBIT_ISSTRING:
455 DOLOOP(i->read_std_string_pointer(b))
457 break;
458 case 0U | kIsPointer | kBIT_ISTSTRING | kIsClass:
459 DOLOOP(i->read_tstring_pointer(vsn3, b));
461 break;
462 }
463#undef DOLOOP
464 break;
465 }
466 default:
467 break;
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
480 R__ASSERT(pinfo);
482
483 int nested = 0;
484 std::vector<std::string> inside;
485 TClassEdit::GetSplit(pinfo->GetName(), inside, nested);
486 Value first(inside[1],kFALSE);
487 Value second(inside[2],kFALSE);
488 fValOffset = ((TStreamerElement*)pinfo->GetElements()->At(1))->GetOffset();
489
490 fEnv->fSize = nElements;
491 switch (fSTL_type) {
492 // Simple case: contiguous memory. get address of first, then jump.
493 case ROOT::kSTLvector:
494#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
496 fEnv->fIdx = 0;
497
498 {
500 iterators.CreateIterators(fEnv->fObject);
501 itm = (StreamHelper*)iterators.fBegin;
502 }
503 fEnv->fStart = itm;
504 switch (fVal->fCase) {
505 case kIsClass:
506 DOLOOP(
507 ReadMapHelper(i, &first, vsn3, b);
508 ReadMapHelper((StreamHelper*)(((char*)i) + fValOffset), &second, vsn3, b)
509 );
510 }
511#undef DOLOOP
512 break;
513
514 // No contiguous memory, but resize is possible
515 // Hence accessing objects using At(i) should be not too much an overhead
516 case ROOT::kSTLlist:
518 case ROOT::kSTLdeque:
519 case ROOT::kROOTRVec: // TODO could we do something faster?
520#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)TGenCollectionProxy::At(idx); { x ;} ++idx;} break;}
522 fEnv->fIdx = 0;
523 {
525 iterators.CreateIterators(fEnv->fObject);
526 fEnv->fStart = iterators.fBegin;
527 }
528 switch (fVal->fCase) {
529 case kIsClass:
530 DOLOOP(
531 char **where = (char**)(void*) & i;
532 b.ApplySequence(*(pinfo->GetReadObjectWiseActions()), where);
533 );
534 }
535#undef DOLOOP
536 break;
537
538 // Rather troublesome case: Objects can only be fed into the container
539 // Once they are created. Need to take memory from stack or heap.
541 case ROOT::kSTLset:
544#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;}}
545 auto buffer = std::make_unique<char[]>(len);
546 fEnv->fStart = itm = reinterpret_cast<StreamHelper *>(buffer.get());
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 }
561 default:
562 break;
563 }
564}
565
566
568{
569 // helper class to read std::map
570
571 float f;
572
573 switch (v->fCase) {
574 case kIsFundamental: // Only handle primitives this way
575 case kIsEnum:
576 switch (int(v->fKind)) {
577 case kBool_t:
578 b >> i->boolean;
579 break;
580 case kChar_t:
581 b >> i->s_char;
582 break;
583 case kShort_t:
584 b >> i->s_short;
585 break;
586 case kInt_t:
587 b >> i->s_int;
588 break;
589 case kLong_t:
590 b >> i->s_long;
591 break;
592 case kLong64_t:
593 b >> i->s_longlong;
594 break;
595 case kFloat_t:
596 b >> i->flt;
597 break;
598 case kFloat16_t:
599 b >> f;
600 i->flt = float(f);
601 break;
602 case kDouble_t:
603 b >> i->dbl;
604 break;
605 case kUChar_t:
606 b >> i->u_char;
607 break;
608 case kUShort_t:
609 b >> i->u_short;
610 break;
611 case kUInt_t:
612 b >> i->u_int;
613 break;
614 case kULong_t:
615 b >> i->u_long;
616 break;
617 case kULong64_t:
618 b >> i->u_longlong;
619 break;
620 case kDouble32_t:
621 b >> f;
622 i->dbl = double(f);
623 break;
624 case kchar:
625 case kNoType_t:
626 case kOther_t:
627 Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", v->fKind);
628 }
629 break;
630 case kIsClass:
631 b.StreamObject(i, v->fType);
632 break;
633 case kBIT_ISSTRING:
634 i->read_std_string(b);
635 break;
636 case kIsPointer | kIsClass:
637 i->set(b.ReadObjectAny(v->fType));
638 break;
639 case 0U | kIsPointer | kBIT_ISSTRING:
641 break;
642 case 0U | kIsPointer | kBIT_ISTSTRING | kIsClass:
643 i->read_tstring_pointer(vsn3, b);
644 break;
645 }
646}
647
648template <typename To>
649To readOneValue(TBuffer &b, int readtype) {
652 switch (readtype) {
653 case kBool_t:
654 b >> i->boolean;
655 return (To)i->boolean;
656 break;
657 case kChar_t:
658 b >> i->s_char;
659 return (To)i->s_char;
660 break;
661 case kShort_t:
662 b >> i->s_short;
663 return (To)i->s_short;
664 break;
665 case kInt_t:
666 b >> i->s_int;
667 return (To)i->s_int;
668 break;
669 case kLong_t:
670 b >> i->s_long;
671 return (To)i->s_long;
672 break;
673 case kLong64_t:
674 b >> i->s_longlong;
675 return (To)i->s_longlong;
676 break;
677 case kFloat_t:
678 b >> i->flt;
679 return (To)i->flt;
680 break;
681 case kFloat16_t:
682 b >> i->flt;
683 return (To)i->flt;
684 break;
685 case kDouble_t:
686 b >> i->dbl;
687 return (To)i->dbl;
688 break;
689 case kUChar_t:
690 b >> i->u_char;
691 return (To)i->u_char;
692 break;
693 case kUShort_t:
694 b >> i->u_short;
695 return (To)i->u_short;
696 break;
697 case kUInt_t:
698 b >> i->u_int;
699 return (To)i->u_int;
700 break;
701 case kULong_t:
702 b >> i->u_long;
703 return (To)i->u_long;
704 break;
705 case kULong64_t:
706 b >> i->u_longlong;
707 return (To)i->u_longlong;
708 break;
709 case kDouble32_t: {
710 float f;
711 b >> f;
712 i->dbl = double(f);
713 return (To)i->dbl;
714 break;
715 }
716 case kchar:
717 case kNoType_t:
718 case kOther_t:
719 Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", readtype);
720 }
721 return 0;
722}
723
724
725void TGenCollectionStreamer::ReadMap(int nElements, TBuffer &b, const TClass *onFileClass)
726{
727 // Map input streamer.
728 Bool_t vsn3 = b.GetInfo() && b.GetInfo()->GetOldVersion() <= 3;
729 size_t len = fValDiff * nElements;
730 Value *v;
731 char buffer[8096], *addr, *temp;
732 void* memory = 0;
733 StreamHelper* i;
734 float f;
735 fEnv->fSize = nElements;
736 fEnv->fStart = (len < sizeof(buffer) ? buffer : memory =::operator new(len));
737 addr = temp = (char*)fEnv->fStart;
738 fConstruct(addr,nElements);
739
740 int onFileValueKind[2];
741 if (onFileClass) {
742 TClass *onFileValueClass = onFileClass->GetCollectionProxy()->GetValueClass();
743 TVirtualStreamerInfo *sourceInfo = onFileValueClass->GetStreamerInfo();
744 onFileValueKind[0] = ((TStreamerElement*)sourceInfo->GetElements()->At(0))->GetType();
745 onFileValueKind[1] = ((TStreamerElement*)sourceInfo->GetElements()->At(1))->GetType();
746 }
747 for (int loop, idx = 0; idx < nElements; ++idx) {
748 addr = temp + fValDiff * idx;
749 v = fKey;
750 for (loop = 0; loop < 2; loop++) {
751 i = (StreamHelper*)addr;
752 switch (v->fCase) {
753 case kIsFundamental: // Only handle primitives this way
754 case kIsEnum:
755 if (onFileClass) {
756 int readtype = (int)(onFileValueKind[loop]);
757 switch (int(v->fKind)) {
758 case kBool_t:
759 i->boolean = readOneValue<bool>(b,readtype);
760 break;
761 case kChar_t:
762 i->s_char = readOneValue<Char_t>(b,readtype);
763 break;
764 case kShort_t:
765 i->s_short = readOneValue<Short_t>(b,readtype);
766 break;
767 case kInt_t:
768 i->s_int = readOneValue<Int_t>(b,readtype);
769 break;
770 case kLong_t:
771 i->s_long = readOneValue<Long_t>(b,readtype);
772 break;
773 case kLong64_t:
774 i->s_longlong = readOneValue<Long64_t>(b,readtype);
775 break;
776 case kFloat_t:
777 i->flt = readOneValue<Float_t>(b,readtype);
778 break;
779 case kFloat16_t:
780 i->flt = readOneValue<Float16_t>(b,readtype);
781 break;
782 case kDouble_t:
783 i->dbl = readOneValue<Double_t>(b,readtype);
784 break;
785 case kUChar_t:
786 i->u_char = readOneValue<UChar_t>(b,readtype);
787 break;
788 case kUShort_t:
789 i->u_short = readOneValue<UShort_t>(b,readtype);
790 break;
791 case kUInt_t:
792 i->u_int = readOneValue<UInt_t>(b,readtype);
793 break;
794 case kULong_t:
795 i->u_long = readOneValue<ULong_t>(b,readtype);
796 break;
797 case kULong64_t:
798 i->u_longlong = readOneValue<ULong64_t>(b,readtype);
799 break;
800 case kDouble32_t:
801 i->dbl = readOneValue<Double32_t>(b,readtype);
802 break;
803 case kchar:
804 case kNoType_t:
805 case kOther_t:
806 Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", v->fKind);
807 }
808 } else {
809 switch (int(v->fKind)) {
810 case kBool_t:
811 b >> i->boolean;
812 break;
813 case kChar_t:
814 b >> i->s_char;
815 break;
816 case kShort_t:
817 b >> i->s_short;
818 break;
819 case kInt_t:
820 b >> i->s_int;
821 break;
822 case kLong_t:
823 b >> i->s_long;
824 break;
825 case kLong64_t:
826 b >> i->s_longlong;
827 break;
828 case kFloat_t:
829 b >> i->flt;
830 break;
831 case kFloat16_t:
832 b >> f;
833 i->flt = float(f);
834 break;
835 case kDouble_t:
836 b >> i->dbl;
837 break;
838 case kUChar_t:
839 b >> i->u_char;
840 break;
841 case kUShort_t:
842 b >> i->u_short;
843 break;
844 case kUInt_t:
845 b >> i->u_int;
846 break;
847 case kULong_t:
848 b >> i->u_long;
849 break;
850 case kULong64_t:
851 b >> i->u_longlong;
852 break;
853 case kDouble32_t:
854 b >> f;
855 i->dbl = double(f);
856 break;
857 case kchar:
858 case kNoType_t:
859 case kOther_t:
860 Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", v->fKind);
861 }
862 }
863 break;
864 case kIsClass:
865 b.StreamObject(i, v->fType);
866 break;
867 case kBIT_ISSTRING:
868 i->read_std_string(b);
869 break;
870 case kIsPointer | kIsClass:
871 i->set(b.ReadObjectAny(v->fType));
872 break;
873 case 0U | kIsPointer | kBIT_ISSTRING:
875 break;
876 case 0U | kIsPointer | kBIT_ISTSTRING | kIsClass:
877 i->read_tstring_pointer(vsn3, b);
878 break;
879 }
880 v = fVal;
881 addr += fValOffset;
882 }
883 }
886 if (memory) {
887 ::operator delete(memory);
888 }
889}
890
892{
893 // Primitive output streamer.
894 size_t len = fValDiff * nElements;
895 char buffer[8192];
896 void* memory = 0;
897 StreamHelper* itm = 0;
898 switch (fSTL_type) {
899 case ROOT::kSTLvector:
900 if (fVal->fKind != kBool_t) {
902 break;
903 }
904 default:
905 fEnv->fStart = itm = (StreamHelper*)(len < sizeof(buffer) ? buffer : memory =::operator new(len));
906 fCollect(fEnv->fObject,itm);
907 break;
908 }
909 switch (int(fVal->fKind)) {
910 case kBool_t:
911 b.WriteFastArray(&itm->boolean , nElements);
912 break;
913 case kChar_t:
914 b.WriteFastArray(&itm->s_char , nElements);
915 break;
916 case kShort_t:
917 b.WriteFastArray(&itm->s_short , nElements);
918 break;
919 case kInt_t:
920 b.WriteFastArray(&itm->s_int , nElements);
921 break;
922 case kLong_t:
923 b.WriteFastArray(&itm->s_long , nElements);
924 break;
925 case kLong64_t:
926 b.WriteFastArray(&itm->s_longlong, nElements);
927 break;
928 case kFloat_t:
929 b.WriteFastArray(&itm->flt , nElements);
930 break;
931 case kFloat16_t:
932 b.WriteFastArrayFloat16(&itm->flt, nElements);
933 break;
934 case kDouble_t:
935 b.WriteFastArray(&itm->dbl , nElements);
936 break;
937 case kUChar_t:
938 b.WriteFastArray(&itm->u_char , nElements);
939 break;
940 case kUShort_t:
941 b.WriteFastArray(&itm->u_short , nElements);
942 break;
943 case kUInt_t:
944 b.WriteFastArray(&itm->u_int , nElements);
945 break;
946 case kULong_t:
947 b.WriteFastArray(&itm->u_long , nElements);
948 break;
949 case kULong64_t:
950 b.WriteFastArray(&itm->u_longlong, nElements);
951 break;
952 case kDouble32_t:
953 b.WriteFastArrayDouble32(&itm->dbl, nElements);
954 break;
955 case kchar:
956 case kNoType_t:
957 case kOther_t:
958 Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", fVal->fKind);
959 }
960 if (memory) {
961 ::operator delete(memory);
962 }
963}
964
966{
967 // Object output streamer.
968 StreamHelper* itm = 0;
969 switch (fSTL_type) {
970 // Simple case: contiguous memory. get address of first, then jump.
971 case ROOT::kSTLvector:
972#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
974 switch (fVal->fCase) {
975 case kIsClass:
976 DOLOOP(b.StreamObject(i, fVal->fType));
977 break;
978 case kBIT_ISSTRING:
979 DOLOOP(TString(i->c_str()).Streamer(b));
980 break;
981 case kIsPointer | kIsClass:
982 DOLOOP(b.WriteObjectAny(i->ptr(), fVal->fType));
983 break;
984 case 0U | kBIT_ISSTRING | kIsPointer:
985 DOLOOP(i->write_std_string_pointer(b));
986 break;
987 case 0U | kBIT_ISTSTRING | kIsClass | kIsPointer:
988 DOLOOP(i->write_tstring_pointer(b));
989 break;
990 }
991#undef DOLOOP
992 break;
993
994 // No contiguous memory, but resize is possible
995 // Hence accessing objects using At(i) should be not too much an overhead
996 case ROOT::kSTLlist:
998 case ROOT::kSTLdeque:
1000 case ROOT::kSTLset:
1003 case ROOT::kROOTRVec: // TODO could we do something faster?
1004#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)TGenCollectionProxy::At(idx); { x ;} ++idx;} break;}
1005 switch (fVal->fCase) {
1006 case kIsClass:
1007 DOLOOP(b.StreamObject(i, fVal->fType));
1008 case kBIT_ISSTRING:
1009 DOLOOP(TString(i->c_str()).Streamer(b));
1010 case kIsPointer | kIsClass:
1011 DOLOOP(b.WriteObjectAny(i->ptr(), fVal->fType));
1012 case 0U | kBIT_ISSTRING | kIsPointer:
1013 DOLOOP(i->write_std_string_pointer(b));
1014 case 0U | kBIT_ISTSTRING | kIsClass | kIsPointer:
1015 DOLOOP(i->write_tstring_pointer(b));
1016 }
1017#undef DOLOOP
1018 break;
1019 default:
1020 break;
1021 }
1022}
1023
1025{
1026 // Map output streamer
1027 StreamHelper* i;
1028 Value *v;
1029
1030 for (int loop, idx = 0; idx < nElements; ++idx) {
1031 char* addr = (char*)TGenCollectionProxy::At(idx);
1032 v = fKey;
1033 for (loop = 0; loop < 2; ++loop) {
1034 i = (StreamHelper*)addr;
1035 switch (v->fCase) {
1036 case kIsFundamental: // Only handle primitives this way
1037 case kIsEnum:
1038 switch (int(v->fKind)) {
1039 case kBool_t:
1040 b << i->boolean;
1041 break;
1042 case kChar_t:
1043 b << i->s_char;
1044 break;
1045 case kShort_t:
1046 b << i->s_short;
1047 break;
1048 case kInt_t:
1049 b << i->s_int;
1050 break;
1051 case kLong_t:
1052 b << i->s_long;
1053 break;
1054 case kLong64_t:
1055 b << i->s_longlong;
1056 break;
1057 case kFloat_t:
1058 b << i->flt;
1059 break;
1060 case kFloat16_t:
1061 b << float(i->flt);
1062 break;
1063 case kDouble_t:
1064 b << i->dbl;
1065 break;
1066 case kUChar_t:
1067 b << i->u_char;
1068 break;
1069 case kUShort_t:
1070 b << i->u_short;
1071 break;
1072 case kUInt_t:
1073 b << i->u_int;
1074 break;
1075 case kULong_t:
1076 b << i->u_long;
1077 break;
1078 case kULong64_t:
1079 b << i->u_longlong;
1080 break;
1081 case kDouble32_t:
1082 b << float(i->dbl);
1083 break;
1084 case kchar:
1085 case kNoType_t:
1086 case kOther_t:
1087 Error("TGenCollectionStreamer", "fType %d is not supported yet!\n", v->fKind);
1088 }
1089 break;
1090 case kIsClass:
1091 b.StreamObject(i, v->fType);
1092 break;
1093 case kBIT_ISSTRING:
1094 TString(i->c_str()).Streamer(b);
1095 break;
1096 case kIsPointer | kIsClass:
1097 b.WriteObjectAny(i->ptr(), v->fType);
1098 break;
1099 case 0U | kBIT_ISSTRING | kIsPointer:
1101 break;
1102 case 0U | kBIT_ISTSTRING | kIsClass | kIsPointer:
1104 break;
1105 }
1106 addr += fValOffset;
1107 v = fVal;
1108 }
1109 }
1110}
1111
1112template <typename From, typename To>
1114{
1115 From *temp = new From[nElements];
1116 b.ReadFastArray(temp, nElements);
1117 std::vector<To> *const vec = (std::vector<To>*)(obj);
1118 for(Int_t ind = 0; ind < nElements; ++ind) {
1119 (*vec)[ind] = (To)temp[ind];
1120 }
1121 delete [] temp;
1122}
1123
1124template <typename To>
1126{
1127 Float16_t *temp = new Float16_t[nElements];
1128 b.ReadFastArrayFloat16(temp, nElements);
1129 std::vector<To> *const vec = (std::vector<To>*)(obj);
1130 for(Int_t ind = 0; ind < nElements; ++ind) {
1131 (*vec)[ind] = (To)temp[ind];
1132 }
1133 delete [] temp;
1134}
1135
1136template <typename To>
1138{
1139 Double32_t *temp = new Double32_t[nElements];
1140 b.ReadFastArrayDouble32(temp, nElements);
1141 std::vector<To> *const vec = (std::vector<To>*)(obj);
1142 for(Int_t ind = 0; ind < nElements; ++ind) {
1143 (*vec)[ind] = (To)temp[ind];
1144 }
1145 delete [] temp;
1146}
1147
1148template <typename To>
1150{
1151 switch ((TStreamerInfo::EReadWrite)onFileProxy->GetType()) {
1152 case TStreamerInfo::kBool: ConvertBufferVectorPrimitives<Bool_t ,To>(b,obj,nElements); break;
1153 case TStreamerInfo::kChar: ConvertBufferVectorPrimitives<Char_t ,To>(b,obj,nElements); break;
1154 case TStreamerInfo::kShort: ConvertBufferVectorPrimitives<Short_t ,To>(b,obj,nElements); break;
1155 case TStreamerInfo::kInt: ConvertBufferVectorPrimitives<Int_t ,To>(b,obj,nElements); break;
1156 case TStreamerInfo::kLong: ConvertBufferVectorPrimitives<Long_t ,To>(b,obj,nElements); break;
1157 case TStreamerInfo::kLong64: ConvertBufferVectorPrimitives<Long64_t ,To>(b,obj,nElements); break;
1158 case TStreamerInfo::kFloat: ConvertBufferVectorPrimitives<Float_t ,To>(b,obj,nElements); break;
1159 case TStreamerInfo::kFloat16: ConvertBufferVectorPrimitives<Float16_t ,To>(b,obj,nElements); break;
1160 case TStreamerInfo::kDouble: ConvertBufferVectorPrimitives<Double_t ,To>(b,obj,nElements); break;
1161 case TStreamerInfo::kDouble32: ConvertBufferVectorPrimitives<Double32_t,To>(b,obj,nElements); break;
1162 case TStreamerInfo::kUChar: ConvertBufferVectorPrimitives<UChar_t ,To>(b,obj,nElements); break;
1163 case TStreamerInfo::kUShort: ConvertBufferVectorPrimitives<UShort_t ,To>(b,obj,nElements); break;
1164 case TStreamerInfo::kUInt: ConvertBufferVectorPrimitives<UInt_t ,To>(b,obj,nElements); break;
1165 case TStreamerInfo::kULong: ConvertBufferVectorPrimitives<ULong_t ,To>(b,obj,nElements); break;
1166 case TStreamerInfo::kULong64: ConvertBufferVectorPrimitives<ULong64_t ,To>(b,obj,nElements); break;
1167 default: break;
1168 }
1169}
1170
1171template <typename basictype>
1173{
1174 int nElements = 0;
1175 b >> nElements;
1176 fResize(obj,nElements);
1177
1178 if (onFileClass) {
1179 DispatchConvertBufferVectorPrimitives<basictype>(b,obj,nElements,onFileClass->GetCollectionProxy());
1180 } else {
1182 iterators.CreateIterators(obj);
1183 b.ReadFastArray((basictype*)iterators.fBegin, nElements);
1184 }
1185}
1186
1188{
1189 int nElements = 0;
1190 b >> nElements;
1191 fResize(obj,nElements);
1192
1193 if (onFileClass) {
1194 DispatchConvertBufferVectorPrimitives<Float16_t>(b,obj,nElements,onFileClass->GetCollectionProxy());
1195 } else {
1197 iterators.CreateIterators(obj);
1198 b.ReadFastArrayFloat16((Float16_t*)iterators.fBegin, nElements);
1199 }
1200}
1201
1203{
1204 int nElements = 0;
1205 b >> nElements;
1206 fResize(obj,nElements);
1207
1208 if (onFileClass) {
1209 DispatchConvertBufferVectorPrimitives<Double32_t>(b,obj,nElements,onFileClass->GetCollectionProxy());
1210 } else {
1212 iterators.CreateIterators(obj);
1213 b.ReadFastArrayDouble32((Double32_t*)iterators.fBegin, nElements);
1214 }
1215}
1216
1217
1218
1219void TGenCollectionStreamer::ReadBuffer(TBuffer &b, void *obj, const TClass *onFileClass)
1220{
1221 // Call the specialized function. The first time this call ReadBufferDefault which
1222 // actually set to fReadBufferFunc to the 'right' specialized version.
1223
1224 (this->*fReadBufferFunc)(b,obj,onFileClass);
1225}
1226
1228{
1229 // Call the specialized function. The first time this call ReadBufferDefault which
1230 // actually set to fReadBufferFunc to the 'right' specialized version.
1231
1232 (this->*fReadBufferFunc)(b,obj,0);
1233}
1234
1235void TGenCollectionStreamer::ReadBufferDefault(TBuffer &b, void *obj, const TClass *onFileClass)
1236{
1237
1239
1240 // We will need this later, so let's make sure it is initialized.
1241 if ( !fValue.load() ) InitializeEx(kFALSE);
1243 Fatal("TGenCollectionStreamer::ReadBufferDefault","No CreateIterators function for %s",fName.c_str());
1244 }
1246 {
1247 // Only handle primitives this way
1248 switch (int(fVal->fKind)) {
1249 case kBool_t:
1250 // Nothing use generic for now
1251 break;
1252 case kChar_t:
1253 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Char_t>;
1254 break;
1255 case kShort_t:
1256 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Short_t>;
1257 break;
1258 case kInt_t:
1259 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Int_t>;
1260 break;
1261 case kLong_t:
1262 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Long_t>;
1263 break;
1264 case kLong64_t:
1265 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Long64_t>;
1266 break;
1267 case kFloat_t:
1268 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Float_t>;
1269 break;
1270 case kFloat16_t:
1272 break;
1273 case kDouble_t:
1274 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Double_t>;
1275 break;
1276 case kUChar_t:
1277 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<UChar_t>;
1278 break;
1279 case kUShort_t:
1280 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<UShort_t>;
1281 break;
1282 case kUInt_t:
1283 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<UInt_t>;
1284 break;
1285 case kULong_t:
1286 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<ULong_t>;
1287 break;
1288 case kULong64_t:
1289 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<ULong64_t>;
1290 break;
1291 case kDouble32_t:
1293 break;
1294 case kchar:
1295 case kNoType_t:
1296 case kOther_t:
1297 // Nothing use the generic for now
1298 break;
1299 }
1300 }
1301 // TODO Could we do something better for RVec?
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 case ROOT::kROOTRVec: // TODO could we do something faster?
1355 if (obj) {
1356 if (fProperties & kNeedDelete) {
1358 } else {
1360 }
1361 }
1362 switch (fVal->fCase) {
1363 case kIsFundamental: // Only handle primitives this way
1364 case kIsEnum:
1365 ReadPrimitives(nElements, b, onFileClass);
1366 return;
1367 default:
1368 ReadObjects(nElements, b, onFileClass);
1369 return;
1370 }
1371 break;
1372 case ROOT::kSTLmap:
1373 case ROOT::kSTLmultimap:
1376 if (obj) {
1377 if (fProperties & kNeedDelete) {
1379 } else {
1381 }
1382 }
1383 ReadMap(nElements, b, onFileClass);
1384 break;
1385 }
1386 }
1387}
1388
1390{
1391 // TClassStreamer IO overload.
1392 if (b.IsReading()) { //Read mode
1393 int nElements = 0;
1394 b >> nElements;
1395 if (fEnv->fObject) {
1397 }
1398 if (nElements > 0) {
1399 switch (fSTL_type) {
1400 case ROOT::kSTLbitset:
1401 ReadPrimitives(nElements, b, fOnFileClass);
1402 return;
1403 case ROOT::kSTLvector:
1404 case ROOT::kSTLlist:
1405 case ROOT::kSTLdeque:
1406 case ROOT::kSTLmultiset:
1407 case ROOT::kSTLset:
1410 case ROOT::kROOTRVec: // TODO could we do something faster?
1411 switch (fVal->fCase) {
1412 case kIsFundamental: // Only handle primitives this way
1413 case kIsEnum:
1414 ReadPrimitives(nElements, b, fOnFileClass);
1415 return;
1416 default:
1417 ReadObjects(nElements, b, fOnFileClass);
1418 return;
1419 }
1420 break;
1421 case ROOT::kSTLmap:
1422 case ROOT::kSTLmultimap:
1425 ReadMap(nElements, b, fOnFileClass);
1426 break;
1427 }
1428 }
1429 } else { // Write case
1430 int nElements = fEnv->fObject ? *(size_t*)fSize.invoke(fEnv) : 0;
1431 b << nElements;
1432 if (nElements > 0) {
1433 switch (fSTL_type) {
1434 case ROOT::kSTLbitset:
1435 WritePrimitives(nElements, b);
1436 return;
1437 case ROOT::kSTLvector:
1438 case ROOT::kSTLlist:
1440 case ROOT::kSTLdeque:
1441 case ROOT::kSTLmultiset:
1442 case ROOT::kSTLset:
1445 case ROOT::kROOTRVec: // TODO could we do something faster?
1446 switch (fVal->fCase) {
1447 case kIsFundamental: // Only handle primitives this way
1448 case kIsEnum:
1449 WritePrimitives(nElements, b);
1450 return;
1451 default:
1452 WriteObjects(nElements, b);
1453 return;
1454 }
1455 break;
1456 case ROOT::kSTLmap:
1457 case ROOT::kSTLmultimap:
1460 WriteMap(nElements, b);
1461 break;
1462 }
1463 }
1464 }
1465}
1466
1468{
1469 // TClassStreamer IO overload.
1470 if (b.IsReading()) { //Read mode
1471 int nElements = 0;
1472 b >> nElements;
1473 if (fEnv->fObject) {
1475 }
1476 if (nElements > 0) {
1477 switch (fSTL_type) {
1478 case ROOT::kSTLmap:
1479 case ROOT::kSTLmultimap:
1482 ReadMap(nElements, b, fOnFileClass);
1483 break;
1484 case ROOT::kSTLvector:
1485 case ROOT::kSTLlist:
1487 case ROOT::kSTLdeque:
1488 case ROOT::kSTLmultiset:
1489 case ROOT::kSTLset:
1491 case ROOT::kROOTRVec: // TODO could we do something faster?
1493 ReadPairFromMap(nElements, b);
1494 break;
1495 }
1496 default:
1497 break;
1498 }
1499 }
1500 } else { // Write case
1501 Streamer(b);
1502 }
1503}
#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
int Int_t
Definition RtypesCore.h:45
unsigned char UChar_t
Definition RtypesCore.h:38
char Char_t
Definition RtypesCore.h:37
unsigned long ULong_t
Definition RtypesCore.h:55
long Long_t
Definition RtypesCore.h:54
unsigned int UInt_t
Definition RtypesCore.h:46
float Float_t
Definition RtypesCore.h:57
short Short_t
Definition RtypesCore.h:39
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
double Double_t
Definition RtypesCore.h:59
long long Long64_t
Definition RtypesCore.h:80
unsigned long long ULong64_t
Definition RtypesCore.h:81
@ 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 DOLOOP(x)
#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:185
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:244
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
bool * getaddress< bool >(TGenCollectionProxy::StreamHelper &itm)
void DispatchConvertArray(int writeType, TGenCollectionProxy::StreamHelper *read, TGenCollectionProxy::StreamHelper *write, int nElements)
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:81
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:4599
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
Definition TClass.cxx:2897
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.
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.
EDataType GetType() const override
If the content is a simple numerical value, return its type (see TDataType)
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.
void Clear(const char *opt="") override
Clear the emulated collection.
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.
void * At(UInt_t idx) override
Return the address of the value at index 'idx'.
CreateIterators_t fFunctionCreateIterators
Method fSize
Container accessors: size of container.
Method fClear
Method cache for container accessors: clear container.
Feedfunc_t fFeed
Container accessors: block feed.
CreateIterators_t GetFunctionCreateIterators(Bool_t read=kTRUE) override
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)
void ReadBufferVectorPrimitivesDouble32(TBuffer &b, void *obj, const TClass *onFileClass)
void WriteMap(int nElements, TBuffer &b)
void ReadMapHelper(StreamHelper *i, Value *v, Bool_t vsn3, TBuffer &b)
void Streamer(TBuffer &refBuffer) override
Streamer Function.
void ReadBuffer(TBuffer &b, void *obj, const TClass *onfileClass) override
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)
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)
TVirtualCollectionProxy * Generate() const override
Virtual copy constructor.
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
TObject * At(Int_t idx) const override
Definition TObjArray.h:164
Describes a persistent version of a class.
EReadWrite
Status bits See TVirtualStreamerInfo::EStatusBits for the values.
@ kUChar
Equal to TDataType's kchar.
TStreamerInfoActions::TActionSequence * GetReadObjectWiseActions()
TObjArray * GetElements() const override
Basic string class.
Definition TString.h:139
virtual void Streamer(TBuffer &)
Stream a string object.
Definition TString.cxx:1412
RAII helper class that ensures that PushProxy() / PopProxy() are called when entering / leaving a C++...
Defines a common interface to inspect/change the contents of an object that represents a collection.
virtual ULong_t GetIncrement() const =0
Return the offset between two consecutive in-memory values (which depends on the sizeof() and alignme...
virtual EDataType GetType() const =0
If the value type is a fundamental data type, return its type (see enumeration EDataType).
@ kNeedDelete
The collection contains directly or indirectly (via other collection) some pointers that need explici...
virtual TClass * GetValueClass() const =0
If the value type is a user-defined class, return a pointer to the TClass representing the value type...
Abstract Interface class describing Streamer information for one class.
virtual TObjArray * GetElements() const =0
@ 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
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.
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)