103 Warning(
"DeleteArray",
"Cannot properly delete emulated array of %s at %p, I don't know how many elements it has!",
fClass->GetName(), p);
121 std::vector<std::string> inside;
126 if ( inside[0].find(
"stdext::hash_") != std::string::npos ) {
127 inside[0].replace(3,10,
"::");
129 if ( inside[0].find(
"__gnu_cxx::hash_") != std::string::npos ) {
130 inside[0].replace(0,16,
"std::");
137 auto alignedSize = [](
size_t in) {
138 constexpr size_t kSizeOfPtr =
sizeof(
void*);
139 return in + (kSizeOfPtr - in%kSizeOfPtr)%kSizeOfPtr;
141 struct GenerateTemporaryTEnum
143 TEnum *fTemporaryTEnum =
nullptr;
145 GenerateTemporaryTEnum(
UInt_t typecase,
const std::string &enumname)
148 fTemporaryTEnum =
new TEnum();
149 fTemporaryTEnum->
SetName(enumname.c_str());
150 gROOT->GetListOfEnums()->Add(fTemporaryTEnum);
154 ~GenerateTemporaryTEnum()
156 if (fTemporaryTEnum) {
157 gROOT->GetListOfEnums()->Remove(fTemporaryTEnum);
158 delete fTemporaryTEnum;
165 nam =
"pair<"+inside[1]+
","+inside[2];
166 nam += (nam[nam.length()-1]==
'>') ?
" >" :
">";
181 GenerateTemporaryTEnum keyEnum(
fKey->fCase, inside[1]);
182 GenerateTemporaryTEnum valueEnum(
fVal->fCase, inside[2]);
190 if ( !(*fValue).IsValid() || !
fKey->IsValid() || !
fVal->IsValid() ) {
203 if (num > 3 && !inside[3].empty()) {
215 if ( !(*fValue).IsValid() || !
fVal->IsValid() ) {
223 if (num > 2 && !inside[2].empty()) {
237 Fatal(
"TEmulatedCollectionProxy",
"Components of %s not analysed!",cl->
GetName());
239 Fatal(
"TEmulatedCollectionProxy",
"Collection class %s not found!",
fTypeinfo.name());
256 Fatal(
"TEmulatedCollectionProxy",
"Size> Logic error - no proxy object set.");
263 Resize(0, opt && *opt==
'f');
270 typedef std::string String_t;
279 switch(
fKey->fCase) {
291 ((std::string*)addr)->~String_t();
299 void* ptr =
h->ptr();
300 if (force)
fKey->fType->Destructor(ptr);
309 if (force)
delete (std::string*)
h->ptr();
316 if (force)
delete (
TString*)
h->ptr();
326 switch(
fVal->fCase ) {
338 ((std::string*)addr)->~String_t();
345 fVal->fType->Destructor(p);
353 if (force)
delete (std::string*)
h->ptr();
360 if (force)
delete (
TString*)
h->ptr();
367 fEnv->fStart = left>0 ? &(*
c->begin()) : 0;
377 void *oldstart =
fEnv->fStart;
378 fEnv->fStart = left>0 ? &(*
c->begin()) : 0;
384 switch(
fKey->fCase) {
389 if (oldstart && oldstart !=
fEnv->fStart) {
399 fKey->fType->New(addr);
403 ::new(addr) std::string();
417 switch(
fVal->fCase) {
422 if (oldstart && oldstart !=
fEnv->fStart) {
432 fVal->fType->New(addr);
437 ::new(addr) std::string();
455 size_t nCurr =
Size();
457 fEnv->fStart = nCurr>0 ? &(*
c->begin()) : 0;
458 if ( left == nCurr ) {
461 else if ( left < nCurr ) {
462 Shrink(nCurr, left, force);
468 Fatal(
"TEmulatedCollectionProxy",
"Resize> Logic error - no proxy object set.");
476 size_t s =
c->size();
482 Fatal(
"TEmulatedCollectionProxy",
"At> Logic error - no proxy object set.");
491 return fEnv->fObject;
500 Fatal(
"Insert",
"Not yet implemented, require copy of objects.");
510 Bool_t vsn3 =
b.GetInfo() &&
b.GetInfo()->GetOldVersion()<=3;
512 switch (
fVal->fCase) {
515 switch(
int(
fVal->fKind) ) {
519 case kInt_t:
b.ReadFastArray(&itm->
s_int , 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;
527 case kUInt_t:
b.ReadFastArray(&itm->
u_int , nElements);
break;
534 Error(
"TEmulatedCollectionProxy",
"fType %d is not supported yet!\n",
fVal->fKind);
538#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
547 DOLOOP(
i->read_std_string_pointer(
b) );
549 DOLOOP(
i->read_tstring_pointer(vsn3,
b) );
560 switch (
fVal->fCase) {
564 switch(
int(
fVal->fKind) ) {
568 case kInt_t:
b.WriteFastArray(&itm->
s_int , 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;
576 case kUInt_t:
b.WriteFastArray(&itm->
u_int , nElements);
break;
583 Error(
"TEmulatedCollectionProxy",
"fType %d is not supported yet!\n",
fVal->fKind);
586#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
594 DOLOOP(
i->write_std_string_pointer(
b) );
596 DOLOOP(
i->write_tstring_pointer(
b) );
616 if (
fEnv->fObject ) {
619 if ( nElements > 0 ) {
627 if (
b.IsReading() ) {
630 if (
fEnv->fObject ) {
633 if ( nElements > 0 ) {
638 int nElements =
fEnv->fObject ?
Size() : 0;
640 if ( nElements > 0 ) {
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
void Fatal(const char *location, const char *msgfmt,...)
Use this function in case of a fatal error. It will abort the program.
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 R__LOCKGUARD(mutex)
Buffer base class used for serializing objects.
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.
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.
std::vector< char > Cont_t
void Commit(void *env) override
Commits pending elements in a staging area (see Allocate() for more information).
~TEmulatedCollectionProxy() override
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 ©)
void Resize(UInt_t n, Bool_t force_delete) override
Resize the container.
The TEnum class implements the enum type.
static TEnum * GetEnum(const std::type_info &ti, ESearchAction sa=kALoadAndInterpLookup)
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.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual void Streamer(TBuffer &)
Stream a string object.
RAII helper class that ensures that PushProxy() / PopProxy() are called when entering / leaving a C++...
@ kCustomAlloc
The collection has a custom allocator.
@ kNeedDelete
The collection contains directly or indirectly (via other collection) some pointers that need explici...
TVirtualCollectionProxy(const TVirtualCollectionProxy &)=delete
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.
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.
Helper class to facilitate I/O.