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
51 : TGenCollectionProxy(typeid(std::vector<char>), sizeof(std::vector<char>::iterator))
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 ((Cont_t*)p)->~Cont_t();
92 } else {
93 delete (Cont_t*) p;
94 }
95}
96
98{
99 // Virtual array destructor
100
101 // Cannot implement this properly, we do not know
102 // how many elements are in the array.
103 Warning("DeleteArray", "Cannot properly delete emulated array of %s at %p, I don't know how many elements it has!", fClass->GetName(), p);
104 if (!dtorOnly) {
105 delete[] (Cont_t*) p;
106 }
107}
108
110{
111 // Proxy initializer
113 if (fClass) return this;
114
115
116 TClass *cl = TClass::GetClass(fName.c_str(), kTRUE, silent);
117 fEnv = 0;
118 fKey = 0;
119 if ( cl ) {
120 int nested = 0;
121 std::vector<std::string> inside;
122 fPointers = false;
123 int num = TClassEdit::GetSplit(fName.c_str(),inside,nested);
124 if ( num > 1 ) {
125 std::string nam;
126 if ( inside[0].find("stdext::hash_") != std::string::npos ) {
127 inside[0].replace(3,10,"::");
128 }
129 if ( inside[0].find("__gnu_cxx::hash_") != std::string::npos ) {
130 inside[0].replace(0,16,"std::");
131 }
132 fSTL_type = TClassEdit::STLKind(inside[0]);
133 // Note: an emulated collection proxy is never really associative
134 // since under-neath is actually an array.
135
136 // std::cout << "Initialized " << typeid(*this).name() << ":" << fName << std::endl;
137 auto alignedSize = [](size_t in) {
138 constexpr size_t kSizeOfPtr = sizeof(void*);
139 return in + (kSizeOfPtr - in%kSizeOfPtr)%kSizeOfPtr;
140 };
141 struct GenerateTemporaryTEnum
142 {
143 TEnum *fTemporaryTEnum = nullptr;
144
145 GenerateTemporaryTEnum(UInt_t typecase, const std::string &enumname)
146 {
147 if (typecase == kIsEnum && !TEnum::GetEnum(enumname.c_str())) {
148 fTemporaryTEnum = new TEnum();
149 fTemporaryTEnum->SetName(enumname.c_str());
150 gROOT->GetListOfEnums()->Add(fTemporaryTEnum);
151 }
152 }
153
154 ~GenerateTemporaryTEnum()
155 {
156 if (fTemporaryTEnum) {
157 gROOT->GetListOfEnums()->Remove(fTemporaryTEnum);
158 delete fTemporaryTEnum;
159 }
160 }
161 };
162 switch ( fSTL_type ) {
163 case ROOT::kSTLmap:
165 nam = "pair<"+inside[1]+","+inside[2];
166 nam += (nam[nam.length()-1]=='>') ? " >" : ">";
167 fKey = new Value(inside[1],silent);
168 fVal = new Value(inside[2],silent);
169 {
170 // We have the case of an on-file enum or an unknown class, since
171 // this comes from a file, we also know that the type was valid but
172 // since we have no information it was either
173 // a. an enum
174 // b. a class of type that was never stored
175 // c. a class with a custom streamer
176 // We can "safely" pretend that it is an enum in all 3 case because
177 // a. obviously
178 // b. it will not be used anyway (no object of that type on the file)
179 // c. since we don't know the class we don't have the Streamer and thus can read it anyway
180 // So let's temporarily pretend it is an enum.
181 GenerateTemporaryTEnum keyEnum(fKey->fCase, inside[1]);
182 GenerateTemporaryTEnum valueEnum(fVal->fCase, inside[2]);
183
184 if (0==TClass::GetClass(nam.c_str(), kTRUE, silent)) {
185 // We need to emulate the pair
186 TVirtualStreamerInfo::Factory()->GenerateInfoForPair(inside[1],inside[2], silent, 0, 0);
187 }
188 }
189 fValue = new Value(nam,silent);
190 if ( !(*fValue).IsValid() || !fKey->IsValid() || !fVal->IsValid() ) {
191 return 0;
192 }
193 fPointers |= 0 != (fKey->fCase&kIsPointer);
194 if (fPointers || (0 != (fKey->fProperties&kNeedDelete))) {
196 }
197 if ( 0 == fValOffset ) {
198 fValOffset = alignedSize(fKey->fSize);
199 }
200 if ( 0 == fValDiff ) {
201 fValDiff = alignedSize(fValOffset + fVal->fSize);
202 }
203 if (num > 3 && !inside[3].empty()) {
204 if (! TClassEdit::IsDefAlloc(inside[3].c_str(),inside[0].c_str())) {
206 }
207 }
208 break;
209 case ROOT::kSTLbitset:
210 inside[1] = "bool";
211 // Intentional fall through
212 default:
213 fValue = new Value(inside[1],silent);
214 fVal = new Value(*fValue);
215 if ( !(*fValue).IsValid() || !fVal->IsValid() ) {
216 return 0;
217 }
218 if ( 0 == fValDiff ) {
220 // No need to align, the size even for a class should already
221 // be correctly padded for use in a vector.
222 }
223 if (num > 2 && !inside[2].empty()) {
224 if (! TClassEdit::IsDefAlloc(inside[2].c_str(),inside[0].c_str())) {
226 }
227 }
228 break;
229 }
230 fPointers |= 0 != (fVal->fCase&kIsPointer);
231 if (fPointers || (0 != (fVal->fProperties&kNeedDelete))) {
233 }
234 fClass = cl;
235 return this;
236 }
237 Fatal("TEmulatedCollectionProxy","Components of %s not analysed!",cl->GetName());
238 }
239 Fatal("TEmulatedCollectionProxy","Collection class %s not found!",fTypeinfo.name());
240 return 0;
241}
242
244{
245 // Return true if the collection proxy was well initialized.
246 return (0 != fCreateEnv.call);
247}
248
250{
251 // Return the current size of the container
252
253 if ( fEnv && fEnv->fObject ) {
254 return fEnv->fSize = PCont_t(fEnv->fObject)->size()/fValDiff;
255 }
256 Fatal("TEmulatedCollectionProxy","Size> Logic error - no proxy object set.");
257 return 0;
258}
259
261{
262 // Clear the emulated collection.
263 Resize(0, opt && *opt=='f');
264}
265
267{
268 // Shrink the container
269
270 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
286 fKey->fType->Destructor(addr, kTRUE);
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 ) {
296 StreamHelper* h = (StreamHelper*)addr;
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 ) {
306 StreamHelper* h = (StreamHelper*)addr;
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 ) {
315 StreamHelper* h = (StreamHelper*)addr;
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
333 fVal->fType->Destructor(addr,kTRUE);
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 ) {
342 StreamHelper* h = (StreamHelper*)addr;
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 ) {
352 StreamHelper* h = (StreamHelper*)addr;
353 if (force) delete (std::string*)h->ptr();
354 h->set(0);
355 }
356 break;
358 for( i=nCurr; i<left; ++i, addr += fValDiff ) {
359 StreamHelper* h = (StreamHelper*)addr;
360 if (force) delete (TString*)h->ptr();
361 h->set(0);
362 }
363 break;
364 }
365 }
366 c->resize(left*fValDiff,0);
367 fEnv->fStart = left>0 ? &(*c->begin()) : 0;
368 return;
369}
370
372{
373 // Expand the container
374 size_t i;
376 c->resize(left*fValDiff,0);
377 void *oldstart = fEnv->fStart;
378 fEnv->fStart = left>0 ? &(*c->begin()) : 0;
379
380 char* addr = ((char*)fEnv->fStart) + fValDiff*nCurr;
381 switch ( fSTL_type ) {
382 case ROOT::kSTLmap:
384 switch(fKey->fCase) {
385 case kIsFundamental: // Only handle primitives this way
386 case kIsEnum:
387 break;
388 case kIsClass:
389 if (oldstart && oldstart != fEnv->fStart) {
390 Long_t offset = 0;
391 for( i=0; i<=nCurr; ++i, offset += fValDiff ) {
392 // For now 'Move' only register the change of location
393 // so per se this is wrong since the object are copied via memcpy
394 // rather than a copy (or move) constructor.
395 fKey->fType->Move(((char*)oldstart)+offset,((char*)fEnv->fStart)+offset);
396 }
397 }
398 for( i=nCurr; i<left; ++i, addr += fValDiff )
399 fKey->fType->New(addr);
400 break;
401 case kBIT_ISSTRING:
402 for( i=nCurr; i<left; ++i, addr += fValDiff )
403 ::new(addr) std::string();
404 break;
405 case kIsPointer|kIsClass:
408 for( i=nCurr; i<left; ++i, addr += fValDiff )
409 *(void**)addr = 0;
410 break;
411 }
412 addr = ((char*)fEnv->fStart)+fValOffset+fValDiff*nCurr;
413 // DO NOT break; just continue
414
415 // General case for all values
416 default:
417 switch(fVal->fCase) {
418 case kIsFundamental: // Only handle primitives this way
419 case kIsEnum:
420 break;
421 case kIsClass:
422 if (oldstart && oldstart != fEnv->fStart) {
423 Long_t offset = 0;
424 for( i=0; i<=nCurr; ++i, offset += fValDiff ) {
425 // For now 'Move' only register the change of location
426 // so per se this is wrong since the object are copied via memcpy
427 // rather than a copy (or move) constructor.
428 fVal->fType->Move(((char*)oldstart)+offset,((char*)fEnv->fStart)+offset);
429 }
430 }
431 for( i=nCurr; i<left; ++i, addr += fValDiff ) {
432 fVal->fType->New(addr);
433 }
434 break;
435 case kBIT_ISSTRING:
436 for( i=nCurr; i<left; ++i, addr += fValDiff )
437 ::new(addr) std::string();
438 break;
439 case kIsPointer|kIsClass:
442 for( i=nCurr; i<left; ++i, addr += fValDiff )
443 *(void**)addr = 0;
444 break;
445 }
446 break;
447 }
448}
449
451{
452 // Resize the container
453
454 if ( fEnv && fEnv->fObject ) {
455 size_t nCurr = Size();
457 fEnv->fStart = nCurr>0 ? &(*c->begin()) : 0;
458 if ( left == nCurr ) {
459 return;
460 }
461 else if ( left < nCurr ) {
462 Shrink(nCurr, left, force);
463 return;
464 }
465 Expand(nCurr, left);
466 return;
467 }
468 Fatal("TEmulatedCollectionProxy","Resize> Logic error - no proxy object set.");
469}
470
472{
473 // Return the address of the value at index 'idx'
474 if ( fEnv && fEnv->fObject ) {
476 size_t s = c->size();
477 if ( idx >= (s/fValDiff) ) {
478 return 0;
479 }
480 return idx<(s/fValDiff) ? ((char*)&(*c->begin()))+idx*fValDiff : 0;
481 }
482 Fatal("TEmulatedCollectionProxy","At> Logic error - no proxy object set.");
483 return 0;
484}
485
487{
488 // Allocate the necessary space.
489
490 Resize(n, forceDelete);
491 return fEnv->fObject;
492}
493
494////////////////////////////////////////////////////////////////////////////////
495/// Insert data into the container where data is a C-style array of the actual type contained in the collection
496/// of the given size. For associative container (map, etc.), the data type is the pair<key,value>.
497
498void TEmulatedCollectionProxy::Insert(const void * /* data */, void * /*container*/, size_t /*size*/)
499{
500 Fatal("Insert","Not yet implemented, require copy of objects.");
501}
502
504{
505}
506
508{
509 // Object input streamer
510 Bool_t vsn3 = b.GetInfo() && b.GetInfo()->GetOldVersion()<=3;
511 StreamHelper* itm = (StreamHelper*)At(0);
512 switch (fVal->fCase) {
513 case kIsFundamental: // Only handle primitives this way
514 case kIsEnum:
515 switch( int(fVal->fKind) ) {
516 case kBool_t: b.ReadFastArray(&itm->boolean , nElements); break;
517 case kChar_t: b.ReadFastArray(&itm->s_char , nElements); break;
518 case kShort_t: b.ReadFastArray(&itm->s_short , nElements); break;
519 case kInt_t: b.ReadFastArray(&itm->s_int , nElements); break;
520 case kLong_t: b.ReadFastArray(&itm->s_long , nElements); break;
521 case kLong64_t: b.ReadFastArray(&itm->s_longlong, nElements); break;
522 case kFloat_t: b.ReadFastArray(&itm->flt , nElements); break;
523 case kFloat16_t: b.ReadFastArrayFloat16(&itm->flt, nElements); break;
524 case kDouble_t: b.ReadFastArray(&itm->dbl , nElements); break;
525 case kUChar_t: b.ReadFastArray(&itm->u_char , nElements); break;
526 case kUShort_t: b.ReadFastArray(&itm->u_short , nElements); break;
527 case kUInt_t: b.ReadFastArray(&itm->u_int , nElements); break;
528 case kULong_t: b.ReadFastArray(&itm->u_long , nElements); break;
529 case kULong64_t: b.ReadFastArray(&itm->u_longlong, nElements); break;
530 case kDouble32_t:b.ReadFastArrayDouble32(&itm->dbl,nElements); break;
531 case kchar:
532 case kNoType_t:
533 case kOther_t:
534 Error("TEmulatedCollectionProxy","fType %d is not supported yet!\n",fVal->fKind);
535 }
536 break;
537
538#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
539
540 case kIsClass:
541 DOLOOP( b.StreamObject(i,fVal->fType) );
542 case kBIT_ISSTRING:
543 DOLOOP( i->read_std_string(b) );
544 case kIsPointer|kIsClass:
545 DOLOOP( i->read_any_object(fVal,b) );
547 DOLOOP( i->read_std_string_pointer(b) );
549 DOLOOP( i->read_tstring_pointer(vsn3,b) );
550 }
551
552#undef DOLOOP
553
554}
555
557{
558 // Object output streamer
559 StreamHelper* itm = (StreamHelper*)At(0);
560 switch (fVal->fCase) {
561 case kIsFundamental: // Only handle primitives this way
562 case kIsEnum:
563 itm = (StreamHelper*)At(0);
564 switch( int(fVal->fKind) ) {
565 case kBool_t: b.WriteFastArray(&itm->boolean , nElements); break;
566 case kChar_t: b.WriteFastArray(&itm->s_char , nElements); break;
567 case kShort_t: b.WriteFastArray(&itm->s_short , nElements); break;
568 case kInt_t: b.WriteFastArray(&itm->s_int , nElements); break;
569 case kLong_t: b.WriteFastArray(&itm->s_long , nElements); break;
570 case kLong64_t: b.WriteFastArray(&itm->s_longlong, nElements); break;
571 case kFloat_t: b.WriteFastArray(&itm->flt , nElements); break;
572 case kFloat16_t: b.WriteFastArrayFloat16(&itm->flt, nElements); break;
573 case kDouble_t: b.WriteFastArray(&itm->dbl , nElements); break;
574 case kUChar_t: b.WriteFastArray(&itm->u_char , nElements); break;
575 case kUShort_t: b.WriteFastArray(&itm->u_short , nElements); break;
576 case kUInt_t: b.WriteFastArray(&itm->u_int , nElements); break;
577 case kULong_t: b.WriteFastArray(&itm->u_long , nElements); break;
578 case kULong64_t: b.WriteFastArray(&itm->u_longlong, nElements); break;
579 case kDouble32_t:b.WriteFastArrayDouble32(&itm->dbl,nElements); break;
580 case kchar:
581 case kNoType_t:
582 case kOther_t:
583 Error("TEmulatedCollectionProxy","fType %d is not supported yet!\n",fVal->fKind);
584 }
585 break;
586#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
587 case kIsClass:
588 DOLOOP( b.StreamObject(i,fVal->fType) );
589 case kBIT_ISSTRING:
590 DOLOOP( TString(i->c_str()).Streamer(b) );
591 case kIsPointer|kIsClass:
592 DOLOOP( b.WriteObjectAny(i->ptr(),fVal->fType) );
594 DOLOOP( i->write_std_string_pointer(b) );
596 DOLOOP( i->write_tstring_pointer(b) );
597 }
598#undef DOLOOP
599}
600
601void TEmulatedCollectionProxy::ReadBuffer(TBuffer &b, void *obj, const TClass *onfileClass)
602{
603 // Read portion of the streamer.
604
605 SetOnFileClass((TClass*)onfileClass);
606 ReadBuffer(b,obj);
607}
608
610{
611 // Read portion of the streamer.
612
613 TPushPop env(this,obj);
614 int nElements = 0;
615 b >> nElements;
616 if ( fEnv->fObject ) {
617 Resize(nElements,true);
618 }
619 if ( nElements > 0 ) {
620 ReadItems(nElements, b);
621 }
622}
623
625{
626 // TClassStreamer IO overload
627 if ( b.IsReading() ) { //Read mode
628 int nElements = 0;
629 b >> nElements;
630 if ( fEnv->fObject ) {
631 Resize(nElements,true);
632 }
633 if ( nElements > 0 ) {
634 ReadItems(nElements, b);
635 }
636 }
637 else { // Write case
638 int nElements = fEnv->fObject ? Size() : 0;
639 b << nElements;
640 if ( nElements > 0 ) {
641 WriteItems(nElements, b);
642 }
643 }
644}
#define b(i)
Definition RSha256.hxx:100
#define c(i)
Definition RSha256.hxx:101
#define h(i)
Definition RSha256.hxx:106
long Long_t
Definition RtypesCore.h:54
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
@ 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:185
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:229
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
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:406
#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:81
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
Definition TClass.cxx:4978
void Destructor(void *obj, Bool_t dtorOnly=kFALSE)
Explicitly call destructor for object.
Definition TClass.cxx:5400
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:4327
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:2968
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 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:175
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:47
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:140
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.
@ kCustomAlloc
The collection has a custom allocator.
@ kNeedDelete
The collection contains directly or indirectly (via other collection) some pointers that need explici...
virtual TVirtualStreamerInfo * GenerateInfoForPair(const std::string &pairclassname, bool silent, size_t hint_pair_offset, size_t hint_pair_size)=0
Generate the TClass and TStreamerInfo for the requested pair.
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.