29 #define MESSAGE(which,text) 48 virtual ~TGenVectorProxy()
61 return ((
char*)fEnv->
fStart) + fValDiff*idx;
64 Fatal(
"TGenVectorProxy",
"At> Logic error - no proxy object set.");
73 TPushPop helper(proxy,ptr);
74 proxy->
Clear(
"force");
98 virtual ~TGenVectorBoolProxy()
102 virtual void* At(
UInt_t idx)
107 if ( fEnv && fEnv->fObject ) {
108 auto vec = (std::vector<bool> *)(fEnv->fObject);
109 fLastValue = (*vec)[idx];
113 Fatal(
"TGenVectorProxy",
"At> Logic error - no proxy object set.");
117 virtual void DeleteItem(
Bool_t force,
void* ptr)
const 120 if ( force && ptr ) {
121 fVal->DeleteItem(ptr);
144 virtual ~TGenBitsetProxy()
148 virtual void* At(
UInt_t idx)
153 if ( fEnv && fEnv->fObject ) {
156 fEnv->fStart =
fFirst.invoke(fEnv);
160 fEnv->fIdx = idx - fEnv->fIdx;
161 if (! fEnv->fStart ) fEnv->fStart =
fFirst.invoke(fEnv);
166 typedef ROOT::TCollectionProxyInfo::Environ<std::pair<size_t,Bool_t> > EnvType_t;
167 EnvType_t *
e = (EnvType_t*)fEnv;
168 return &(e->fIterator.second);
170 Fatal(
"TGenVectorProxy",
"At> Logic error - no proxy object set.");
174 virtual void DeleteItem(
Bool_t force,
void* ptr)
const 177 if ( force && ptr ) {
178 fVal->DeleteItem(ptr);
193 class TGenListProxy :
public TGenVectorProxy {
200 virtual ~TGenListProxy()
206 if ( fEnv && fEnv->fObject ) {
210 return fEnv->fStart =
fFirst.invoke(fEnv);
212 fEnv->fIdx = idx - fEnv->fIdx;
213 if (! fEnv->fStart ) fEnv->fStart =
fFirst.invoke(fEnv);
214 void*
result = fNext.invoke(fEnv);
220 Fatal(
"TGenListProxy",
"At> Logic error - no proxy object set.");
235 class TGenSetProxy :
public TGenVectorProxy {
242 virtual ~TGenSetProxy()
248 if ( fEnv && fEnv->fObject ) {
249 if ( fEnv->fUseTemp ) {
250 return (((
char*)fEnv->fTemp)+idx*fValDiff);
255 return fEnv->fStart =
fFirst.invoke(fEnv);
257 fEnv->fIdx = idx - fEnv->fIdx;
258 if (! fEnv->fStart ) fEnv->fStart =
fFirst.invoke(fEnv);
259 void*
result = fNext.invoke(fEnv);
265 Fatal(
"TGenSetProxy",
"At> Logic error - no proxy object set.");
280 class TGenMapProxy :
public TGenSetProxy {
287 virtual ~TGenMapProxy()
291 virtual void DeleteItem(
Bool_t force,
void* ptr)
const 294 if ( fKey->fProperties&kNeedDelete) {
296 TPushPop helper(proxy,fKey->fCase&
kIsPointer ? *(
void**)ptr : ptr);
297 proxy->
Clear(
"force");
299 if ( fVal->fProperties&kNeedDelete) {
301 char *addr = ((
char*)ptr)+fValOffset;
302 TPushPop helper(proxy,fVal->fCase&
kIsPointer ? *(
void**)addr : addr);
303 proxy->
Clear(
"force");
307 fKey->DeleteItem(*(
void**)ptr);
310 char *addr = ((
char*)ptr)+fValOffset;
311 fVal->DeleteItem(*(
void**)addr);
321 std::string inside = (inside_type.find(
"const ")==0) ? inside_type.substr(6) : inside_type;
327 fSize = std::string::npos;
330 if ( inside.substr(0,6) ==
"string" || inside.substr(0,11) ==
"std::string" ) {
331 fCase = kBIT_ISSTRING;
333 fCtor =
fType->GetNew();
334 fDtor =
fType->GetDestructor();
335 fDelete =
fType->GetDelete();
336 switch(inside[inside.length()-1]) {
339 fSize =
sizeof(
void*);
342 fSize =
sizeof(std::string);
356 if (intype != inside) {
358 fSize =
sizeof(
void*);
360 fCase |= kBIT_ISTSTRING;
364 fCtor =
fType->GetNew();
365 fDtor =
fType->GetDestructor();
366 fDelete =
fType->GetDelete();
375 assert(typeTable &&
"The type of the list of type has changed");
376 assert(enumTable &&
"The type of the list of enum has changed");
378 TDataType *fundType = (
TDataType *)typeTable->THashTable::FindObject( intype.c_str() );
379 if (fundType && fundType->
GetType() < 0x17 && fundType->
GetType() > 0) {
384 if (intype != inside) {
386 fSize =
sizeof(
void*);
388 fSize = fundType->
Size();
390 }
else if (enumTable->THashList::FindObject( intype.c_str() ) ) {
393 fSize =
sizeof(
Int_t);
395 if (intype != inside) {
397 fSize =
sizeof(
void*);
414 if (intype != inside) {
416 fSize =
sizeof(
void*);
431 fSize =
sizeof(
Int_t);
438 fSize =
sizeof(
void*);
455 fundType =
gROOT->GetType( intype.c_str() );
457 if (intype !=
"long double") {
458 Error(
"TGenCollectionProxy",
"Unknown fundamental type %s",intype.c_str());
465 R__ASSERT((fKind>0 && fKind<0x17) || (fKind==-1&&(prop&kIsPointer)) );
472 fCase = prop & (kIsPointer|kIsFundamental|kIsEnum|
kIsClass);
474 fCase |= kBIT_ISTSTRING;
483 fProperties |= kNeedDelete;
487 if ( fSize == std::string::npos ) {
491 fSize =
fType->Size();
503 return fSize != std::string::npos;
515 fType->Destructor(ptr);
518 ::operator
delete(ptr);
546 fTypeinfo(copy.fTypeinfo)
607 Fatal(
"TGenCollectionProxy",
608 "%s %s are too large:%ld bytes. Maximum is:%ld bytes",
609 "Iterators for collection",
658 Fatal(
"TGenCollectionProxy",
659 "%s %s are too large:%ld bytes. Maximum is:%ld bytes",
660 "Iterators for collection",
677 void clearVector(vec&
v)
681 for(
typename vec::iterator i=v.begin(); i != v.end(); ++i) {
682 typename vec::value_type
e = *i;
705 std::map<std::string, TObjArray*>::iterator it;
728 return new TGenBitsetProxy(*
this);
731 if ((*fValue).fKind ==
kBool_t) {
732 return new TGenVectorBoolProxy(*
this);
734 return new TGenVectorProxy(*
this);
739 return new TGenListProxy(*
this);
744 return new TGenMapProxy(*
this);
749 return new TGenSetProxy(*
this);
761 if (
fValue.load() )
return p;
771 Fatal(
"TGenCollectionProxy",
"No 'size' function pointer for class %s present.",
fName.c_str());
774 Fatal(
"TGenCollectionProxy",
"No 'resize' function for class %s present.",
fName.c_str());
777 Fatal(
"TGenCollectionProxy",
"No 'next' function for class %s present.",
fName.c_str());
780 Fatal(
"TGenCollectionProxy",
"No 'begin' function for class %s present.",
fName.c_str());
783 Fatal(
"TGenCollectionProxy",
"No 'clear' function for class %s present.",
fName.c_str());
786 Fatal(
"TGenCollectionProxy",
"No 'block constructor' function for class %s present.",
fName.c_str());
789 Fatal(
"TGenCollectionProxy",
"No 'block destructor' function for class %s present.",
fName.c_str());
792 Fatal(
"TGenCollectionProxy",
"No 'data feed' function for class %s present.",
fName.c_str());
795 Fatal(
"TGenCollectionProxy",
"No 'data collect' function for class %s present.",
fName.c_str());
798 Fatal(
"TGenCollectionProxy",
"No 'environment creation' function for class %s present.",
fName.c_str());
809 Fatal(
"TGenCollectionProxy",
"Could not find %s!",name.c_str());
820 if (
fValue.load())
return this;
828 std::vector<std::string> inside;
832 Value* newfValue =
nullptr;
833 if ( inside[0].find(
"stdext::hash_") != std::string::npos )
834 inside[0].replace(3,10,
"::");
835 if ( inside[0].find(
"__gnu_cxx::hash_") != std::string::npos )
836 inside[0].replace(0,16,
"std::");
852 int slong =
sizeof(
void*);
858 nam =
"pair<"+inside[1]+
","+inside[2];
859 nam += (nam[nam.length()-1]==
'>') ?
" >" :
">";
901 Fatal(
"TGenCollectionProxy",
"Components of %s not analysed!",cl->
GetName());
903 Fatal(
"TGenCollectionProxy",
"Collection class %s not found!",
fTypeinfo.name());
966 return fValue.load() ? (*fValue).fType.GetClass() : 0;
978 if (
fValue.load() && (*fValue).fType == oldValueType) {
980 (*fValue).fType = newValueType;
990 return (*fValue).fKind;
1001 if ((*fValue).fKind ==
kBool_t) {
1028 typedef ROOT::TCollectionProxyInfo::Environ <std::pair<size_t, Bool_t>> EnvType_t;
1029 EnvType_t *
e = (EnvType_t *)
fEnv;
1030 return &(e->fIterator.second);
1059 Fatal(
"TGenCollectionProxy",
"At> Logic error - no proxy object set.");
1092 Fatal(
"TGenCollectionProxy",
"Size> Logic error - no proxy object set.");
1105 for (i=n; i<nold; ++i)
1114 Fatal(
"TGenCollectionProxy",
"Resize> Logic error - no proxy object set.");
1200 fFeed((
void*)data,container,size);
1233 if ( back->
fObject == objstart ) {
1281 if ( force && ptr ) {
1290 TPushPop helper(proxy,*(
void**)ptr);
1291 proxy->
Clear(
"force");
1298 proxy->
Clear(
"force");
1305 TPushPop helper(proxy,*(
void**)addr);
1306 proxy->
Clear(
"force");
1313 proxy->
Clear(
"force");
1322 TPushPop helper(proxy,*(
void**)ptr);
1323 proxy->
Clear(
"force");
1330 proxy->
Clear(
"force");
1343 MayNotUse(
"TGenCollectionProxy::ReadBuffer(TBuffer &, void *, const TClass *)");
1350 MayNotUse(
"TGenCollectionProxy::ReadBuffer(TBuffer &, void *)");
1362 Fatal(
"TGenCollectionProxy",
"Streamer> Logic error - no proxy object set.");
1383 struct TGenCollectionProxy__SlowIterator {
1393 new (*begin_arena) TGenCollectionProxy__SlowIterator(proxy);
1401 TGenCollectionProxy__SlowIterator *iterator = (TGenCollectionProxy__SlowIterator*)iter;
1402 if (iterator->fIndex != *(
UInt_t*)end) {
1403 void *
result = iterator->fProxy->At(iterator->fIndex);
1404 ++(iterator->fIndex);
1415 *(TGenCollectionProxy__SlowIterator*)dest = *(TGenCollectionProxy__SlowIterator*)source;
1440 std::vector<char> *vec = (std::vector<char>*)obj;
1446 *begin_arena = &(*vec->begin());
1447 #ifdef R__VISUAL_CPLUSPLUS 1448 *end_arena = &(*(vec->end()-1)) + 1;
1451 *end_arena = &(*vec->end());
1469 *(
void**)dest = *(
void**)source;
1495 *end_arena = s->
GetEnd();
1511 *(
void**)dest = *(
void**)source;
1673 if (oldClass == 0) {
1679 std::map<std::string, TObjArray*>::iterator it;
1697 if (valueClass == 0) {
1711 (*fConversionReadMemberWise)[oldClass->
GetName()] = arr;
Method fSize
Container accessors: size of container.
virtual const char * GetName() const
Returns name of object.
double read(const std::string &file_name)
reading
void(* fDeleteSingleIterator)(void *iter)
void * TGenCollectionProxy__StagingCopyIterator(void *dest, const void *source)
void DeleteItem(void *ptr)
DeleteIterator_t fFunctionDeleteIterator
void *(* fSizeFunc)(void *)
void TGenCollectionProxy__StagingDeleteSingleIterators(void *)
Nothing to do.
virtual TStreamerInfoActions::TActionSequence * GetReadMemberWiseActions(Int_t version)
Return the set of action necessary to stream in this collection member-wise coming from the old value...
Proxies_t fProxyKept
Optimization: Keep proxies once they were created.
virtual void DeleteItem(Bool_t force, void *ptr) const
Call to delete/destruct individual item.
virtual UInt_t Sizeof() const
Return the sizeof the collection object.
virtual Int_t GetProperties() const
DeleteTwoIterators_t fFunctionDeleteTwoIterators
void *(* fNext)(void *iter, const void *end)
UInt_t fProperties
Additional properties of the value type (kNeedDelete)
void *(* fConstructFunc)(void *, size_t)
void TGenCollectionProxy__VectorDeleteTwoIterators(void *, void *)
Nothing to do.
virtual Bool_t HasPointers() const
Return true if the content is of type 'pointer to'.
void(* fResizeFunc)(void *, size_t)
virtual void UpdateValueClass(const TClass *oldcl, TClass *newcl)
Update the internal ValueClass when a TClass constructor need to replace an emulated TClass by the re...
void Fatal(const char *location, const char *msgfmt,...)
TVirtualStreamerInfo * GetConversionStreamerInfo(const char *onfile_classname, Int_t version) const
Return a Conversion StreamerInfo from the class 'classname' for version number 'version' to this clas...
Bool_t fPointers
Flag to indicate if containee has pointers (key or value)
std::map< std::string, TObjArray * > * fConversionReadMemberWise
Array of bundle of TStreamerInfoActions to stream out (read) derived from another class...
Collectfunc_t fCollect
Method to collect objects from container.
std::string fName
Name of the class being proxied.
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.
R__EXTERN TVirtualMutex * gInterpreterMutex
virtual TStreamerInfoActions::TActionSequence * GetWriteMemberWiseActions()
Return the set of action necessary to stream out this collection member-wise.
virtual void PopProxy()
Remove the last object.
TVirtualStreamerInfo * GetStreamerInfo(Int_t version=0) const
returns a pointer to the TVirtualStreamerInfo object for version If the object does not exist...
virtual Bool_t TypeInfo_IsValid(TypeInfo_t *) const
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...
Method fFirst
Container accessors: generic iteration: first.
Buffer base class used for serializing objects.
virtual EDataType GetType() const
If the content is a simple numerical value, return its type (see TDataType)
TClass * fOnFileClass
On file class.
virtual TypeInfo_t * TypeInfo_Factory() const
Feedfunc_t fFeed
Container accessors: block feed.
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
void *(* fFeedFunc)(void *, void *, size_t)
virtual void Clear(const char *opt="")=0
void *(* fClearFunc)(void *)
void CheckFunctions() const
Check existence of function pointers.
TObject * At(Int_t idx) const
#define MESSAGE(which, text)
UInt_t fCase
type of data of Value_type
void * TGenCollectionProxy__StagingNext(void *, const void *)
Should not be used.
void *(* CopyIterator_t)(void *dest, const void *source)
Sizing_t fResize
Container accessors: resize container.
void * invoke(void *obj) const
static TActionSequence * CreateReadMemberWiseActions(TVirtualStreamerInfo *info, TVirtualCollectionProxy &proxy)
Create the bundle of the actions necessary for the streaming memberwise of the content described by '...
TClass * GetClass() const
virtual void TypeInfo_Delete(TypeInfo_t *) const
size_t fSize
fSize of the contained object
virtual ULong_t GetIncrement() const
Return the offset between two consecutive value_types (memory layout).
void(* DeleteIterator_t)(void *iter)
virtual Long_t TypeInfo_Property(TypeInfo_t *) const
void * TGenCollectionProxy__SlowNext(void *iter, const void *end)
void * TGenCollectionProxy__VectorNext(void *, const void *)
Should not be used.
TObjArray * fReadMemberWise
Array of bundle of TStreamerInfoActions to stream out (read)
CopyIterator_t fFunctionCopyIterator
THashTable implements a hash table to store TObject's.
void TGenCollectionProxy__SlowCreateIterators(void *, void **begin_arena, void **end_arena, TVirtualCollectionProxy *proxy)
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
static TGenCollectionProxy::Value * R__CreateValue(const std::string &name, Bool_t silent)
Utility routine to issue a Fatal error is the Value object is not valid.
virtual CreateIterators_t GetFunctionCreateIterators(Bool_t read=kTRUE)
See typedef void (*CreateIterators_t)(void *collection, void *&begin_arena, void *&end_arena); begin_...
virtual int TypeInfo_Size(TypeInfo_t *) const
virtual TStreamerInfoActions::TActionSequence * GetConversionReadMemberWiseActions(TClass *oldClass, Int_t version)
Return the set of action necessary to stream in this collection member-wise coming from the old value...
void TGenCollectionProxy__SlowDeleteTwoIterators(void *, void *)
Nothing to do.
virtual void TypeInfo_Init(TypeInfo_t *, const char *) const
ROOT::ESTLType STLKind(std::string_view type)
Converts STL container name to number.
Proxies_t fProxyList
Stack of recursive proxies.
Method fClear
Method cache for container accessors: clear container.
Method0 fCreateEnv
Method to allocate an Environment holder.
ArrIterfunc_t fConstruct
Container accessors: block construct.
virtual void Streamer(TBuffer &refBuffer)
Streamer Function.
void Error(const char *location, const char *msgfmt,...)
void SetTarget(void *target)
Staged_t fStaged
Optimization: Keep staged array once they were created.
void MayNotUse(const char *method)
This function can be used in classes that should override a certain function, but in the inherited cl...
void TGenCollectionProxy__StagingDeleteTwoIterators(void *, void *)
Nothing to do.
int fValOffset
Offset from key to value (in maps)
TGenCollectionProxy * Initialize(Bool_t silent) const
Proxy initializer.
Small helper to save proxy environment in the event of recursive calls.
virtual void AddAtAndExpand(TObject *obj, Int_t idx)
Add object at position idx.
int fSTL_type
STL container type.
void(* CreateIterators_t)(void *collection, void **begin_arena, void **end_arena, TVirtualCollectionProxy *proxy)
Basic data type descriptor (datatype information is obtained from CINT).
virtual void Commit(void *env)
Commit the change.
static TActionSequence * CreateWriteMemberWiseActions(TVirtualStreamerInfo *info, TVirtualCollectionProxy &proxy)
Create the bundle of the actions necessary for the streaming memberwise of the content described by '...
void *(* fCopyIterator)(void *dest, const void *source)
Int_t Size() const
Return size of object of this class.
virtual void PushProxy(void *objstart)
Add an object.
virtual Next_t GetFunctionNext(Bool_t read=kTRUE)
See typedef void* (*Next_t)(void *iter, void *end); iter and end should be pointer to respectively an...
CreateIterators_t fFunctionCreateIterators
The ROOT global object gROOT contains a list of all defined classes.
Next_t fFunctionNextIterator
void Streamer(void *obj, TBuffer &b, const TClass *onfile_class=0) const
int fValDiff
Offset between two consecutive value_types (memory layout).
void TGenCollectionProxy__SlowDeleteSingleIterators(void *)
Nothing to do.
#define R__LOCKGUARD2(mutex)
void(* fDestructFunc)(void *, size_t)
virtual void Resize(UInt_t n, Bool_t force_delete)
Resize the container.
virtual TClass * GetCollectionClass() const
Return a pointer to the TClass representing the container.
void *(* fNextFunc)(void *)
virtual DeleteIterator_t GetFunctionDeleteIterator(Bool_t read=kTRUE)
See typedef void (*DeleteIterator_t)(void *iter); If the sizeof iterator is greater than fgIteratorAr...
void *(* fFirstFunc)(void *)
virtual DeleteTwoIterators_t GetFunctionDeleteTwoIterators(Bool_t read=kTRUE)
See typedef void (*DeleteTwoIterators_t)(void *begin, void *end); If the sizeof iterator is greater t...
virtual TGenCollectionProxy * InitializeEx(Bool_t silent)
Proxy initializer.
void TGenCollectionProxy__StagingCreateIterators(void *obj, void **begin_arena, void **end_arena, TVirtualCollectionProxy *)
virtual TClass * GetValueClass() const
Return a pointer to the TClass representing the content.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
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.
std::atomic< Value * > fValue
Descriptor of the container value type.
TClassRef fType
TClass reference of Value_type in collection.
virtual void Clear(const char *opt="")
Clear the emulated collection.
virtual TVirtualCollectionProxy * Generate() const
Virtual copy constructor.
virtual void ReadBuffer(TBuffer &b, void *obj)
virtual CopyIterator_t GetFunctionCopyIterator(Bool_t read=kTRUE)
See typedef void (*CopyIterator_t)(void *&dest, const void *source); Copy the iterator source...
Value(const std::string &info, Bool_t silent)
Constructor.
virtual void * At(UInt_t idx)
Return the address of the value at index 'idx'.
void * TGenCollectionProxy__VectorCopyIterator(void *dest, const void *source)
virtual UInt_t Size() const =0
Value * fKey
Descriptor of the key_type.
virtual void operator()(TBuffer &refBuffer, void *pObject)
TClassStreamer IO overload.
void * TGenCollectionProxy__SlowCopyIterator(void *dest, const void *source)
void *(* fCollectFunc)(void *, void *)
Small helper to stage the content of an associative container when reading and before inserting it in...
#define dest(otri, vertexptr)
Proxy around an arbitrary container, which implements basic functionality and iteration.
Int_t Size() const
Get size of basic typedef'ed type.
EnvironBase_t * fEnv
Address of the currently proxied object.
std::string ShortType(const char *typeDesc, int mode)
Return the absolute type of typeDesc.
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Sizing_t fDestruct
Container accessors: block destruct.
void TGenCollectionProxy__VectorCreateIterators(void *obj, void **begin_arena, void **end_arena, TVirtualCollectionProxy *)
We can safely assume that the std::vector layout does not really depend on the content! ...
Bool_t IsValid()
Return true if the Value has been properly initialized.
void(* fDeleteTwoIterators)(void *begin, void *end)
Method fNext
Container accessors: generic iteration: next.
virtual UInt_t Size() const
Return the current size of the container.
void *(* Next_t)(void *iter, const void *end)
Info_t fTypeinfo
Type information.
R__EXTERN TInterpreter * gCling
virtual Int_t GetSize() const
void Resize(size_t nelement)
Abstract Interface class describing Streamer information for one class.
void(* DeleteTwoIterators_t)(void *begin, void *end)
const std::type_info & Info_t
void(* fCreateIterators)(void *collection, void **begin_arena, void **end_arena, TVirtualCollectionProxy *proxy)
TStreamerInfoActions::TActionSequence * fWriteMemberWise
Small helper to describe the Value_type or the key_type of an STL container.
void TGenCollectionProxy__VectorDeleteSingleIterators(void *)
Nothing to do.
virtual ~TGenCollectionProxy()
Standard destructor.
virtual void * Allocate(UInt_t n, Bool_t forceDelete)
Allocate the needed space.
Value * fVal
Descriptor of the Value_type.
virtual Int_t GetCollectionType() const
Return the type of collection see TClassEdit::ESTLType.