|
ROOT
Reference Guide |
|
Go to the documentation of this file.
27 #define MESSAGE(which,text)
46 virtual ~TGenVectorProxy()
59 return ((
char*)fEnv->
fStart) + fValDiff*idx;
62 Fatal(
"TGenVectorProxy",
"At> Logic error - no proxy object set.");
71 TPushPop helper(proxy,ptr);
72 proxy->
Clear(
"force");
96 virtual ~TGenVectorBoolProxy()
107 fLastValue = (*vec)[idx];
111 Fatal(
"TGenVectorProxy",
"At> Logic error - no proxy object set.");
118 if ( force && ptr ) {
142 virtual ~TGenBitsetProxy()
163 typedef ROOT::TCollectionProxyInfo::Environ<std::pair<size_t,Bool_t> > EnvType_t;
164 EnvType_t *
e = (EnvType_t*)fEnv;
165 return &(
e->fIterator.second);
167 Fatal(
"TGenVectorProxy",
"At> Logic error - no proxy object set.");
174 if ( force && ptr ) {
190 class TGenListProxy :
public TGenVectorProxy {
197 virtual ~TGenListProxy()
217 Fatal(
"TGenListProxy",
"At> Logic error - no proxy object set.");
232 class TGenSetProxy :
public TGenVectorProxy {
239 virtual ~TGenSetProxy()
247 return (((
char*)
fEnv->
fTemp)+idx*fValDiff);
262 Fatal(
"TGenSetProxy",
"At> Logic error - no proxy object set.");
277 class TGenMapProxy :
public TGenSetProxy {
284 virtual ~TGenMapProxy()
288 virtual void DeleteItem(
Bool_t force,
void* ptr)
const
294 proxy->
Clear(
"force");
300 proxy->
Clear(
"force");
318 std::string inside = (inside_type.find(
"const ")==0) ? inside_type.substr(6) : inside_type;
324 fSize = std::string::npos;
328 bool nameChanged =
false;
331 bool isPointer = nameChanged;
334 if (!nameChanged && intype[intype.length()-1] ==
'*') {
337 if (intype[intype.length()-1] ==
'*') {
340 Warning(
"TGenCollectionProxy::Value::Value",
"I/O not supported for collection of pointer to pointer: %s", inside_type.c_str());
341 fSize =
sizeof(
void*);
347 if ( intype.substr(0,6) ==
"string" || intype.substr(0,11) ==
"std::string" ) {
355 fSize =
sizeof(
void*);
357 fSize =
sizeof(std::string);
372 fSize =
sizeof(
void*);
387 assert(typeTable &&
"The type of the list of type has changed");
389 TDataType *fundType = (
TDataType *)typeTable->THashTable::FindObject( intype.c_str() );
390 if (fundType && fundType->
GetType() < 0x17 && fundType->
GetType() > 0) {
397 fSize =
sizeof(
void*);
408 fSize =
sizeof(
void*);
427 fSize =
sizeof(
void*);
449 fSize =
sizeof(
void*);
458 fSize = std::string::npos;
460 Error(
"TGenCollectionProxy",
"Could not retrieve the TClass for %s", intype.c_str());
468 fundType =
gROOT->GetType( intype.c_str() );
470 if (intype !=
"long double" && !silent) {
471 Error(
"TGenCollectionProxy",
"Unknown fundamental type %s",intype.c_str());
500 if (
fSize == std::string::npos ) {
516 return fSize != std::string::npos;
528 fType->Destructor(ptr);
531 ::operator
delete(ptr);
619 if ( iter_size >
sizeof(
e.fIterator) ) {
620 Fatal(
"TGenCollectionProxy",
621 "%s %s are too large:%ld bytes. Maximum is:%ld bytes",
622 "Iterators for collection",
642 fTypeinfo(info.fInfo), fOnFileClass(0)
671 Fatal(
"TGenCollectionProxy",
672 "%s %s are too large:%ld bytes. Maximum is:%ld bytes",
673 "Iterators for collection",
690 void clearVector(vec&
v)
694 for(
typename vec::iterator i=
v.begin(); i !=
v.end(); ++i) {
695 typename vec::value_type
e = *i;
718 std::map<std::string, TObjArray*>::iterator it;
741 return new TGenBitsetProxy(*
this);
744 if ((*fValue).fKind ==
kBool_t) {
745 return new TGenVectorBoolProxy(*
this);
747 return new TGenVectorProxy(*
this);
752 return new TGenListProxy(*
this);
757 return new TGenMapProxy(*
this);
762 return new TGenSetProxy(*
this);
774 if (
fValue.load() )
return p;
784 Fatal(
"TGenCollectionProxy",
"No 'size' function pointer for class %s present.",
fName.c_str());
787 Fatal(
"TGenCollectionProxy",
"No 'resize' function for class %s present.",
fName.c_str());
790 Fatal(
"TGenCollectionProxy",
"No 'next' function for class %s present.",
fName.c_str());
793 Fatal(
"TGenCollectionProxy",
"No 'begin' function for class %s present.",
fName.c_str());
796 Fatal(
"TGenCollectionProxy",
"No 'clear' function for class %s present.",
fName.c_str());
799 Fatal(
"TGenCollectionProxy",
"No 'block constructor' function for class %s present.",
fName.c_str());
802 Fatal(
"TGenCollectionProxy",
"No 'block destructor' function for class %s present.",
fName.c_str());
805 Fatal(
"TGenCollectionProxy",
"No 'data feed' function for class %s present.",
fName.c_str());
808 Fatal(
"TGenCollectionProxy",
"No 'data collect' function for class %s present.",
fName.c_str());
811 Fatal(
"TGenCollectionProxy",
"No 'environment creation' function for class %s present.",
fName.c_str());
822 Fatal(
"TGenCollectionProxy",
"Could not find %s!",
name.c_str());
833 if (
fValue.load())
return this;
841 std::vector<std::string> inside;
845 Value* newfValue =
nullptr;
846 if ( inside[0].find(
"stdext::hash_") != std::string::npos )
847 inside[0].replace(3,10,
"::");
848 if ( inside[0].find(
"__gnu_cxx::hash_") != std::string::npos )
849 inside[0].replace(0,16,
"std::");
862 if (num > 3 && !inside[3].empty()) {
870 int slong =
sizeof(
void*);
876 nam =
"pair<"+inside[1]+
","+inside[2];
877 nam += (nam[nam.length()-1]==
'>') ?
" >" :
">";
891 Fatal(
"InitializeEx",
892 "The %s for %s reports a class size that is inconsistent with the one registered "
893 "through the CollectionProxy for %s: %d vs %d\n",
894 paircl->
IsLoaded() ?
"dictionary" :
"interpreter information for", nam.c_str(),
897 gROOT->GetListOfClasses()->Remove(paircl);
900 Fatal(
"InitializeEx",
901 "The TClass creation for %s did not get the right size: %d instead of%d\n",
936 if (num > 2 && !inside[2].empty()) {
953 Fatal(
"TGenCollectionProxy",
"Components of %s not analysed!",cl->
GetName());
955 Fatal(
"TGenCollectionProxy",
"Collection class %s not found!",
fTypeinfo.name());
972 if (!
fValue.load(std::memory_order_relaxed)) {
982 if (!
fValue.load(std::memory_order_relaxed)) {
1002 if( !
fValue.load(std::memory_order_relaxed) )
1017 auto value =
fValue.load(std::memory_order_relaxed);
1020 value =
fValue.load(std::memory_order_relaxed);
1022 return value ? (*value).fType.GetClass() : 0;
1030 auto value =
fValue.load(std::memory_order_relaxed);
1033 value =
fValue.load(std::memory_order_relaxed);
1035 return value ? (*value).fKind :
kNoType_t;
1047 if ((*fValue).fKind ==
kBool_t) {
1074 typedef ROOT::TCollectionProxyInfo::Environ <std::pair<size_t, Bool_t>> EnvType_t;
1075 EnvType_t *
e = (EnvType_t *)
fEnv;
1076 return &(
e->fIterator.second);
1105 Fatal(
"TGenCollectionProxy",
"At> Logic error - no proxy object set.");
1138 Fatal(
"TGenCollectionProxy",
"Size> Logic error - no proxy object set.");
1151 for (i=
n; i<nold; ++i)
1160 Fatal(
"TGenCollectionProxy",
"Resize> Logic error - no proxy object set.");
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.");
1430 struct 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;
1725 if (oldClass == 0) {
1731 std::map<std::string, TObjArray*>::iterator it;
1749 if (valueClass == 0) {
1763 (*fConversionReadMemberWise)[oldClass->
GetName()] = arr;
virtual TStreamerInfoActions::TActionSequence * GetWriteMemberWiseActions()
Return the set of action necessary to stream out this collection member-wise.
virtual TVirtualStreamerInfo * GenerateInfoForPair(const std::string &pairclassname, bool silent, size_t hint_pair_offset, size_t hint_pair_size)=0
virtual TVirtualCollectionProxy * Generate() const
Virtual copy constructor.
void MayNotUse(const char *method)
This function can be used in classes that should override a certain function, but in the inherited cl...
virtual void operator()(TBuffer &refBuffer, void *pObject)
TClassStreamer IO overload.
virtual Int_t GetProperties() const
virtual void Clear(const char *opt="")
Clear the emulated collection.
virtual void PushProxy(void *objstart)
Add an object.
void TGenCollectionProxy__SlowDeleteSingleIterators(void *)
Nothing to do.
ROOT::DesFunc_t fDtor
Method cache for containee destructor.
virtual void DeleteItem(Bool_t force, void *ptr) const
Call to delete/destruct individual item.
void *(* fClearFunc)(void *)
void *(* fCopyIterator)(void *dest, const void *source)
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
Small helper to stage the content of an associative container when reading and before inserting it in...
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!
virtual void Clear(const char *opt="")=0
Small helper to save proxy environment in the event of recursive calls.
void Streamer(void *obj, TBuffer &b, const TClass *onfile_class=0) const
std::string GetNameForIO(const std::string &templateInstanceName, TClassEdit::EModType mode=TClassEdit::kNone, bool *hasChanged=nullptr)
void(* fDeleteTwoIterators)(void *begin, void *end)
void * TGenCollectionProxy__VectorCopyIterator(void *dest, const void *source)
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
std::map< std::string, TObjArray * > * fConversionReadMemberWise
Array of bundle of TStreamerInfoActions to stream out (read) derived from another class.
void DeleteItem(void *ptr)
#define dest(otri, vertexptr)
TObjArray * fReadMemberWise
Array of bundle of TStreamerInfoActions to stream out (read)
ROOT::NewFunc_t fCtor
Method cache for containee constructor.
Int_t Size() const
Return size of object of this class.
virtual Long_t TypeInfo_Property(TypeInfo_t *) const
void *(* CopyIterator_t)(void *dest, const void *source)
void(* fDeleteSingleIterator)(void *iter)
UInt_t fProperties
Additional properties of the value type (kNeedDelete)
virtual Int_t GetCollectionType() const
Return the type of collection see TClassEdit::ESTLType.
void(* fDestructFunc)(void *, size_t)
virtual int TypeInfo_Size(TypeInfo_t *) const
Bool_t fPointers
Flag to indicate if containee has pointers (key or value)
virtual EDataType GetType() const
If the content is a simple numerical value, return its type (see TDataType)
void *(* fFirstFunc)(void *)
void *(* fNext)(void *iter, const void *end)
virtual void TypeInfo_Init(TypeInfo_t *, const char *) const
UInt_t fCase
type of data of Value_type
void TGenCollectionProxy__StagingDeleteSingleIterators(void *)
Nothing to do.
int fSTL_type
STL container type.
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...
void TGenCollectionProxy__StagingDeleteTwoIterators(void *, void *)
Nothing to do.
virtual CreateIterators_t GetFunctionCreateIterators(Bool_t read=kTRUE)
See typedef void (*CreateIterators_t)(void *collection, void *&begin_arena, void *&end_arena); begin_...
Bool_t IsLoaded() const
Return true if the shared library of this class is currently in the a process's memory.
static constexpr double s
void *(* fNextFunc)(void *)
void *(* fSizeFunc)(void *)
void * TGenCollectionProxy__StagingNext(void *, const void *)
Should not be used.
void * invoke(void *obj) const
Proxies_t fProxyKept
Optimization: Keep proxies once they were created.
virtual void Resize(UInt_t n, Bool_t force_delete)
Resize the container.
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,...
Buffer base class used for serializing objects.
virtual DeleteIterator_t GetFunctionDeleteIterator(Bool_t read=kTRUE)
See typedef void (*DeleteIterator_t)(void *iter); If the sizeof iterator is greater than fgIteratorAr...
TObject * At(Int_t idx) 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...
void * TGenCollectionProxy__VectorNext(void *, const void *)
Should not be used.
TStreamerInfoActions::TActionSequence * fWriteMemberWise
virtual CopyIterator_t GetFunctionCopyIterator(Bool_t read=kTRUE)
See typedef void (*CopyIterator_t)(void *&dest, const void *source); Copy the iterator source,...
TClass * GetClass() const
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...
size_t fSize
fSize of the contained object
Abstract Interface class describing Streamer information for one class.
Value * fVal
Descriptor of the Value_type.
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 void ReadBuffer(TBuffer &b, void *obj)
virtual ~TGenCollectionProxy()
Standard destructor.
void * TGenCollectionProxy__SlowNext(void *iter, const void *end)
Value * fKey
Descriptor of the key_type.
ROOT::DelFunc_t GetDelete() const
Return the wrapper around delete ThiObject.
void *(* fFeedFunc)(void *, void *, size_t)
virtual TypeInfo_t * TypeInfo_Factory() const
static TActionSequence * CreateWriteMemberWiseActions(TVirtualStreamerInfo *info, TVirtualCollectionProxy &proxy)
Create the bundle of the actions necessary for the streaming memberwise of the content described by '...
void * TGenCollectionProxy__SlowCopyIterator(void *dest, const void *source)
Sizing_t fDestruct
Container accessors: block destruct.
void ReplaceWith(TClass *newcl) const
Small helper to describe the Value_type or the key_type of an STL container.
Method fClear
Method cache for container accessors: clear container.
void(* DeleteIterator_t)(void *iter)
virtual TClass * GetCollectionClass() const
Return a pointer to the TClass representing the container.
void(* fCreateIterators)(void *collection, void **begin_arena, void **end_arena, TVirtualCollectionProxy *proxy)
Staged_t fStaged
Optimization: Keep staged array once they were created.
THashTable implements a hash table to store TObject's.
R__EXTERN TVirtualMutex * gInterpreterMutex
Basic data type descriptor (datatype information is obtained from CINT).
virtual DeleteTwoIterators_t GetFunctionDeleteTwoIterators(Bool_t read=kTRUE)
See typedef void (*DeleteTwoIterators_t)(void *begin, void *end); If the sizeof iterator is greater t...
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
virtual ULong_t GetIncrement() const
Return the offset between two consecutive value_types (memory layout).
EDataType fKind
kind of ROOT-fundamental type
virtual void PopProxy()
Remove the last object.
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...
void TGenCollectionProxy__VectorDeleteSingleIterators(void *)
Nothing to do.
void Fatal(const char *location, const char *msgfmt,...)
Use this function in case of a fatal error. It will abort the program.
void *(* fConstructFunc)(void *, size_t)
std::atomic< Value * > fValue
Descriptor of the container value type.
void TGenCollectionProxy__StagingCreateIterators(void *obj, void **begin_arena, void **end_arena, TVirtualCollectionProxy *)
Int_t GetClassSize() const
virtual void * At(UInt_t idx)
Return the address of the value at index 'idx'.
virtual void AddAtAndExpand(TObject *obj, Int_t idx)
Add object at position idx.
virtual void * Allocate(UInt_t n, Bool_t forceDelete)
Allocate the needed space.
virtual Bool_t TypeInfo_IsValid(TypeInfo_t *) const
#define R__LOCKGUARD(mutex)
static TVirtualStreamerInfo * Factory()
Static function returning a pointer to a new TVirtualStreamerInfo object.
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...
Feedfunc_t fFeed
Container accessors: block feed.
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.
void *(* fCollectFunc)(void *, void *)
CreateIterators_t fFunctionCreateIterators
void TGenCollectionProxy__VectorDeleteTwoIterators(void *, void *)
Nothing to do.
virtual UInt_t Sizeof() const
Return the sizeof the collection object.
static TActionSequence * CreateReadMemberWiseActions(TVirtualStreamerInfo *info, TVirtualCollectionProxy &proxy)
Create the bundle of the actions necessary for the streaming memberwise of the content described by '...
DeleteTwoIterators_t fFunctionDeleteTwoIterators
TGenCollectionProxy * Initialize(Bool_t silent) const
Proxy initializer.
virtual UInt_t Size() const
Return the current size of the container.
virtual TGenCollectionProxy * InitializeEx(Bool_t silent)
Proxy initializer.
ArrIterfunc_t fConstruct
Container accessors: block construct.
void CheckFunctions() const
Check existence of function pointers.
Info_t fTypeinfo
Type information.
#define MESSAGE(which, text)
Sizing_t fResize
Container accessors: resize container.
const std::type_info & Info_t
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.
void TGenCollectionProxy__SlowCreateIterators(void *, void **begin_arena, void **end_arena, TVirtualCollectionProxy *proxy)
void(* CreateIterators_t)(void *collection, void **begin_arena, void **end_arena, TVirtualCollectionProxy *proxy)
std::string fName
Name of the class being proxied.
Collectfunc_t fCollect
Method to collect objects from container.
Value(const std::string &info, Bool_t silent)
Constructor.
Method fSize
Container accessors: size of container.
ROOT::NewFunc_t GetNew() const
Return the wrapper around new ThisClass().
virtual void Commit(void *env)
Commit the change.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
TClass instances represent classes, structs and namespaces in the ROOT type system.
virtual void TypeInfo_Delete(TypeInfo_t *) const
DeleteIterator_t fFunctionDeleteIterator
void(* DeleteTwoIterators_t)(void *begin, void *end)
R__EXTERN TInterpreter * gCling
int fValDiff
Offset between two consecutive value_types (memory layout).
Proxies_t fProxyList
Stack of recursive proxies.
TClassRef fType
TClass reference of Value_type in collection.
void TGenCollectionProxy__SlowDeleteTwoIterators(void *, void *)
Nothing to do.
Proxy around an arbitrary container, which implements basic functionality and iteration.
void *(* Next_t)(void *iter, const void *end)
int fValOffset
Offset from key to value (in maps)
virtual void Streamer(TBuffer &refBuffer)
Streamer Function.
static TEnum * GetEnum(const std::type_info &ti, ESearchAction sa=kALoadAndInterpLookup)
Next_t fFunctionNextIterator
ROOT::ESTLType STLKind(std::string_view type)
Converts STL container name to number.
EnvironBase_t * fEnv
Address of the currently proxied object.
Method0 fCreateEnv
Method to allocate an Environment holder.
virtual Bool_t HasPointers() const
Return true if the content is of type 'pointer to'.
virtual const char * GetName() const
Returns name of object.
virtual TClass * GetValueClass() const
Return a pointer to the TClass representing the content.
ROOT::DesFunc_t GetDestructor() const
Return the wrapper around the destructor.
Method fNext
Container accessors: generic iteration: next.
Method fFirst
Container accessors: generic iteration: first.
Bool_t IsValid()
Return true if the Value has been properly initialized.
virtual UInt_t Size() const =0
TClass * fOnFileClass
On file class.
Int_t Size() const
Get size of basic typedef'ed type.
bool IsDefAlloc(const char *alloc, const char *classname)
return whether or not 'allocname' is the STL default allocator for type 'classname'
ROOT::DelFunc_t fDelete
Method cache for containee delete.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void(* fResizeFunc)(void *, size_t)
void * TGenCollectionProxy__StagingCopyIterator(void *dest, const void *source)
CopyIterator_t fFunctionCopyIterator