Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEmulatedCollectionProxy.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 TEmulatedCollectionProxy
14 \ingroup IO
15
16Streamer around an arbitrary STL like container, which implements basic
17container functionality.
18
19### Note:
20Although this class contains all the setup necessary to deal
21with maps, the map-like functionality is NOT supported.
22For optimization reasons this functionality is put into
23the class TEmulatedMapProxy.
24*/
25
27#include "TStreamerElement.h"
28#include "TStreamerInfo.h"
29#include "TClassEdit.h"
30#include "TError.h"
31#include "TEnum.h"
32#include "TROOT.h"
33#include <iostream>
34
35#include "TVirtualMutex.h" // For R__LOCKGUARD
36#include "TInterpreter.h" // For gInterpreterMutex
37
38//
39// Utility function to allow the creation of a TClass for a std::pair without
40// a dictionary (See end of file for implementation
41//
42
45{
46 // Build a Streamer for an emulated vector whose type is 'name'.
48}
49
52{
53 // Build a Streamer for a collection whose type is described by 'collectionClass'.
54
55 fName = cl_name;
56 if ( this->TEmulatedCollectionProxy::InitializeEx(silent) ) {
58 }
60}
61
63{
64 // Standard destructor
65 if ( fEnv && fEnv->fObject ) {
66 Clear();
67 }
68}
69
71{
72 // Virtual copy constructor
73
74 if ( !fClass ) Initialize(kFALSE);
75 return new TEmulatedCollectionProxy(*this);
76}
77
79{
80 // Virtual destructor
81
82 if (!p) return;
83 if (!fEnv || fEnv->fObject != p) { // Envoid the cost of TPushPop if we don't need it
84 // FIXME: This is not thread safe.
86 const_cast<TEmulatedCollectionProxy*>(this)->Clear("force");
87 } else {
88 const_cast<TEmulatedCollectionProxy*>(this)->Clear("force");
89 }
90 if (dtorOnly) {
91 WithCont(p, [](auto *c, std::size_t) {
92 using Vec_t = std::decay_t<decltype(*c)>;
93 c->~Vec_t();
94 });
95 } else {
96 WithCont(p, [](auto *c, std::size_t) { delete c; });
97 }
98}
99
101{
102 // Virtual array destructor
103
104 // Cannot implement this properly, we do not know
105 // how many elements are in the array.
106 Warning("DeleteArray", "Cannot properly delete emulated array of %s at %p, I don't know how many elements it has!", fClass->GetName(), p);
107 if (!dtorOnly) {
108 ::operator delete(p);
109 }
110}
111
113{
114 // Proxy initializer
116 if (fClass) return this;
117
118
119 TClass *cl = TClass::GetClass(fName.c_str(), kTRUE, silent);
120 fEnv = 0;
121 fKey = 0;
122 if ( cl ) {
123 int nested = 0;
124 std::vector<std::string> inside;
125 fPointers = false;
126 int num = TClassEdit::GetSplit(fName.c_str(),inside,nested);
127 if ( num > 1 ) {
128 std::string nam;
129 if ( inside[0].find("stdext::hash_") != std::string::npos ) {
130 inside[0].replace(3,10,"::");
131 }
132 if ( inside[0].find("__gnu_cxx::hash_") != std::string::npos ) {
133 inside[0].replace(0,16,"std::");
134 }
135 fSTL_type = TClassEdit::STLKind(inside[0]);
136 // Note: an emulated collection proxy is never really associative
137 // since under-neath is actually an array.
138
139 auto alignedSize = [](size_t in, TClass *align_cl) {
140 size_t align = align_cl ? align_cl->GetClassAlignment() : alignof(std::max_align_t);
141 return in + (align - in % align) % align;
142 };
144 TEnum *fTemporaryTEnum = nullptr;
145
147 {
148 if (typecase == kIsEnum && !TEnum::GetEnum(enumname.c_str())) {
149 fTemporaryTEnum = new TEnum();
150 fTemporaryTEnum->SetName(enumname.c_str());
151 gROOT->GetListOfEnums()->Add(fTemporaryTEnum);
152 }
153 }
154
156 {
157 if (fTemporaryTEnum) {
158 gROOT->GetListOfEnums()->Remove(fTemporaryTEnum);
159 delete fTemporaryTEnum;
160 }
161 }
162 };
163 switch ( fSTL_type ) {
164 case ROOT::kSTLmap:
166 nam = "pair<"+inside[1]+","+inside[2];
167 nam += (nam[nam.length()-1]=='>') ? " >" : ">";
168 fKey = new Value(inside[1],silent);
169 fVal = new Value(inside[2],silent);
170 {
171 // We have the case of an on-file enum or an unknown class, since
172 // this comes from a file, we also know that the type was valid but
173 // since we have no information it was either
174 // a. an enum
175 // b. a class of type that was never stored
176 // c. a class with a custom streamer
177 // We can "safely" pretend that it is an enum in all 3 case because
178 // a. obviously
179 // b. it will not be used anyway (no object of that type on the file)
180 // c. since we don't know the class we don't have the Streamer and thus can read it anyway
181 // So let's temporarily pretend it is an enum.
184
185 if (0==TClass::GetClass(nam.c_str(), kTRUE, silent)) {
186 // We need to emulate the pair
187 TVirtualStreamerInfo::Factory()->GenerateInfoForPair(inside[1],inside[2], silent, 0, 0);
188 }
189 }
190 fValue = new Value(nam,silent);
191 if ( !(*fValue).IsValid() || !fKey->IsValid() || !fVal->IsValid() ) {
192 return 0;
193 }
194 fPointers |= 0 != (fKey->fCase&kIsPointer);
195 if (fPointers || (0 != (fKey->fProperties&kNeedDelete))) {
197 }
198 if ( 0 == fValOffset ) {
199 fValOffset = alignedSize(fKey->fSize, (*fValue).fType.GetClass());
200 }
201 if ( 0 == fValDiff ) {
202 fValDiff = alignedSize(fValOffset + fVal->fSize, (*fValue).fType.GetClass());
203 }
204 if (num > 3 && !inside[3].empty()) {
205 if (! TClassEdit::IsDefAlloc(inside[3].c_str(),inside[0].c_str())) {
207 }
208 }
209 break;
210 case ROOT::kSTLbitset:
211 inside[1] = "bool";
212 // Intentional fall through
213 default:
214 fValue = new Value(inside[1],silent);
215 fVal = new Value(*fValue);
216 if ( !(*fValue).IsValid() || !fVal->IsValid() ) {
217 return 0;
218 }
219 if ( 0 == fValDiff ) {
221 // No need to align, the size even for a class should already
222 // be correctly padded for use in a vector.
223 }
224 if (num > 2 && !inside[2].empty()) {
225 if (! TClassEdit::IsDefAlloc(inside[2].c_str(),inside[0].c_str())) {
227 }
228 }
229 break;
230 }
231 fPointers |= 0 != (fVal->fCase&kIsPointer);
232 if (fPointers || (0 != (fVal->fProperties&kNeedDelete))) {
234 }
235 fClass = cl;
236 return this;
237 }
238 Fatal("TEmulatedCollectionProxy","Components of %s not analysed!",cl->GetName());
239 }
240 Fatal("TEmulatedCollectionProxy","Collection class %s not found!",fTypeinfo.name());
241 return 0;
242}
243
245{
246 // Return true if the collection proxy was well initialized.
247 return (0 != fCreateEnv.call);
248}
249
251{
252 // Return the current size of the container
253
254 if ( fEnv && fEnv->fObject ) {
255 return fEnv->fSize = PCont_t(fEnv->fObject)->size()/fValDiff;
256 }
257 Fatal("TEmulatedCollectionProxy","Size> Logic error - no proxy object set.");
258 return 0;
259}
260
262{
263 // Clear the emulated collection.
264 Resize(0, opt && *opt=='f');
265}
266
268{
269 // Shrink the container
270
271 typedef std::string String_t;
272 char* addr = ((char*)fEnv->fStart) + fValDiff*left;
273 size_t i;
274
275 switch ( fSTL_type ) {
276 case ROOT::kSTLmap:
278 addr = ((char*)fEnv->fStart) + fValDiff*left;
279 switch(fKey->fCase) {
280 case kIsFundamental: // Only handle primitives this way
281 case kIsEnum:
282 break;
283 case kIsClass:
284 for( i= fKey->fType ? left : nCurr; i<nCurr; ++i, addr += fValDiff ) {
285 // Call emulation in case non-compiled content
287 }
288 break;
289 case kBIT_ISSTRING:
290 for( i=left; i<nCurr; ++i, addr += fValDiff ) {
291 ((std::string*)addr)->~String_t();
292 }
293 break;
294 case kIsPointer|kIsClass:
295 for( i=left; i<nCurr; ++i, addr += fValDiff ) {
297 //Eventually we'll need to delete this
298 //(but only when needed).
299 void* ptr = h->ptr();
300 if (force) fKey->fType->Destructor(ptr);
301 h->set(0);
302 }
303 break;
305 for( i=nCurr; i<left; ++i, addr += fValDiff ) {
307 //Eventually we'll need to delete this
308 //(but only when needed).
309 if (force) delete (std::string*)h->ptr();
310 h->set(0);
311 }
312 break;
314 for( i=nCurr; i<left; ++i, addr += fValDiff ) {
316 if (force) delete (TString*)h->ptr();
317 h->set(0);
318 }
319 break;
320 }
321 addr = ((char*)fEnv->fStart)+fValOffset+fValDiff*left;
322 // DO NOT break; just continue
323
324 // General case for all values
325 default:
326 switch( fVal->fCase ) {
327 case kIsFundamental: // Only handle primitives this way
328 case kIsEnum:
329 break;
330 case kIsClass:
331 for( i=left; i<nCurr; ++i, addr += fValDiff ) {
332 // Call emulation in case non-compiled content
334 }
335 break;
336 case kBIT_ISSTRING:
337 for( i=left; i<nCurr; ++i, addr += fValDiff )
338 ((std::string*)addr)->~String_t();
339 break;
340 case kIsPointer|kIsClass:
341 for( i=left; i<nCurr; ++i, addr += fValDiff ) {
343 void* p = h->ptr();
344 if ( p && force ) {
346 }
347 h->set(0);
348 }
349 break;
351 for( i=nCurr; i<left; ++i, addr += fValDiff ) {
353 if (force) delete (std::string*)h->ptr();
354 h->set(0);
355 }
356 break;
358 for( i=nCurr; i<left; ++i, addr += fValDiff ) {
360 if (force) delete (TString*)h->ptr();
361 h->set(0);
362 }
363 break;
364 }
365 }
366 WithCont(fEnv->fObject, [&](auto *c, std::size_t alignmentElemSize) {
367 assert(fValDiff % alignmentElemSize == 0);
368 c->resize(left * fValDiff / alignmentElemSize);
369 fEnv->fStart = left > 0 ? c->data() : nullptr;
370 });
371 return;
372}
373
375{
376 // Expand the container
377 size_t i;
378 void *oldstart = fEnv->fStart;
379 WithCont(fEnv->fObject, [&](auto *c, std::size_t alignmentElemSize) {
380 assert(fValDiff % alignmentElemSize == 0);
381 c->resize(left * fValDiff / alignmentElemSize);
382 fEnv->fStart = left > 0 ? c->data() : nullptr;
383 });
384
385 char* addr = ((char*)fEnv->fStart) + fValDiff*nCurr;
386 switch ( fSTL_type ) {
387 case ROOT::kSTLmap:
389 switch(fKey->fCase) {
390 case kIsFundamental: // Only handle primitives this way
391 case kIsEnum:
392 break;
393 case kIsClass:
394 if (oldstart && oldstart != fEnv->fStart) {
395 Long_t offset = 0;
396 for( i=0; i<=nCurr; ++i, offset += fValDiff ) {
397 // For now 'Move' only register the change of location
398 // so per se this is wrong since the object are copied via memcpy
399 // rather than a copy (or move) constructor.
400 fKey->fType->Move(((char*)oldstart)+offset,((char*)fEnv->fStart)+offset);
401 }
402 }
403 for( i=nCurr; i<left; ++i, addr += fValDiff )
404 fKey->fType->New(addr);
405 break;
406 case kBIT_ISSTRING:
407 for( i=nCurr; i<left; ++i, addr += fValDiff )
408 ::new(addr) std::string();
409 break;
410 case kIsPointer|kIsClass:
413 for( i=nCurr; i<left; ++i, addr += fValDiff )
414 *(void**)addr = 0;
415 break;
416 }
418 // DO NOT break; just continue
419
420 // General case for all values
421 default:
422 switch(fVal->fCase) {
423 case kIsFundamental: // Only handle primitives this way
424 case kIsEnum:
425 break;
426 case kIsClass:
427 if (oldstart && oldstart != fEnv->fStart) {
428 Long_t offset = 0;
429 for( i=0; i<=nCurr; ++i, offset += fValDiff ) {
430 // For now 'Move' only register the change of location
431 // so per se this is wrong since the object are copied via memcpy
432 // rather than a copy (or move) constructor.
433 fVal->fType->Move(((char*)oldstart)+offset,((char*)fEnv->fStart)+offset);
434 }
435 }
436 for( i=nCurr; i<left; ++i, addr += fValDiff ) {
437 fVal->fType->New(addr);
438 }
439 break;
440 case kBIT_ISSTRING:
441 for( i=nCurr; i<left; ++i, addr += fValDiff )
442 ::new(addr) std::string();
443 break;
444 case kIsPointer|kIsClass:
447 for( i=nCurr; i<left; ++i, addr += fValDiff )
448 *(void**)addr = 0;
449 break;
450 }
451 break;
452 }
453}
454
456{
457 // Resize the container
458
459 if ( fEnv && fEnv->fObject ) {
460 size_t nCurr = Size();
462 fEnv->fStart = nCurr > 0 ? c->data() : 0;
463 if ( left == nCurr ) {
464 return;
465 }
466 else if ( left < nCurr ) {
467 Shrink(nCurr, left, force);
468 return;
469 }
470 Expand(nCurr, left);
471 return;
472 }
473 Fatal("TEmulatedCollectionProxy","Resize> Logic error - no proxy object set.");
474}
475
477{
478 // Return the address of the value at index 'idx'
479 if ( fEnv && fEnv->fObject ) {
481 size_t s = c->size();
482 if ( idx >= (s/fValDiff) ) {
483 return 0;
484 }
485 return idx < (s / fValDiff) ? c->data() + idx * fValDiff : 0;
486 }
487 Fatal("TEmulatedCollectionProxy","At> Logic error - no proxy object set.");
488 return 0;
489}
490
492{
493 // Allocate the necessary space.
494
496 return fEnv->fObject;
497}
498
499////////////////////////////////////////////////////////////////////////////////
500/// Insert data into the container where data is a C-style array of the actual type contained in the collection
501/// of the given size. For associative container (map, etc.), the data type is the pair<key,value>.
502
503void TEmulatedCollectionProxy::Insert(const void * /* data */, void * /*container*/, size_t /*size*/)
504{
505 Fatal("Insert","Not yet implemented, require copy of objects.");
506}
507
509{
510}
511
513{
514 // Object input streamer
515 Bool_t vsn3 = b.GetInfo() && b.GetInfo()->GetOldVersion()<=3;
517 switch (fVal->fCase) {
518 case kIsFundamental: // Only handle primitives this way
519 case kIsEnum:
520 switch( int(fVal->fKind) ) {
521 case kBool_t: b.ReadFastArray(&itm->boolean , nElements); break;
522 case kChar_t: b.ReadFastArray(&itm->s_char , nElements); break;
523 case kShort_t: b.ReadFastArray(&itm->s_short , nElements); break;
524 case kInt_t: b.ReadFastArray(&itm->s_int , nElements); break;
525 case kLong_t: b.ReadFastArray(&itm->s_long , nElements); break;
526 case kLong64_t: b.ReadFastArray(&itm->s_longlong, nElements); break;
527 case kFloat_t: b.ReadFastArray(&itm->flt , nElements); break;
528 case kFloat16_t: b.ReadFastArrayFloat16(&itm->flt, nElements); break;
529 case kDouble_t: b.ReadFastArray(&itm->dbl , nElements); break;
530 case kUChar_t: b.ReadFastArray(&itm->u_char , nElements); break;
531 case kUShort_t: b.ReadFastArray(&itm->u_short , nElements); break;
532 case kUInt_t: b.ReadFastArray(&itm->u_int , nElements); break;
533 case kULong_t: b.ReadFastArray(&itm->u_long , nElements); break;
534 case kULong64_t: b.ReadFastArray(&itm->u_longlong, nElements); break;
535 case kDouble32_t:b.ReadFastArrayDouble32(&itm->dbl,nElements); break;
536 case kchar:
537 case kNoType_t:
538 case kOther_t:
539 Error("TEmulatedCollectionProxy","fType %d is not supported yet!\n",fVal->fKind);
540 }
541 break;
542
543#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
544
545 case kIsClass:
546 DOLOOP( b.StreamObject(i,fVal->fType) );
547 case kBIT_ISSTRING:
548 DOLOOP( i->read_std_string(b) );
549 case kIsPointer|kIsClass:
550 DOLOOP( i->read_any_object(fVal,b) );
552 DOLOOP( i->read_std_string_pointer(b) );
554 DOLOOP( i->read_tstring_pointer(vsn3,b) );
555 }
556
557#undef DOLOOP
558
559}
560
562{
563 // Object output streamer
565 switch (fVal->fCase) {
566 case kIsFundamental: // Only handle primitives this way
567 case kIsEnum:
568 itm = (StreamHelper*)At(0);
569 switch( int(fVal->fKind) ) {
570 case kBool_t: b.WriteFastArray(&itm->boolean , nElements); break;
571 case kChar_t: b.WriteFastArray(&itm->s_char , nElements); break;
572 case kShort_t: b.WriteFastArray(&itm->s_short , nElements); break;
573 case kInt_t: b.WriteFastArray(&itm->s_int , nElements); break;
574 case kLong_t: b.WriteFastArray(&itm->s_long , nElements); break;
575 case kLong64_t: b.WriteFastArray(&itm->s_longlong, nElements); break;
576 case kFloat_t: b.WriteFastArray(&itm->flt , nElements); break;
577 case kFloat16_t: b.WriteFastArrayFloat16(&itm->flt, nElements); break;
578 case kDouble_t: b.WriteFastArray(&itm->dbl , nElements); break;
579 case kUChar_t: b.WriteFastArray(&itm->u_char , nElements); break;
580 case kUShort_t: b.WriteFastArray(&itm->u_short , nElements); break;
581 case kUInt_t: b.WriteFastArray(&itm->u_int , nElements); break;
582 case kULong_t: b.WriteFastArray(&itm->u_long , nElements); break;
583 case kULong64_t: b.WriteFastArray(&itm->u_longlong, nElements); break;
584 case kDouble32_t:b.WriteFastArrayDouble32(&itm->dbl,nElements); break;
585 case kchar:
586 case kNoType_t:
587 case kOther_t:
588 Error("TEmulatedCollectionProxy","fType %d is not supported yet!\n",fVal->fKind);
589 }
590 break;
591#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
592 case kIsClass:
593 DOLOOP( b.StreamObject(i,fVal->fType) );
594 case kBIT_ISSTRING:
595 DOLOOP( TString(i->c_str()).Streamer(b) );
596 case kIsPointer|kIsClass:
597 DOLOOP( b.WriteObjectAny(i->ptr(),fVal->fType) );
599 DOLOOP( i->write_std_string_pointer(b) );
601 DOLOOP( i->write_tstring_pointer(b) );
602 }
603#undef DOLOOP
604}
605
607{
608 // Read portion of the streamer.
609
611 ReadBuffer(b,obj);
612}
613
615{
616 // Read portion of the streamer.
617
618 TPushPop env(this,obj);
619 int nElements = 0;
620 b >> nElements;
621 if ( fEnv->fObject ) {
622 Resize(nElements,true);
623 }
624 if ( nElements > 0 ) {
626 }
627}
628
630{
631 // TClassStreamer IO overload
632 if ( b.IsReading() ) { //Read mode
633 int nElements = 0;
634 b >> nElements;
635 if ( fEnv->fObject ) {
636 Resize(nElements,true);
637 }
638 if ( nElements > 0 ) {
640 }
641 }
642 else { // Write case
643 int nElements = fEnv->fObject ? Size() : 0;
644 b << nElements;
645 if ( nElements > 0 ) {
647 }
648 }
649}
#define b(i)
Definition RSha256.hxx:100
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
Definition RtypesCore.h:68
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
@ 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)
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:208
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:252
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:267
winID h TVirtualViewer3D TVirtualGLPainter p
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 offset
R__EXTERN TVirtualMutex * gInterpreterMutex
#define gROOT
Definition TROOT.h:426
#define R__LOCKGUARD(mutex)
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:84
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
Definition TClass.cxx:5048
void Destructor(void *obj, Bool_t dtorOnly=kFALSE)
Explicitly call destructor for object.
Definition TClass.cxx:5470
void Move(void *arenaFrom, void *arenaTo) const
Register the fact that an object was moved from the memory location 'arenaFrom' to the memory locatio...
Definition TClass.cxx:4385
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition TClass.cxx:2994
Streamer around an arbitrary STL like container, which implements basic container functionality.
UInt_t Size() const override
Return the current number of elements in the container.
void Insert(const void *data, void *container, size_t size) override
Insert data into the container where data is a C-style array of the actual type contained in the coll...
TGenCollectionProxy * InitializeEx(Bool_t silent) override
Proxy initializer.
void * Allocate(UInt_t n, Bool_t forceDelete) override
Allocates space for storing at least n elements.
void Expand(UInt_t nCurr, UInt_t left)
void WriteItems(int nElements, TBuffer &b)
TVirtualCollectionProxy * Generate() const override
Returns a clean object of the actual class that derives from TVirtualCollectionProxy.
void Commit(void *env) override
Commits pending elements in a staging area (see Allocate() for more information).
void Clear(const char *opt="") override
Clear the container.
void Shrink(UInt_t nCurr, UInt_t left, Bool_t force)
void * At(UInt_t idx) override
Return the address of the value at index idx
void ReadItems(int nElements, TBuffer &b)
void WithCont(void *obj, F &&fn) const
Invoke fn(typed_ptr, elemSize) where typed_ptr is the container pointer cast to the correct AlignedSt...
void Destructor(void *p, Bool_t dtorOnly=kFALSE) const override
Execute the container destructor.
void ReadBuffer(TBuffer &buff, void *pObj) override
void Streamer(TBuffer &refBuffer) override
Streamer Function.
void DeleteArray(void *p, Bool_t dtorOnly=kFALSE) const override
Execute the container array destructor.
TEmulatedCollectionProxy(const TEmulatedCollectionProxy &copy)
void Resize(UInt_t n, Bool_t force_delete) override
Resize the container.
The TEnum class implements the enum type.
Definition TEnum.h:33
static TEnum * GetEnum(const std::type_info &ti, ESearchAction sa=kALoadAndInterpLookup)
Definition TEnum.cxx:181
Proxy around an arbitrary container, which implements basic functionality and iteration.
std::atomic< Value * > fValue
Descriptor of the container value type.
Bool_t fPointers
Flag to indicate if containee has pointers (key or value)
Info_t fTypeinfo
Type information.
int fValOffset
Offset from key to value (in maps)
EnvironBase_t * fEnv
Address of the currently proxied object.
TGenCollectionProxy * Initialize(Bool_t silent) const
Proxy initializer.
std::string fName
Name of the class being proxied.
int fSTL_type
STL container type.
Value * fKey
Descriptor of the key_type.
Method0 fCreateEnv
Method to allocate an Environment holder.
Value * fVal
Descriptor of the Value_type.
virtual void SetOnFileClass(TClass *cl)
int fValDiff
Offset between two consecutive value_types (memory layout).
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
Basic string class.
Definition TString.h:138
virtual void Streamer(TBuffer &)
Stream a string object.
Definition TString.cxx:1418
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.
@ kCustomAlloc
The collection has a custom allocator.
@ kNeedDelete
The collection contains directly or indirectly (via other collection) some pointers that need explici...
static TVirtualStreamerInfo * Factory()
Static function returning a pointer to a new TVirtualStreamerInfo object.
const Int_t n
Definition legend1.C:16
@ kSTLbitset
Definition ESTLType.h:37
@ kSTLmap
Definition ESTLType.h:33
@ kSTLmultimap
Definition ESTLType.h:34
ROOT::ESTLType STLKind(std::string_view type)
Converts STL container name to number.
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.
bool IsDefAlloc(const char *alloc, const char *classname)
return whether or not 'allocname' is the STL default allocator for type 'classname'
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.
UInt_t fProperties
Additional properties of the value type (kNeedDelete)
size_t fSize
fSize of the contained object
EDataType fKind
kind of ROOT-fundamental type
Bool_t IsValid()
Return true if the Value has been properly initialized.
Helper class to facilitate I/O.