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]);
203 if (num > 3 && !inside[3].empty()) {
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;
290 for( i=left; i<nCurr; ++i, addr +=
fValDiff ) {
291 ((std::string*)addr)->~String_t();
295 for( i=left; i<nCurr; ++i, addr +=
fValDiff ) {
299 void* ptr =
h->
ptr();
305 for( i=nCurr; i<left; ++i, addr +=
fValDiff ) {
309 if (force)
delete (std::string*)
h->
ptr();
314 for( i=nCurr; i<left; ++i, addr +=
fValDiff ) {
331 for( i=left; i<nCurr; ++i, addr +=
fValDiff ) {
337 for( i=left; i<nCurr; ++i, addr +=
fValDiff )
338 ((std::string*)addr)->~String_t();
341 for( i=left; i<nCurr; ++i, addr +=
fValDiff ) {
351 for( i=nCurr; i<left; ++i, addr +=
fValDiff ) {
353 if (force)
delete (std::string*)
h->
ptr();
358 for( i=nCurr; i<left; ++i, addr +=
fValDiff ) {
398 for( i=nCurr; i<left; ++i, addr +=
fValDiff )
402 for( i=nCurr; i<left; ++i, addr +=
fValDiff )
403 ::new(addr) std::string();
408 for( i=nCurr; i<left; ++i, addr +=
fValDiff )
431 for( i=nCurr; i<left; ++i, addr +=
fValDiff ) {
436 for( i=nCurr; i<left; ++i, addr +=
fValDiff )
437 ::new(addr) std::string();
442 for( i=nCurr; i<left; ++i, addr +=
fValDiff )
455 size_t nCurr =
Size();
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.");
500 Fatal(
"Insert",
"Not yet implemented, require copy of objects.");
510 Bool_t vsn3 =
b.GetInfo() &&
b.GetInfo()->GetOldVersion()<=3;
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;}
543 DOLOOP( i->read_std_string(
b) );
547 DOLOOP( i->read_std_string_pointer(
b) );
549 DOLOOP( i->read_tstring_pointer(vsn3,
b) );
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) );
619 if ( nElements > 0 ) {
627 if (
b.IsReading() ) {
633 if ( nElements > 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.
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 R__LOCKGUARD(mutex)
Buffer base class used for serializing objects.
TClass instances represent classes, structs and namespaces in the ROOT type system.
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
void Destructor(void *obj, Bool_t dtorOnly=kFALSE)
Explicitly call destructor for object.
void Move(void *arenaFrom, void *arenaTo) const
Register the fact that an object was moved from the memory location 'arenaFrom' to the memory locatio...
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.
Streamer around an arbitrary STL like container, which implements basic container functionality.
UInt_t Size() const override
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
void Expand(UInt_t nCurr, UInt_t left)
void WriteItems(int nElements, TBuffer &b)
TVirtualCollectionProxy * Generate() const override
Virtual copy constructor.
std::vector< char > Cont_t
void Commit(void *env) override
void Clear(const char *opt="") override
void Shrink(UInt_t nCurr, UInt_t left, Bool_t force)
virtual ~TEmulatedCollectionProxy()
void * At(UInt_t idx) override
void ReadItems(int nElements, TBuffer &b)
void Destructor(void *p, Bool_t dtorOnly=kFALSE) const override
void ReadBuffer(TBuffer &buff, void *pObj) override
void Streamer(TBuffer &refBuffer) override
Streamer Function.
void DeleteArray(void *p, Bool_t dtorOnly=kFALSE) const override
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)
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.
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual void Streamer(TBuffer &)
Stream a string object.
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.
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.