105 Warning(
"DeleteArray",
"Cannot properly delete emulated array of %s at %p, I don't know how many elements it has!",
fClass->
GetName(), p);
123 std::vector<std::string> inside;
128 if ( inside[0].find(
"stdext::hash_") != std::string::npos ) {
129 inside[0].replace(3,10,
"::");
131 if ( inside[0].find(
"__gnu_cxx::hash_") != std::string::npos ) {
132 inside[0].replace(0,16,
"std::");
139 auto alignedSize = [](
size_t in) {
140 constexpr size_t kSizeOfPtr =
sizeof(
void*);
141 return in + (kSizeOfPtr - in%kSizeOfPtr)%kSizeOfPtr;
146 nam =
"pair<"+inside[1]+
","+inside[2];
147 nam += (nam[nam.length()-1]==
'>') ?
" >" :
">";
168 if (num > 3 && !inside[3].empty()) {
188 if (num > 2 && !inside[2].empty()) {
202 Fatal(
"TEmulatedCollectionProxy",
"Components of %s not analysed!",cl->
GetName());
204 Fatal(
"TEmulatedCollectionProxy",
"Collection class %s not found!",
fTypeinfo.name());
221 Fatal(
"TEmulatedCollectionProxy",
"Size> Logic error - no proxy object set.");
228 Resize(0, opt && *opt==
'f');
235 typedef std::string String_t;
255 for( i=left; i<nCurr; ++i, addr +=
fValDiff ) {
256 ((std::string*)addr)->~String_t();
260 for( i=left; i<nCurr; ++i, addr +=
fValDiff ) {
264 void* ptr =
h->ptr();
270 for( i=nCurr; i<left; ++i, addr +=
fValDiff ) {
274 if (force)
delete (std::string*)
h->ptr();
279 for( i=nCurr; i<left; ++i, addr +=
fValDiff ) {
281 if (force)
delete (
TString*)
h->ptr();
296 for( i=left; i<nCurr; ++i, addr +=
fValDiff ) {
302 for( i=left; i<nCurr; ++i, addr +=
fValDiff )
303 ((std::string*)addr)->~String_t();
306 for( i=left; i<nCurr; ++i, addr +=
fValDiff ) {
316 for( i=nCurr; i<left; ++i, addr +=
fValDiff ) {
318 if (force)
delete (std::string*)
h->ptr();
323 for( i=nCurr; i<left; ++i, addr +=
fValDiff ) {
325 if (force)
delete (
TString*)
h->ptr();
356 for( i=0; i<=nCurr; ++i, offset +=
fValDiff ) {
363 for( i=nCurr; i<left; ++i, addr +=
fValDiff )
367 for( i=nCurr; i<left; ++i, addr +=
fValDiff )
368 ::new(addr) std::string();
373 for( i=nCurr; i<left; ++i, addr +=
fValDiff )
389 for( i=0; i<=nCurr; ++i, offset +=
fValDiff ) {
396 for( i=nCurr; i<left; ++i, addr +=
fValDiff ) {
401 for( i=nCurr; i<left; ++i, addr +=
fValDiff )
402 ::new(addr) std::string();
407 for( i=nCurr; i<left; ++i, addr +=
fValDiff )
420 size_t nCurr =
Size();
423 if ( left == nCurr ) {
426 else if ( left < nCurr ) {
427 Shrink(nCurr, left, force);
433 Fatal(
"TEmulatedCollectionProxy",
"Resize> Logic error - no proxy object set.");
441 size_t s =
c->size();
447 Fatal(
"TEmulatedCollectionProxy",
"At> Logic error - no proxy object set.");
465 Fatal(
"Insert",
"Not yet implemented, require copy of objects.");
475 Bool_t vsn3 =
b.GetInfo() &&
b.GetInfo()->GetOldVersion()<=3;
484 case kInt_t:
b.ReadFastArray(&itm->
s_int , nElements);
break;
487 case kFloat_t:
b.ReadFastArray(&itm->
flt , nElements);
break;
488 case kFloat16_t:
b.ReadFastArrayFloat16(&itm->
flt, nElements);
break;
489 case kDouble_t:
b.ReadFastArray(&itm->
dbl , nElements);
break;
492 case kUInt_t:
b.ReadFastArray(&itm->
u_int , nElements);
break;
499 Error(
"TEmulatedCollectionProxy",
"fType %d is not supported yet!\n",
fVal->
fKind);
503#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
508 DOLOOP( i->read_std_string(
b) );
512 DOLOOP( i->read_std_string_pointer(
b) );
514 DOLOOP( i->read_tstring_pointer(vsn3,
b) );
533 case kInt_t:
b.WriteFastArray(&itm->
s_int , nElements);
break;
536 case kFloat_t:
b.WriteFastArray(&itm->
flt , nElements);
break;
537 case kFloat16_t:
b.WriteFastArrayFloat16(&itm->
flt, nElements);
break;
538 case kDouble_t:
b.WriteFastArray(&itm->
dbl , nElements);
break;
541 case kUInt_t:
b.WriteFastArray(&itm->
u_int , nElements);
break;
548 Error(
"TEmulatedCollectionProxy",
"fType %d is not supported yet!\n",
fVal->
fKind);
551#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
559 DOLOOP( i->write_std_string_pointer(
b) );
561 DOLOOP( i->write_tstring_pointer(
b) );
584 if ( nElements > 0 ) {
592 if (
b.IsReading() ) {
598 if ( nElements > 0 ) {
605 if ( nElements > 0 ) {
621 const char *dmTitle =
"Emulation";
624 if (dt && dt->
GetType() > 0 ) {
629 Error(
"Pair Emulation Building",
"%s is not yet supported in pair emulation",
639 static const char *full_string_name =
"basic_string<char,char_traits<char>,allocator<char> >";
640 if (strcmp(dmType,
"string") == 0 || strcmp(dmType,
"std::string") == 0 || strcmp(dmType,full_string_name)==0 ) {
644 return new TStreamerSTL(dmName,dmTitle,offset,dmFull,dmFull,dmIsPtr);
680 std::string pname =
"pair<"+fname+
","+sname;
681 pname += (pname[pname.length()-1]==
'>') ?
" >" :
">";
691 Int_t sp =
sizeof(
void *);
693 if (size%sp != 0) size = size - size%sp + sp;
static TStreamerElement * R__CreateEmulatedElement(const char *dmName, const char *dmFull, Int_t offset)
TStreamerInfo * R__GenerateTClassForPair(const std::string &f, const std::string &s)
void Error(const char *location, const char *msgfmt,...)
R__EXTERN Int_t gErrorIgnoreLevel
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.
TVirtualStreamerInfo * GetStreamerInfo(Int_t version=0) const
returns a pointer to the TVirtualStreamerInfo object for version If the object does not exist,...
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...
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
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.
Basic data type descriptor (datatype information is obtained from CINT).
Int_t Size() const
Get size of basic typedef'ed type.
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'.
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 TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
virtual const char * GetName() const
Returns name of object.
virtual void Delete(Option_t *option="")
Remove all objects from the array AND delete all heap based objects.
virtual void SetSize(Int_t dsize)
virtual Int_t GetSize() const
Returns size of this element in bytes.
Describe Streamer information for one class version.
TObjArray * GetElements() const
void BuildCheck(TFile *file=0)
Check if built and consistent with the class dictionary.
void BuildOld()
rebuild the TStreamerInfo structure
void SetClass(TClass *cl)
ROOT::ESTLType STLKind(std::string_view type)
Converts STL container name to number.
ROOT::ESTLType IsSTLCont(std::string_view type)
type : type name: vector<list<classA,allocator>,allocator> result: 0 : not stl container code of cont...
std::string ShortType(const char *typeDesc, int mode)
Return the absolute type of typeDesc.
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
static constexpr double second
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.