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 ) {
316 if (force)
delete (
TString*)
h->ptr();
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 ) {
360 if (force)
delete (
TString*)
h->ptr();
391 for( i=0; i<=nCurr; ++i, offset +=
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 )
424 for( i=0; i<=nCurr; ++i, offset +=
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,...)
void Warning(const char *location, const char *msgfmt,...)
void Fatal(const char *location, const char *msgfmt,...)
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.
virtual TGenCollectionProxy * InitializeEx(Bool_t silent)
Proxy initializer.
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...
virtual void DeleteArray(void *p, Bool_t dtorOnly=kFALSE) const
virtual void Streamer(TBuffer &refBuffer)
Streamer Function.
void Expand(UInt_t nCurr, UInt_t left)
virtual void Destructor(void *p, Bool_t dtorOnly=kFALSE) const
void WriteItems(int nElements, TBuffer &b)
virtual void ReadBuffer(TBuffer &buff, void *pObj)
std::vector< char > Cont_t
virtual void Commit(void *env)
Commit the change.
virtual void Resize(UInt_t n, Bool_t force_delete)
Resize the container.
void Shrink(UInt_t nCurr, UInt_t left, Bool_t force)
virtual void Clear(const char *opt="")
Clear the emulated collection.
virtual TVirtualCollectionProxy * Generate() const
Virtual copy constructor.
virtual ~TEmulatedCollectionProxy()
virtual void * Allocate(UInt_t n, Bool_t forceDelete)
Allocate the needed space.
virtual UInt_t Size() const
Return the current size of the container.
void ReadItems(int nElements, TBuffer &b)
TEmulatedCollectionProxy(const TEmulatedCollectionProxy ©)
virtual void * At(UInt_t idx)
Return the address of the value at index 'idx'.
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).
virtual void SetName(const char *name)
Set the name of the TNamed.
virtual const char * GetName() const
Returns name of object.
virtual TVirtualStreamerInfo * GenerateInfoForPair(const std::string &pairclassname, bool silent, size_t hint_pair_offset, size_t hint_pair_size)=0
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'
static constexpr double s
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.