28#define MESSAGE(which,text)
47 virtual ~TGenVectorProxy()
60 return ((
char*)fEnv->
fStart) + fValDiff*idx;
63 Fatal(
"TGenVectorProxy",
"At> Logic error - no proxy object set.");
72 TPushPop helper(proxy,ptr);
73 proxy->
Clear(
"force");
97 virtual ~TGenVectorBoolProxy()
108 fLastValue = (*vec)[idx];
112 Fatal(
"TGenVectorProxy",
"At> Logic error - no proxy object set.");
119 if ( force && ptr ) {
143 virtual ~TGenBitsetProxy()
165 typedef ROOT::TCollectionProxyInfo::Environ<std::pair<size_t,Bool_t> > EnvType_t;
166 EnvType_t *
e = (EnvType_t*)fEnv;
167 return &(
e->fIterator.second);
169 Fatal(
"TGenVectorProxy",
"At> Logic error - no proxy object set.");
176 if ( force && ptr ) {
192class TGenListProxy :
public TGenVectorProxy {
199 virtual ~TGenListProxy()
219 Fatal(
"TGenListProxy",
"At> Logic error - no proxy object set.");
234class TGenSetProxy :
public TGenVectorProxy {
241 virtual ~TGenSetProxy()
249 return (((
char*)
fEnv->
fTemp)+idx*fValDiff);
264 Fatal(
"TGenSetProxy",
"At> Logic error - no proxy object set.");
279class TGenMapProxy :
public TGenSetProxy {
286 virtual ~TGenMapProxy()
290 virtual void DeleteItem(
Bool_t force,
void* ptr)
const
296 proxy->
Clear(
"force");
302 proxy->
Clear(
"force");
320 std::string inside = (inside_type.find(
"const ")==0) ? inside_type.substr(6) : inside_type;
326 fSize = std::string::npos;
330 bool nameChanged =
false;
333 bool isPointer = nameChanged;
336 if (!nameChanged && intype[intype.length()-1] ==
'*') {
339 if (intype[intype.length()-1] ==
'*') {
342 Warning(
"TGenCollectionProxy::Value::Value",
"I/O not supported for collection of pointer to pointer: %s", inside_type.c_str());
343 fSize =
sizeof(
void*);
349 if ( intype.substr(0,6) ==
"string" || intype.substr(0,11) ==
"std::string" ) {
357 fSize =
sizeof(
void*);
359 fSize =
sizeof(std::string);
374 fSize =
sizeof(
void*);
389 assert(typeTable &&
"The type of the list of type has changed");
391 TDataType *fundType = (
TDataType *)typeTable->THashTable::FindObject( intype.c_str() );
392 if (fundType && fundType->
GetType() < 0x17 && fundType->
GetType() > 0) {
399 fSize =
sizeof(
void*);
410 fSize =
sizeof(
void*);
429 fSize =
sizeof(
void*);
451 fSize =
sizeof(
void*);
460 fSize = std::string::npos;
462 Error(
"TGenCollectionProxy",
"Could not retrieve the TClass for %s", intype.c_str());
470 fundType =
gROOT->GetType( intype.c_str() );
472 if (intype !=
"long double" && !silent) {
473 Error(
"TGenCollectionProxy",
"Unknown fundamental type %s",intype.c_str());
502 if (
fSize == std::string::npos ) {
518 return fSize != std::string::npos;
530 fType->Destructor(ptr);
533 ::operator
delete(ptr);
621 if ( iter_size >
sizeof(
e.fIterator) ) {
622 Fatal(
"TGenCollectionProxy",
623 "%s %s are too large:%ld bytes. Maximum is:%ld bytes",
624 "Iterators for collection",
644 fTypeinfo(info.fInfo), fOnFileClass(0)
673 Fatal(
"TGenCollectionProxy",
674 "%s %s are too large:%ld bytes. Maximum is:%ld bytes",
675 "Iterators for collection",
692 void clearVector(vec&
v)
696 for(
typename vec::iterator i=
v.begin(); i !=
v.end(); ++i) {
697 typename vec::value_type
e = *i;
720 std::map<std::string, TObjArray*>::iterator it;
743 return new TGenBitsetProxy(*
this);
746 if ((*fValue).fKind ==
kBool_t) {
747 return new TGenVectorBoolProxy(*
this);
749 return new TGenVectorProxy(*
this);
754 return new TGenListProxy(*
this);
759 return new TGenMapProxy(*
this);
764 return new TGenSetProxy(*
this);
776 if (
fValue.load() )
return p;
786 Fatal(
"TGenCollectionProxy",
"No 'size' function pointer for class %s present.",
fName.c_str());
789 Fatal(
"TGenCollectionProxy",
"No 'resize' function for class %s present.",
fName.c_str());
792 Fatal(
"TGenCollectionProxy",
"No 'next' function for class %s present.",
fName.c_str());
795 Fatal(
"TGenCollectionProxy",
"No 'begin' function for class %s present.",
fName.c_str());
798 Fatal(
"TGenCollectionProxy",
"No 'clear' function for class %s present.",
fName.c_str());
801 Fatal(
"TGenCollectionProxy",
"No 'block constructor' function for class %s present.",
fName.c_str());
804 Fatal(
"TGenCollectionProxy",
"No 'block destructor' function for class %s present.",
fName.c_str());
807 Fatal(
"TGenCollectionProxy",
"No 'data feed' function for class %s present.",
fName.c_str());
810 Fatal(
"TGenCollectionProxy",
"No 'data collect' function for class %s present.",
fName.c_str());
813 Fatal(
"TGenCollectionProxy",
"No 'environment creation' function for class %s present.",
fName.c_str());
824 Fatal(
"TGenCollectionProxy",
"Could not find %s!",
name.c_str());
835 if (
fValue.load())
return this;
843 std::vector<std::string> inside;
847 Value* newfValue =
nullptr;
848 if ( inside[0].find(
"stdext::hash_") != std::string::npos )
849 inside[0].replace(3,10,
"::");
850 if ( inside[0].find(
"__gnu_cxx::hash_") != std::string::npos )
851 inside[0].replace(0,16,
"std::");
864 if (num > 3 && !inside[3].empty()) {
872 int slong =
sizeof(
void*);
878 nam =
"pair<"+inside[1]+
","+inside[2];
879 nam += (nam[nam.length()-1]==
'>') ?
" >" :
">";
893 Fatal(
"InitializeEx",
894 "The %s for %s reports a class size that is inconsistent with the one registered "
895 "through the CollectionProxy for %s: %d vs %d\n",
896 paircl->
IsLoaded() ?
"dictionary" :
"interpreter information for", nam.c_str(),
899 gROOT->GetListOfClasses()->Remove(paircl);
902 Fatal(
"InitializeEx",
903 "The TClass creation for %s did not get the right size: %d instead of%d\n",
938 if (num > 2 && !inside[2].empty()) {
955 Fatal(
"TGenCollectionProxy",
"Components of %s not analysed!",cl->
GetName());
957 Fatal(
"TGenCollectionProxy",
"Collection class %s not found!",
fTypeinfo.name());
974 if (!
fValue.load(std::memory_order_relaxed)) {
984 if (!
fValue.load(std::memory_order_relaxed)) {
1004 if( !
fValue.load(std::memory_order_relaxed) )
1019 auto value =
fValue.load(std::memory_order_relaxed);
1022 value =
fValue.load(std::memory_order_relaxed);
1024 return value ? (*value).fType.GetClass() : 0;
1032 auto value =
fValue.load(std::memory_order_relaxed);
1035 value =
fValue.load(std::memory_order_relaxed);
1037 return value ? (*value).fKind :
kNoType_t;
1048 if ((*fValue).fKind ==
kBool_t) {
1075 typedef ROOT::TCollectionProxyInfo::Environ <std::pair<size_t, Bool_t>> EnvType_t;
1076 EnvType_t *
e = (EnvType_t *)
fEnv;
1077 return &(
e->fIterator.second);
1106 Fatal(
"TGenCollectionProxy",
"At> Logic error - no proxy object set.");
1139 Fatal(
"TGenCollectionProxy",
"Size> Logic error - no proxy object set.");
1152 for (i=
n; i<nold; ++i)
1161 Fatal(
"TGenCollectionProxy",
"Resize> Logic error - no proxy object set.");
1247 fFeed((
void*)data,container,size);
1262 if (
s->GetTarget() ) {
1263 fFeed(
s->GetContent(),
s->GetTarget(),
s->GetSize());
1280 if ( back->
fObject == objstart ) {
1299 e->fObject = objstart;
1314 if ( --
e->fRefCount <= 0 ) {
1328 if ( force && ptr ) {
1337 TPushPop helper(proxy,*(
void**)ptr);
1338 proxy->
Clear(
"force");
1345 proxy->
Clear(
"force");
1352 TPushPop helper(proxy,*(
void**)addr);
1353 proxy->
Clear(
"force");
1360 proxy->
Clear(
"force");
1369 TPushPop helper(proxy,*(
void**)ptr);
1370 proxy->
Clear(
"force");
1377 proxy->
Clear(
"force");
1390 MayNotUse(
"TGenCollectionProxy::ReadBuffer(TBuffer &, void *, const TClass *)");
1397 MayNotUse(
"TGenCollectionProxy::ReadBuffer(TBuffer &, void *)");
1409 Fatal(
"TGenCollectionProxy",
"Streamer> Logic error - no proxy object set.");
1430struct TGenCollectionProxy__SlowIterator {
1440 new (*begin_arena) TGenCollectionProxy__SlowIterator(proxy);
1448 TGenCollectionProxy__SlowIterator *iterator = (TGenCollectionProxy__SlowIterator*)iter;
1449 if (iterator->fIndex != *(
UInt_t*)end) {
1450 void *result = iterator->fProxy->At(iterator->fIndex);
1451 ++(iterator->fIndex);
1462 *(TGenCollectionProxy__SlowIterator*)
dest = *(TGenCollectionProxy__SlowIterator*)source;
1487 std::vector<char> *vec = (std::vector<char>*)obj;
1493 *begin_arena = &(*vec->begin());
1494#ifdef R__VISUAL_CPLUSPLUS
1495 *end_arena = &(*(vec->end()-1)) + 1;
1498 *end_arena = &(*vec->end());
1516 *(
void**)
dest = *(
void**)source;
1541 *begin_arena =
s->GetContent();
1542 *end_arena =
s->GetEnd();
1558 *(
void**)
dest = *(
void**)source;
1720 if (oldClass == 0) {
1726 std::map<std::string, TObjArray*>::iterator it;
1744 if (valueClass == 0) {
1758 (*fConversionReadMemberWise)[oldClass->
GetName()] = arr;
void Error(const char *location, const char *msgfmt,...)
void MayNotUse(const char *method)
This function can be used in classes that should override a certain function, but in the inherited cl...
void Warning(const char *location, const char *msgfmt,...)
void Fatal(const char *location, const char *msgfmt,...)
#define MESSAGE(which, text)
void * TGenCollectionProxy__VectorCopyIterator(void *dest, const void *source)
void TGenCollectionProxy__StagingDeleteTwoIterators(void *, void *)
Nothing to do.
void * TGenCollectionProxy__VectorNext(void *, const void *)
Should not be used.
void TGenCollectionProxy__StagingDeleteSingleIterators(void *)
Nothing to do.
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.
void TGenCollectionProxy__SlowCreateIterators(void *, void **begin_arena, void **end_arena, TVirtualCollectionProxy *proxy)
void * TGenCollectionProxy__SlowNext(void *iter, const void *end)
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!
void * TGenCollectionProxy__StagingCopyIterator(void *dest, const void *source)
void * TGenCollectionProxy__StagingNext(void *, const void *)
Should not be used.
void TGenCollectionProxy__VectorDeleteSingleIterators(void *)
Nothing to do.
void * TGenCollectionProxy__SlowCopyIterator(void *dest, const void *source)
void TGenCollectionProxy__StagingCreateIterators(void *obj, void **begin_arena, void **end_arena, TVirtualCollectionProxy *)
void TGenCollectionProxy__SlowDeleteTwoIterators(void *, void *)
Nothing to do.
void TGenCollectionProxy__VectorDeleteTwoIterators(void *, void *)
Nothing to do.
void TGenCollectionProxy__SlowDeleteSingleIterators(void *)
Nothing to do.
R__EXTERN TVirtualMutex * gInterpreterMutex
R__EXTERN TInterpreter * gCling
#define R__LOCKGUARD(mutex)
void *(* fCopyIterator)(void *dest, const void *source)
void *(* fConstructFunc)(void *, size_t)
void *(* fClearFunc)(void *)
void *(* fFirstFunc)(void *)
void(* fDestructFunc)(void *, size_t)
void(* fDeleteTwoIterators)(void *begin, void *end)
void *(* fCollectFunc)(void *, void *)
void *(* fSizeFunc)(void *)
void *(* fNextFunc)(void *)
void *(* fFeedFunc)(void *, void *, size_t)
void(* fDeleteSingleIterator)(void *iter)
void(* fResizeFunc)(void *, size_t)
void(* fCreateIterators)(void *collection, void **begin_arena, void **end_arena, TVirtualCollectionProxy *proxy)
void *(* fNext)(void *iter, const void *end)
Buffer base class used for serializing objects.
TClass * GetClass() const
TClass instances represent classes, structs and namespaces in the ROOT type system.
ROOT::DesFunc_t GetDestructor() const
ROOT::NewFunc_t GetNew() const
Int_t Size() const
Return size of object of this class.
Bool_t IsLoaded() const
Return true if the shared library of this class is currently in the a process's memory.
TVirtualStreamerInfo * GetStreamerInfo(Int_t version=0, Bool_t isTransient=kFALSE) const
returns a pointer to the TVirtualStreamerInfo object for version If the object does not exist,...
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
Int_t GetClassSize() const
void ReplaceWith(TClass *newcl) const
void Streamer(void *obj, TBuffer &b, const TClass *onfile_class=0) const
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...
ROOT::DelFunc_t GetDelete() const
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.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Basic data type descriptor (datatype information is obtained from CINT).
Int_t Size() const
Get size of basic typedef'ed type.
static TEnum * GetEnum(const std::type_info &ti, ESearchAction sa=kALoadAndInterpLookup)
void * invoke(void *obj) const
Small helper to stage the content of an associative container when reading and before inserting it in...
Proxy around an arbitrary container, which implements basic functionality and iteration.
Method fFirst
Container accessors: generic iteration: first.
std::atomic< Value * > fValue
Descriptor of the container value type.
Next_t fFunctionNextIterator
virtual ~TGenCollectionProxy()
Standard destructor.
Bool_t fPointers
Flag to indicate if containee has pointers (key or value)
Method fNext
Container accessors: generic iteration: next.
virtual void Streamer(TBuffer &refBuffer)
Streamer Function.
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...
TStreamerInfoActions::TActionSequence * fWriteMemberWise
virtual EDataType GetType() const
If the content is a simple numerical value, return its type (see TDataType)
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 UInt_t Size() const
Return the current size of the container.
virtual UInt_t Sizeof() const
Return the sizeof the collection object.
Info_t fTypeinfo
Type information.
int fValOffset
Offset from key to value (in maps)
EnvironBase_t * fEnv
Address of the currently proxied object.
virtual void PopProxy()
Remove the last object.
virtual TClass * GetCollectionClass() const
Return a pointer to the TClass representing the container.
DeleteIterator_t fFunctionDeleteIterator
Collectfunc_t fCollect
Method to collect objects from container.
virtual Bool_t HasPointers() const
Return true if the content is of type 'pointer to'.
virtual TClass * GetValueClass() const
Return a pointer to the TClass representing the content.
TGenCollectionProxy * Initialize(Bool_t silent) const
Proxy initializer.
virtual ULong_t GetIncrement() const
Return the offset between two consecutive value_types (memory layout).
virtual TGenCollectionProxy * InitializeEx(Bool_t silent)
Proxy initializer.
virtual void PushProxy(void *objstart)
Add an object.
std::string fName
Name of the class being proxied.
int fSTL_type
STL container type.
CopyIterator_t fFunctionCopyIterator
Value * fKey
Descriptor of the key_type.
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 Resize(UInt_t n, Bool_t force_delete)
Resize the container.
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 fProxyList
Stack of recursive proxies.
virtual void * Allocate(UInt_t n, Bool_t forceDelete)
Allocate the needed space.
Sizing_t fDestruct
Container accessors: block destruct.
Method0 fCreateEnv
Method to allocate an Environment holder.
virtual void Commit(void *env)
Commit the change.
Value * fVal
Descriptor of the Value_type.
virtual DeleteIterator_t GetFunctionDeleteIterator(Bool_t read=kTRUE)
See typedef void (*DeleteIterator_t)(void *iter); If the sizeof iterator is greater than fgIteratorAr...
virtual void operator()(TBuffer &refBuffer, void *pObject)
TClassStreamer IO overload.
virtual TStreamerInfoActions::TActionSequence * GetWriteMemberWiseActions()
Return the set of action necessary to stream out this collection member-wise.
TClass * fOnFileClass
On file class.
Sizing_t fResize
Container accessors: resize container.
ArrIterfunc_t fConstruct
Container accessors: block construct.
std::map< std::string, TObjArray * > * fConversionReadMemberWise
Array of bundle of TStreamerInfoActions to stream out (read) derived from another class.
void CheckFunctions() const
Check existence of function pointers.
DeleteTwoIterators_t fFunctionDeleteTwoIterators
virtual Int_t GetCollectionType() const
Return the type of collection see TClassEdit::ESTLType.
virtual void * At(UInt_t idx)
Return the address of the value at index 'idx'.
CreateIterators_t fFunctionCreateIterators
virtual void Clear(const char *opt="")
Clear the emulated collection.
TObjArray * fReadMemberWise
Array of bundle of TStreamerInfoActions to stream out (read)
virtual void DeleteItem(Bool_t force, void *ptr) const
Call to delete/destruct individual item.
virtual TVirtualCollectionProxy * Generate() const
Virtual copy constructor.
Staged_t fStaged
Optimization: Keep staged array once they were created.
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...
Method fSize
Container accessors: size of container.
virtual CopyIterator_t GetFunctionCopyIterator(Bool_t read=kTRUE)
See typedef void (*CopyIterator_t)(void *&dest, const void *source); Copy the iterator source,...
Method fClear
Method cache for container accessors: clear container.
Feedfunc_t fFeed
Container accessors: block feed.
virtual CreateIterators_t GetFunctionCreateIterators(Bool_t read=kTRUE)
See typedef void (*CreateIterators_t)(void *collection, void *&begin_arena, void *&end_arena); begin_...
int fValDiff
Offset between two consecutive value_types (memory layout).
virtual void ReadBuffer(TBuffer &b, void *obj)
Proxies_t fProxyKept
Optimization: Keep proxies once they were created.
const std::type_info & Info_t
THashTable implements a hash table to store TObject's.
virtual void TypeInfo_Init(TypeInfo_t *, const char *) const
virtual void TypeInfo_Delete(TypeInfo_t *) const
virtual TypeInfo_t * TypeInfo_Factory() const
virtual Long_t TypeInfo_Property(TypeInfo_t *) const
virtual int TypeInfo_Size(TypeInfo_t *) const
virtual Bool_t TypeInfo_IsValid(TypeInfo_t *) const
virtual const char * GetName() const
Returns name of object.
virtual void AddAtAndExpand(TObject *obj, Int_t idx)
Add object at position idx.
TObject * At(Int_t idx) const
static TActionSequence * CreateReadMemberWiseActions(TVirtualStreamerInfo *info, TVirtualCollectionProxy &proxy)
Create the bundle of the actions necessary for the streaming memberwise of the content described by '...
static TActionSequence * CreateWriteMemberWiseActions(TVirtualStreamerInfo *info, TVirtualCollectionProxy &proxy)
Create the bundle of the actions necessary for the streaming memberwise of the content described by '...
virtual Int_t GetProperties() const
void(* CreateIterators_t)(void *collection, void **begin_arena, void **end_arena, TVirtualCollectionProxy *proxy)
void *(* CopyIterator_t)(void *dest, const void *source)
virtual void Clear(const char *opt="")=0
void *(* Next_t)(void *iter, const void *end)
virtual UInt_t Size() const =0
void(* DeleteTwoIterators_t)(void *begin, void *end)
void(* DeleteIterator_t)(void *iter)
Abstract Interface class describing Streamer information for one class.
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.
std::string GetNameForIO(const std::string &templateInstanceName, TClassEdit::EModType mode=TClassEdit::kNone, bool *hasChanged=nullptr)
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
Small helper to save proxy environment in the event of recursive calls.
Small helper to describe the Value_type or the key_type of an STL container.
void DeleteItem(void *ptr)
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)
Value(const std::string &info, Bool_t silent)
Constructor.
size_t fSize
fSize of the contained object
ROOT::DelFunc_t fDelete
Method cache for containee delete.
ROOT::DesFunc_t fDtor
Method cache for containee destructor.
ROOT::NewFunc_t fCtor
Method cache for containee constructor.
EDataType fKind
kind of ROOT-fundamental type
Bool_t IsValid()
Return true if the Value has been properly initialized.
#define dest(otri, vertexptr)