Logo ROOT  
Reference Guide
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 
16 Streamer around an arbitrary STL like container, which implements basic
17 container functionality.
18 
19 ### Note:
20 Although this class contains all the setup necessary to deal
21 with maps, the map-like functionality is NOT supported.
22 For optimization reasons this functionality is put into
23 the 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 
44  : TGenCollectionProxy(copy)
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 
78 void TEmulatedCollectionProxy::Destructor(void* p, Bool_t dtorOnly) const
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 
97 void TEmulatedCollectionProxy::DeleteArray(void* p, Bool_t dtorOnly) const
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:
164  case ROOT::kSTLmultimap:
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 ) {
219  fValDiff = fVal->fSize;
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 
260 void TEmulatedCollectionProxy::Clear(const char* opt)
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:
277  case ROOT::kSTLmultimap:
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 ) {
345  fVal->fType->Destructor(p);
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:
383  case ROOT::kSTLmultimap:
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 
498 void TEmulatedCollectionProxy::Insert(const void * /* data */, void * /*container*/, size_t /*size*/)
499 {
500  Fatal("Insert","Not yet implemented, require copy of objects.");
501 }
502 
503 void TEmulatedCollectionProxy::Commit(void* /* env */ )
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 
601 void 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 }
TEmulatedCollectionProxy::PCont_t
Cont_t * PCont_t
Definition: TEmulatedCollectionProxy.h:27
kULong64_t
@ kULong64_t
Definition: TDataType.h:32
TVirtualStreamerInfo::GenerateInfoForPair
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.
c
#define c(i)
Definition: RSha256.hxx:101
TGenCollectionProxy::StreamHelper::u_char
UChar_t u_char
Definition: TGenCollectionProxy.h:97
TEmulatedCollectionProxy::Streamer
virtual void Streamer(TBuffer &refBuffer)
Streamer Function.
Definition: TEmulatedCollectionProxy.cxx:624
kDouble_t
@ kDouble_t
Definition: TDataType.h:31
n
const Int_t n
Definition: legend1.C:16
TEmulatedCollectionProxy::DeleteArray
virtual void DeleteArray(void *p, Bool_t dtorOnly=kFALSE) const
Definition: TEmulatedCollectionProxy.cxx:97
kUChar_t
@ kUChar_t
Definition: TDataType.h:29
kInt_t
@ kInt_t
Definition: TDataType.h:30
TGenCollectionProxy::StreamHelper::u_short
UShort_t u_short
Definition: TGenCollectionProxy.h:98
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
TEmulatedCollectionProxy::Generate
virtual TVirtualCollectionProxy * Generate() const
Virtual copy constructor.
Definition: TEmulatedCollectionProxy.cxx:70
ROOT::kSTLbitset
@ kSTLbitset
Definition: ESTLType.h:37
Warning
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition: TError.cxx:231
kIsClass
@ kIsClass
Definition: TDictionary.h:65
kNoType_t
@ kNoType_t
Definition: TDataType.h:33
TNamed::SetName
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
TStreamerInfo.h
kLong_t
@ kLong_t
Definition: TDataType.h:30
kChar_t
@ kChar_t
Definition: TDataType.h:29
kULong_t
@ kULong_t
Definition: TDataType.h:30
TGenCollectionProxy::StreamHelper::s_short
Short_t s_short
Definition: TGenCollectionProxy.h:91
TVirtualCollectionProxy::kCustomAlloc
@ kCustomAlloc
Definition: TVirtualCollectionProxy.h:55
TGenCollectionProxy::Value::fProperties
UInt_t fProperties
Additional properties of the value type (kNeedDelete)
Definition: TGenCollectionProxy.h:65
TEmulatedCollectionProxy.h
TEmulatedCollectionProxy::InitializeEx
virtual TGenCollectionProxy * InitializeEx(Bool_t silent)
Proxy initializer.
Definition: TEmulatedCollectionProxy.cxx:109
TGenCollectionProxy::Method0::call
Call_t call
Definition: TGenCollectionProxy.h:216
TEmulatedCollectionProxy::Allocate
virtual void * Allocate(UInt_t n, Bool_t forceDelete)
Allocate the needed space.
Definition: TEmulatedCollectionProxy.cxx:486
TGenCollectionProxy::fPointers
Bool_t fPointers
Flag to indicate if containee has pointers (key or value)
Definition: TGenCollectionProxy.h:300
TVirtualCollectionProxy::kNeedDelete
@ kNeedDelete
Definition: TVirtualCollectionProxy.h:54
TGenCollectionProxy::StreamHelper::dbl
Double_t dbl
Definition: TGenCollectionProxy.h:96
TStreamerElement.h
kIsPointer
@ kIsPointer
Definition: TDictionary.h:78
TGenCollectionProxy::Value::fCase
UInt_t fCase
type of data of Value_type
Definition: TGenCollectionProxy.h:64
TGenCollectionProxy::StreamHelper::u_int
UInt_t u_int
Definition: TGenCollectionProxy.h:99
TGenCollectionProxy::fSTL_type
int fSTL_type
STL container type.
Definition: TGenCollectionProxy.h:320
TGenCollectionProxy::StreamHelper::u_longlong
ULong64_t u_longlong
Definition: TGenCollectionProxy.h:101
TEmulatedCollectionProxy::Clear
virtual void Clear(const char *opt="")
Clear the emulated collection.
Definition: TEmulatedCollectionProxy.cxx:260
TEmulatedCollectionProxy::ReadItems
void ReadItems(int nElements, TBuffer &b)
Definition: TEmulatedCollectionProxy.cxx:507
TGeant4Unit::s
static constexpr double s
Definition: TGeant4SystemOfUnits.h:162
kUInt_t
@ kUInt_t
Definition: TDataType.h:30
ROOT::Detail::TCollectionProxyInfo::EnvironBase::fSize
size_t fSize
Definition: TCollectionProxyInfo.h:233
TBuffer
Buffer base class used for serializing objects.
Definition: TBuffer.h:43
kchar
@ kchar
Definition: TDataType.h:31
ROOT::Detail::TCollectionProxyInfo::EnvironBase::fStart
void * fStart
Definition: TCollectionProxyInfo.h:235
TString
Basic string class.
Definition: TString.h:136
b
#define b(i)
Definition: RSha256.hxx:100
TGenCollectionProxy::Value::fSize
size_t fSize
fSize of the contained object
Definition: TGenCollectionProxy.h:68
bool
TGenCollectionProxy::StreamHelper::s_int
Int_t s_int
Definition: TGenCollectionProxy.h:92
TGenCollectionProxy::SetOnFileClass
virtual void SetOnFileClass(TClass *cl)
Definition: TGenCollectionProxy.h:424
kFloat16_t
@ kFloat16_t
Definition: TDataType.h:33
TGenCollectionProxy::fVal
Value * fVal
Descriptor of the Value_type.
Definition: TGenCollectionProxy.h:312
ROOT::kSTLmap
@ kSTLmap
Definition: ESTLType.h:33
TEmulatedCollectionProxy::ReadBuffer
virtual void ReadBuffer(TBuffer &buff, void *pObj)
Definition: TEmulatedCollectionProxy.cxx:609
TROOT.h
TGenCollectionProxy::fKey
Value * fKey
Descriptor of the key_type.
Definition: TGenCollectionProxy.h:313
TGenCollectionProxy::kBIT_ISSTRING
@ kBIT_ISSTRING
Definition: TGenCollectionProxy.h:47
TEmulatedCollectionProxy::Size
virtual UInt_t Size() const
Return the current size of the container.
Definition: TEmulatedCollectionProxy.cxx:249
kDouble32_t
@ kDouble32_t
Definition: TDataType.h:31
TEmulatedCollectionProxy::Cont_t
std::vector< char > Cont_t
Definition: TEmulatedCollectionProxy.h:25
gInterpreterMutex
R__EXTERN TVirtualMutex * gInterpreterMutex
Definition: TInterpreter.h:44
TEnum.h
ROOT::Detail::TCollectionProxyInfo::EnvironBase::fObject
void * fObject
Definition: TCollectionProxyInfo.h:234
TClass::New
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
Definition: TClass.cxx:4971
h
#define h(i)
Definition: RSha256.hxx:106
xmlio::Value
const char * Value
Definition: TXMLSetup.cxx:73
TGenCollectionProxy::Value::fKind
EDataType fKind
kind of ROOT-fundamental type
Definition: TGenCollectionProxy.h:67
TVirtualCollectionProxy::fProperties
UInt_t fProperties
Definition: TVirtualCollectionProxy.h:45
TEmulatedCollectionProxy::~TEmulatedCollectionProxy
virtual ~TEmulatedCollectionProxy()
Definition: TEmulatedCollectionProxy.cxx:62
TEmulatedCollectionProxy
Streamer around an arbitrary STL like container, which implements basic container functionality.
Definition: TEmulatedCollectionProxy.h:18
TEnum
The TEnum class implements the enum type.
Definition: TEnum.h:33
TEmulatedCollectionProxy::At
virtual void * At(UInt_t idx)
Return the address of the value at index 'idx'.
Definition: TEmulatedCollectionProxy.cxx:471
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
Fatal
void Fatal(const char *location, const char *msgfmt,...)
Use this function in case of a fatal error. It will abort the program.
Definition: TError.cxx:245
kUShort_t
@ kUShort_t
Definition: TDataType.h:29
Long_t
long Long_t
Definition: RtypesCore.h:54
TGenCollectionProxy::fValue
std::atomic< Value * > fValue
Descriptor of the container value type.
Definition: TGenCollectionProxy.h:311
TGenCollectionProxy::StreamHelper::flt
Float_t flt
Definition: TGenCollectionProxy.h:95
kIsFundamental
@ kIsFundamental
Definition: TDictionary.h:70
TGenCollectionProxy::StreamHelper::s_longlong
Long64_t s_longlong
Definition: TGenCollectionProxy.h:94
TEmulatedCollectionProxy::Commit
virtual void Commit(void *env)
Commit the change.
Definition: TEmulatedCollectionProxy.cxx:503
TGenCollectionProxy::StreamHelper::s_char
Char_t s_char
Definition: TGenCollectionProxy.h:90
ROOT::kSTLmultimap
@ kSTLmultimap
Definition: ESTLType.h:34
R__LOCKGUARD
#define R__LOCKGUARD(mutex)
Definition: TVirtualMutex.h:104
TVirtualStreamerInfo::Factory
static TVirtualStreamerInfo * Factory()
Static function returning a pointer to a new TVirtualStreamerInfo object.
Definition: TVirtualStreamerInfo.cxx:177
TGenCollectionProxy::StreamHelper::boolean
Bool_t boolean
Definition: TGenCollectionProxy.h:89
TClass::GetClass
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:2955
TVirtualCollectionProxy::kIsEmulated
@ kIsEmulated
Definition: TVirtualCollectionProxy.h:53
TEmulatedCollectionProxy::Shrink
void Shrink(UInt_t nCurr, UInt_t left, Bool_t force)
Definition: TEmulatedCollectionProxy.cxx:266
TVirtualMutex.h
TEmulatedCollectionProxy::Expand
void Expand(UInt_t nCurr, UInt_t left)
Definition: TEmulatedCollectionProxy.cxx:371
kLong64_t
@ kLong64_t
Definition: TDataType.h:32
TEmulatedCollectionProxy::Destructor
virtual void Destructor(void *p, Bool_t dtorOnly=kFALSE) const
Definition: TEmulatedCollectionProxy.cxx:78
kFloat_t
@ kFloat_t
Definition: TDataType.h:31
TGenCollectionProxy::Initialize
TGenCollectionProxy * Initialize(Bool_t silent) const
Proxy initializer.
Definition: TGenCollectionProxy.cxx:771
kOther_t
@ kOther_t
Definition: TDataType.h:32
unsigned int
TGenCollectionProxy::fTypeinfo
Info_t fTypeinfo
Type information.
Definition: TGenCollectionProxy.h:321
TGenCollectionProxy::StreamHelper
Helper class to facilitate I/O.
Definition: TGenCollectionProxy.h:88
TClassEdit::GetSplit
int GetSplit(const char *type, std::vector< std::string > &output, int &nestedLoc, EModType mode=TClassEdit::kNone)
Stores in output (after emptying it) the split type.
Definition: TClassEdit.cxx:1012
TGenCollectionProxy::fName
std::string fName
Name of the class being proxied.
Definition: TGenCollectionProxy.h:299
TEmulatedCollectionProxy::WriteItems
void WriteItems(int nElements, TBuffer &b)
Definition: TEmulatedCollectionProxy.cxx:556
DOLOOP
#define DOLOOP(x)
TClassEdit.h
kIsEnum
@ kIsEnum
Definition: TDictionary.h:68
TInterpreter.h
TClass
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
TVirtualCollectionProxy::TPushPop
Definition: TVirtualCollectionProxy.h:58
TClass::Destructor
void Destructor(void *obj, Bool_t dtorOnly=kFALSE)
Explicitly call destructor for object.
Definition: TClass.cxx:5393
TGenCollectionProxy::fValDiff
int fValDiff
Offset between two consecutive value_types (memory layout).
Definition: TGenCollectionProxy.h:316
ROOT::Detail::TCollectionProxyInfo::Environ::Create
static void * Create()
Definition: TCollectionProxyInfo.h:249
TGenCollectionProxy::Value::fType
TClassRef fType
TClass reference of Value_type in collection.
Definition: TGenCollectionProxy.h:66
TVirtualCollectionProxy::fClass
TClassRef fClass
Definition: TVirtualCollectionProxy.h:44
TGenCollectionProxy
Proxy around an arbitrary container, which implements basic functionality and iteration.
Definition: TGenCollectionProxy.h:31
TEmulatedCollectionProxy::Resize
virtual void Resize(UInt_t n, Bool_t force_delete)
Resize the container.
Definition: TEmulatedCollectionProxy.cxx:450
TEmulatedCollectionProxy::IsValid
Bool_t IsValid() const
Definition: TEmulatedCollectionProxy.cxx:243
TGenCollectionProxy::fValOffset
int fValOffset
Offset from key to value (in maps)
Definition: TGenCollectionProxy.h:315
TGenCollectionProxy::StreamHelper::u_long
ULong_t u_long
Definition: TGenCollectionProxy.h:100
TGenCollectionProxy::StreamHelper::s_long
Long_t s_long
Definition: TGenCollectionProxy.h:93
TEnum::GetEnum
static TEnum * GetEnum(const std::type_info &ti, ESearchAction sa=kALoadAndInterpLookup)
Definition: TEnum.cxx:132
TClassEdit::STLKind
ROOT::ESTLType STLKind(std::string_view type)
Converts STL container name to number.
Definition: TClassEdit.cxx:511
TGenCollectionProxy::fEnv
EnvironBase_t * fEnv
Address of the currently proxied object.
Definition: TGenCollectionProxy.h:314
TGenCollectionProxy::fCreateEnv
Method0 fCreateEnv
Method to allocate an Environment holder.
Definition: TGenCollectionProxy.h:310
TNamed::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
TClass::Move
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:4320
TEmulatedCollectionProxy::TEmulatedCollectionProxy
TEmulatedCollectionProxy(const TEmulatedCollectionProxy &copy)
Definition: TEmulatedCollectionProxy.cxx:43
kShort_t
@ kShort_t
Definition: TDataType.h:29
kBool_t
@ kBool_t
Definition: TDataType.h:32
TGenCollectionProxy::Value::IsValid
Bool_t IsValid()
Return true if the Value has been properly initialized.
Definition: TGenCollectionProxy.cxx:512
TVirtualCollectionProxy
Definition: TVirtualCollectionProxy.h:38
gROOT
#define gROOT
Definition: TROOT.h:404
TClassEdit::IsDefAlloc
bool IsDefAlloc(const char *alloc, const char *classname)
return whether or not 'allocname' is the STL default allocator for type 'classname'
Definition: TClassEdit.cxx:604
TGenCollectionProxy::kBIT_ISTSTRING
@ kBIT_ISTSTRING
Definition: TGenCollectionProxy.h:48
Error
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition: TError.cxx:187
TError.h
TEmulatedCollectionProxy::Insert
virtual void Insert(const void *data, void *container, size_t size)
Insert data into the container where data is a C-style array of the actual type contained in the coll...
Definition: TEmulatedCollectionProxy.cxx:498