Proxy around an arbitrary container, which implements basic functionality and iteration.
The purpose of this implementation is to shield any generated dictionary implementation from the underlying streamer/proxy implementation and only expose the creation functions.
In particular this is used to implement splitting and abstract element access of any container. Access to compiled code is necessary to implement the abstract iteration sequence and functionality like size(), clear(), resize(). resize() may be a void operation.
Definition at line 29 of file TGenCollectionProxy.h.
Classes | |
class | Method |
Small helper to execute (compiler) generated function for the access to STL or other containers. More... | |
class | Method0 |
class | StreamHelper |
Helper class to facilitate I/O. More... | |
class | TStaging |
Small helper to stage the content of an associative container when reading and before inserting it in the actual collection. More... | |
class | Value |
Small helper to describe the Value_type or the key_type of an STL container. More... | |
Public Types | |
enum | { kBIT_ISSTRING = 0x20000000 , kBIT_ISTSTRING = 0x40000000 } |
typedef const std::type_info & | Info_t |
Public Types inherited from TVirtualCollectionProxy | |
typedef void *(* | CopyIterator_t) (void *dest, const void *source) |
Copy the iterator source into dest . | |
typedef void(* | CreateIterators_t) (void *collection, void **begin_arena, void **end_arena, TVirtualCollectionProxy *proxy) |
*begin_arena and *end_arena should contain the location of a memory arena of size fgIteratorArenaSize . | |
typedef void(* | DeleteIterator_t) (void *iter) |
If the size of the iterator is greater than fgIteratorArenaSize , call delete on the addresses; otherwise, just call the iterator's destructor. | |
typedef void(* | DeleteTwoIterators_t) (void *begin, void *end) |
enum | EProperty { kIsAssociative = (1ULL << ( 2 )) , kIsEmulated = (1ULL << ( 3 )) , kNeedDelete = (1ULL << ( 4 )) , kCustomAlloc = (1ULL << ( 5 )) } |
typedef void *(* | Next_t) (void *iter, const void *end) |
iter and end should be pointers to an iterator to be incremented and an iterator that points to the end of the collection, respectively. | |
Public Member Functions | |
TGenCollectionProxy (const ROOT::Detail::TCollectionProxyInfo &info, TClass *cl) | |
Build a proxy for a collection whose type is described by 'collectionClass'. | |
TGenCollectionProxy (const TGenCollectionProxy ©) | |
Build a proxy for an emulated container. | |
TGenCollectionProxy (Info_t typ, size_t iter_size) | |
Build a proxy for a collection whose type is described by 'collectionClass'. | |
~TGenCollectionProxy () override | |
Standard destructor. | |
void * | Allocate (UInt_t n, Bool_t forceDelete) override |
Allocate the needed space. | |
void * | At (UInt_t idx) override |
Return the address of the value at index 'idx'. | |
void | Clear (const char *opt="") override |
Clear the emulated collection. | |
void | Commit (void *env) override |
Commit the change. | |
TVirtualCollectionProxy * | Generate () const override |
Virtual copy constructor. | |
TClass * | GetCollectionClass () const override |
Return a pointer to the TClass representing the container. | |
Int_t | GetCollectionType () const override |
Return the type of collection see TClassEdit::ESTLType. | |
TStreamerInfoActions::TActionSequence * | GetConversionReadMemberWiseActions (TClass *oldClass, Int_t version) override |
Return the set of action necessary to stream in this collection member-wise coming from the old value class layout refered to by 'version'. | |
CopyIterator_t | GetFunctionCopyIterator (Bool_t read=kTRUE) override |
See typedef void (*CopyIterator_t)(void *&dest, const void *source); Copy the iterator source, into dest. | |
CreateIterators_t | GetFunctionCreateIterators (Bool_t read=kTRUE) override |
See typedef void (*CreateIterators_t)(void *collection, void *&begin_arena, void *&end_arena); begin_arena and end_arena should contain the location of memory arena of size fgIteratorSize. | |
DeleteIterator_t | GetFunctionDeleteIterator (Bool_t read=kTRUE) override |
See typedef void (*DeleteIterator_t)(void *iter); If the sizeof iterator is greater than fgIteratorArenaSize, call delete on the addresses, Otherwise just call the iterator's destructor. | |
DeleteTwoIterators_t | GetFunctionDeleteTwoIterators (Bool_t read=kTRUE) override |
See typedef void (*DeleteTwoIterators_t)(void *begin, void *end); If the sizeof iterator is greater than fgIteratorArenaSize, call delete on the addresses, Otherwise just call the iterator's destructor. | |
Next_t | GetFunctionNext (Bool_t read=kTRUE) override |
See typedef void* (*Next_t)(void *iter, void *end); iter and end should be pointer to respectively an iterator to be incremented and the result of colleciton.end() 'Next' will increment the iterator 'iter' and return 0 if the iterator reached the end. | |
ULong_t | GetIncrement () const override |
Return the offset between two consecutive value_types (memory layout). | |
virtual TClass * | GetOnFileClass () const |
TStreamerInfoActions::TActionSequence * | GetReadMemberWiseActions (Int_t version) override |
Return the set of action necessary to stream in this collection member-wise coming from the old value class layout refered to by 'version'. | |
EDataType | GetType () const override |
If the content is a simple numerical value, return its type (see TDataType) | |
TClass * | GetValueClass () const override |
Return a pointer to the TClass representing the content. | |
TStreamerInfoActions::TActionSequence * | GetWriteMemberWiseActions () override |
Return the set of action necessary to stream out this collection member-wise. | |
Bool_t | HasPointers () const override |
Return true if the content is of type 'pointer to'. | |
void | Insert (const void *data, void *container, size_t size) override |
Insert data into the container where data is a C-style array of the actual type contained in the collection of the given size. | |
virtual void | operator() (TBuffer &refBuffer, void *pObject) |
TClassStreamer IO overload. | |
void | PopProxy () override |
Remove the last object. | |
void | PushProxy (void *objstart) override |
Add an object. | |
virtual void | ReadBuffer (TBuffer &b, void *obj) |
virtual void | ReadBuffer (TBuffer &b, void *obj, const TClass *onfileClass) |
Bool_t | Reset () override |
Reset the info gathered from StreamerInfos and value's TClass. | |
virtual void | Resize (UInt_t n, Bool_t force_delete) |
Resize the container. | |
virtual void | SetOnFileClass (TClass *cl) |
UInt_t | Size () const override |
Return the current size of the container. | |
UInt_t | Sizeof () const override |
Return the sizeof the collection object. | |
virtual void | Streamer (TBuffer &refBuffer) |
Streamer Function. | |
virtual void | Streamer (TBuffer &refBuffer, void *pObject, int siz) |
Streamer I/O overload. | |
Public Member Functions inherited from TVirtualCollectionProxy | |
TVirtualCollectionProxy () | |
TVirtualCollectionProxy (TClass *cl) | |
virtual | ~TVirtualCollectionProxy () |
virtual void | DeleteArray (void *p, Bool_t dtorOnly=kFALSE) const |
Execute the container array destructor. | |
virtual void | Destructor (void *p, Bool_t dtorOnly=kFALSE) const |
Execute the container destructor. | |
virtual Int_t | GetProperties () const |
Return miscallenous properties of the proxy (see TVirtualCollectionProxy::EProperty) | |
virtual void * | New () const |
Construct a new container object and return its address. | |
virtual void * | New (void *arena) const |
Construct a new container object at the address given by arena | |
virtual void * | NewArray (Int_t nElements) const |
Construct an array of nElements container objects and return the base address of the array. | |
virtual void * | NewArray (Int_t nElements, void *arena) const |
Construct an array of nElements container objects at the address given by arena | |
virtual TClass::ObjectPtr | NewObject () const |
Construct a new container object and return its address. | |
virtual TClass::ObjectPtr | NewObject (void *arena) const |
Construct a new container object at the address given by arena | |
virtual TClass::ObjectPtr | NewObjectArray (Int_t nElements) const |
Construct an array of nElements container objects and return the base address of the array. | |
virtual TClass::ObjectPtr | NewObjectArray (Int_t nElements, void *arena) const |
Construct an array of nElements container objects at the address given by arena | |
char * | operator[] (UInt_t idx) const |
Return the address of the value at index idx | |
Protected Types | |
typedef void *(* | ArrIterfunc_t) (void *from, size_t size) |
typedef void *(* | Collectfunc_t) (void *from, void *to) |
typedef ROOT::Detail::TCollectionProxyInfo::Environ< char[64]> | Env_t |
typedef ROOT::Detail::TCollectionProxyInfo::EnvironBase | EnvironBase_t |
typedef void *(* | Feedfunc_t) (void *from, void *to, size_t size) |
typedef std::vector< EnvironBase_t * > | Proxies_t |
typedef void(* | Sizing_t) (void *obj, size_t size) |
typedef std::vector< TStaging * > | Staged_t |
Collection of pre-allocated staged array for associative containers. | |
Protected Member Functions | |
void | CheckFunctions () const |
Check existence of function pointers. | |
virtual void | DeleteItem (Bool_t force, void *ptr) const |
Call to delete/destruct individual item. | |
TGenCollectionProxy * | Initialize (Bool_t silent) const |
Proxy initializer. | |
virtual TGenCollectionProxy * | InitializeEx (Bool_t silent) |
Proxy initializer. | |
Protected Attributes | |
Method | fClear |
Method cache for container accessors: clear container. | |
Collectfunc_t | fCollect |
Method to collect objects from 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. | |
Method0 | fCreateEnv |
Method to allocate an Environment holder. | |
Sizing_t | fDestruct |
Container accessors: block destruct. | |
EnvironBase_t * | fEnv |
Address of the currently proxied object. | |
Feedfunc_t | fFeed |
Container accessors: block feed. | |
Method | fFirst |
Container accessors: generic iteration: first. | |
CopyIterator_t | fFunctionCopyIterator |
CreateIterators_t | fFunctionCreateIterators |
DeleteIterator_t | fFunctionDeleteIterator |
DeleteTwoIterators_t | fFunctionDeleteTwoIterators |
Next_t | fFunctionNextIterator |
Value * | fKey |
Descriptor of the key_type. | |
std::string | fName |
Name of the class being proxied. | |
Method | fNext |
Container accessors: generic iteration: next. | |
TClass * | fOnFileClass |
On file class. | |
Bool_t | fPointers |
Flag to indicate if containee has pointers (key or value) | |
Proxies_t | fProxyKept |
Optimization: Keep proxies once they were created. | |
Proxies_t | fProxyList |
Stack of recursive proxies. | |
TObjArray * | fReadMemberWise |
Array of bundle of TStreamerInfoActions to stream out (read) | |
Sizing_t | fResize |
Container accessors: resize container. | |
Method | fSize |
Container accessors: size of container. | |
Staged_t | fStaged |
Optimization: Keep staged array once they were created. | |
int | fSTL_type |
STL container type. | |
Info_t | fTypeinfo |
Type information. | |
Value * | fVal |
Descriptor of the Value_type. | |
int | fValDiff |
Offset between two consecutive value_types (memory layout). | |
int | fValOffset |
Offset from key to value (in maps) | |
std::atomic< Value * > | fValue |
Descriptor of the container value type. | |
TStreamerInfoActions::TActionSequence * | fWriteMemberWise |
Protected Attributes inherited from TVirtualCollectionProxy | |
TClassRef | fClass |
UInt_t | fProperties |
Private Member Functions | |
TGenCollectionProxy () | |
TGenCollectionProxy & | operator= (const TGenCollectionProxy &) |
Friends | |
class | TCollectionProxyFactory |
Additional Inherited Members | |
Static Public Attributes inherited from TVirtualCollectionProxy | |
static const Int_t | fgIteratorArenaSize = 16 |
The size of a small buffer that can be allocated on the stack to store iterator-specific information. | |
#include <TGenCollectionProxy.h>
|
protected |
Definition at line 297 of file TGenCollectionProxy.h.
|
protected |
Definition at line 296 of file TGenCollectionProxy.h.
|
protected |
Definition at line 287 of file TGenCollectionProxy.h.
|
protected |
Definition at line 288 of file TGenCollectionProxy.h.
|
protected |
Definition at line 295 of file TGenCollectionProxy.h.
typedef const std::type_info& TGenCollectionProxy::Info_t |
Definition at line 41 of file TGenCollectionProxy.h.
|
protected |
Definition at line 290 of file TGenCollectionProxy.h.
|
protected |
Definition at line 294 of file TGenCollectionProxy.h.
|
protected |
Collection of pre-allocated staged array for associative containers.
Definition at line 289 of file TGenCollectionProxy.h.
anonymous enum |
Enumerator | |
---|---|
kBIT_ISSTRING | |
kBIT_ISTSTRING |
Definition at line 44 of file TGenCollectionProxy.h.
|
private |
TGenCollectionProxy::TGenCollectionProxy | ( | const TGenCollectionProxy & | copy | ) |
Build a proxy for an emulated container.
Definition at line 556 of file TGenCollectionProxy.cxx.
TGenCollectionProxy::TGenCollectionProxy | ( | Info_t | typ, |
size_t | iter_size | ||
) |
Build a proxy for a collection whose type is described by 'collectionClass'.
Definition at line 594 of file TGenCollectionProxy.cxx.
TGenCollectionProxy::TGenCollectionProxy | ( | const ROOT::Detail::TCollectionProxyInfo & | info, |
TClass * | cl | ||
) |
Build a proxy for a collection whose type is described by 'collectionClass'.
Definition at line 639 of file TGenCollectionProxy.cxx.
|
override |
Standard destructor.
Definition at line 705 of file TGenCollectionProxy.cxx.
Allocate the needed space.
For associative collection, this returns a TStaging object that need to be deleted manually or returned by calling Commit(TStaging*)
Implements TVirtualCollectionProxy.
Definition at line 1192 of file TGenCollectionProxy.cxx.
|
overridevirtual |
Return the address of the value at index 'idx'.
Implements TVirtualCollectionProxy.
Reimplemented in TGenVectorProxy, TGenVectorBoolProxy, TGenListProxy, and TGenSetProxy.
Definition at line 1064 of file TGenCollectionProxy.cxx.
|
protected |
Check existence of function pointers.
Definition at line 793 of file TGenCollectionProxy.cxx.
|
overridevirtual |
Clear the emulated collection.
Implements TVirtualCollectionProxy.
Definition at line 1136 of file TGenCollectionProxy.cxx.
|
overridevirtual |
Commit the change.
Implements TVirtualCollectionProxy.
Definition at line 1277 of file TGenCollectionProxy.cxx.
|
protectedvirtual |
Call to delete/destruct individual item.
Reimplemented in TGenVectorProxy, TGenVectorBoolProxy, TGenBitsetProxy, and TGenMapProxy.
Definition at line 1350 of file TGenCollectionProxy.cxx.
|
overridevirtual |
Virtual copy constructor.
Implements TVirtualCollectionProxy.
Reimplemented in TGenCollectionStreamer.
Definition at line 731 of file TGenCollectionProxy.cxx.
|
overridevirtual |
Return a pointer to the TClass representing the container.
Reimplemented from TVirtualCollectionProxy.
Definition at line 985 of file TGenCollectionProxy.cxx.
|
overridevirtual |
Return the type of collection see TClassEdit::ESTLType.
Implements TVirtualCollectionProxy.
Definition at line 993 of file TGenCollectionProxy.cxx.
|
overridevirtual |
Return the set of action necessary to stream in this collection member-wise coming from the old value class layout refered to by 'version'.
Implements TVirtualCollectionProxy.
Definition at line 1747 of file TGenCollectionProxy.cxx.
|
overridevirtual |
See typedef void (*CopyIterator_t)(void *&dest, const void *source); Copy the iterator source, into dest.
dest should contain should contain the location of memory arena of size fgIteratorSize. If the collection iterator are of that size or less, the iterator will be constructed in place in this location (new with placement) Otherwise the iterator will be allocated via a regular new and its address returned by modifying the value of dest.
Implements TVirtualCollectionProxy.
Definition at line 1642 of file TGenCollectionProxy.cxx.
|
overridevirtual |
See typedef void (*CreateIterators_t)(void *collection, void *&begin_arena, void *&end_arena); begin_arena and end_arena should contain the location of memory arena of size fgIteratorSize.
If the collection iterator are of that size or less, the iterators will be constructed in place in those location (new with placement) Otherwise the iterators will be allocated via a regular new and their address returned by modifying the value of begin_arena and end_arena.
Implements TVirtualCollectionProxy.
Definition at line 1607 of file TGenCollectionProxy.cxx.
|
overridevirtual |
See typedef void (*DeleteIterator_t)(void *iter); If the sizeof iterator is greater than fgIteratorArenaSize, call delete on the addresses, Otherwise just call the iterator's destructor.
Implements TVirtualCollectionProxy.
Definition at line 1696 of file TGenCollectionProxy.cxx.
|
overridevirtual |
See typedef void (*DeleteTwoIterators_t)(void *begin, void *end); If the sizeof iterator is greater than fgIteratorArenaSize, call delete on the addresses, Otherwise just call the iterator's destructor.
Implements TVirtualCollectionProxy.
Definition at line 1722 of file TGenCollectionProxy.cxx.
|
overridevirtual |
See typedef void* (*Next_t)(void *iter, void *end); iter and end should be pointer to respectively an iterator to be incremented and the result of colleciton.end() 'Next' will increment the iterator 'iter' and return 0 if the iterator reached the end.
If the end is not reached, 'Next' will return the address of the content unless the collection contains pointers in which case 'Next' will return the value of the pointer.
Implements TVirtualCollectionProxy.
Definition at line 1670 of file TGenCollectionProxy.cxx.
|
overridevirtual |
Return the offset between two consecutive value_types (memory layout).
Implements TVirtualCollectionProxy.
Definition at line 1004 of file TGenCollectionProxy.cxx.
|
inlinevirtual |
Definition at line 428 of file TGenCollectionProxy.h.
|
overridevirtual |
Return the set of action necessary to stream in this collection member-wise coming from the old value class layout refered to by 'version'.
Implements TVirtualCollectionProxy.
Definition at line 1798 of file TGenCollectionProxy.cxx.
|
overridevirtual |
If the content is a simple numerical value, return its type (see TDataType)
Implements TVirtualCollectionProxy.
Definition at line 1051 of file TGenCollectionProxy.cxx.
|
overridevirtual |
Return a pointer to the TClass representing the content.
Implements TVirtualCollectionProxy.
Definition at line 1038 of file TGenCollectionProxy.cxx.
|
overridevirtual |
Return the set of action necessary to stream out this collection member-wise.
Implements TVirtualCollectionProxy.
Definition at line 1820 of file TGenCollectionProxy.cxx.
|
overridevirtual |
Return true if the content is of type 'pointer to'.
Implements TVirtualCollectionProxy.
Definition at line 1022 of file TGenCollectionProxy.cxx.
|
protected |
Proxy initializer.
Definition at line 770 of file TGenCollectionProxy.cxx.
|
protectedvirtual |
Proxy initializer.
Reimplemented in TEmulatedCollectionProxy.
Definition at line 843 of file TGenCollectionProxy.cxx.
|
overridevirtual |
Insert data into the container where data is a C-style array of the actual type contained in the collection of the given size.
For associative container (map, etc.), the data type is the pair<key,value>.
Implements TVirtualCollectionProxy.
Definition at line 1269 of file TGenCollectionProxy.cxx.
|
virtual |
TClassStreamer IO overload.
Definition at line 1448 of file TGenCollectionProxy.cxx.
|
private |
|
overridevirtual |
Remove the last object.
Implements TVirtualCollectionProxy.
Definition at line 1334 of file TGenCollectionProxy.cxx.
|
overridevirtual |
Add an object.
Implements TVirtualCollectionProxy.
Definition at line 1299 of file TGenCollectionProxy.cxx.
|
virtual |
Reimplemented in TGenCollectionStreamer, TEmulatedCollectionProxy, and TEmulatedMapProxy.
Definition at line 1419 of file TGenCollectionProxy.cxx.
|
virtual |
Reimplemented in TGenCollectionStreamer, TEmulatedCollectionProxy, and TEmulatedMapProxy.
Definition at line 1412 of file TGenCollectionProxy.cxx.
|
overridevirtual |
Reset the info gathered from StreamerInfos and value's TClass.
Reimplemented from TVirtualCollectionProxy.
Definition at line 779 of file TGenCollectionProxy.cxx.
Resize the container.
Reimplemented in TEmulatedCollectionProxy.
Definition at line 1169 of file TGenCollectionProxy.cxx.
|
inlinevirtual |
Definition at line 427 of file TGenCollectionProxy.h.
|
overridevirtual |
Return the current size of the container.
Implements TVirtualCollectionProxy.
Definition at line 1153 of file TGenCollectionProxy.cxx.
|
overridevirtual |
Return the sizeof the collection object.
Implements TVirtualCollectionProxy.
Definition at line 1014 of file TGenCollectionProxy.cxx.
|
virtual |
Streamer Function.
Reimplemented in TEmulatedCollectionProxy, TEmulatedMapProxy, and TGenCollectionStreamer.
Definition at line 1427 of file TGenCollectionProxy.cxx.
Streamer I/O overload.
Reimplemented in TEmulatedCollectionProxy, TEmulatedMapProxy, and TGenCollectionStreamer.
Definition at line 1439 of file TGenCollectionProxy.cxx.
|
friend |
Definition at line 34 of file TGenCollectionProxy.h.
|
protected |
Method cache for container accessors: clear container.
Definition at line 301 of file TGenCollectionProxy.h.
|
protected |
Method to collect objects from container.
Definition at line 309 of file TGenCollectionProxy.h.
|
protected |
Container accessors: block construct.
Definition at line 306 of file TGenCollectionProxy.h.
|
mutableprotected |
Array of bundle of TStreamerInfoActions to stream out (read) derived from another class.
Definition at line 292 of file TGenCollectionProxy.h.
|
protected |
Method to allocate an Environment holder.
Definition at line 310 of file TGenCollectionProxy.h.
|
protected |
Container accessors: block destruct.
Definition at line 307 of file TGenCollectionProxy.h.
|
protected |
Address of the currently proxied object.
Definition at line 314 of file TGenCollectionProxy.h.
|
protected |
Container accessors: block feed.
Definition at line 308 of file TGenCollectionProxy.h.
|
protected |
Container accessors: generic iteration: first.
Definition at line 304 of file TGenCollectionProxy.h.
|
protected |
Definition at line 325 of file TGenCollectionProxy.h.
|
protected |
Definition at line 324 of file TGenCollectionProxy.h.
|
protected |
Definition at line 327 of file TGenCollectionProxy.h.
|
protected |
Definition at line 328 of file TGenCollectionProxy.h.
|
protected |
Definition at line 326 of file TGenCollectionProxy.h.
|
protected |
Descriptor of the key_type.
Definition at line 313 of file TGenCollectionProxy.h.
|
protected |
Name of the class being proxied.
Definition at line 299 of file TGenCollectionProxy.h.
|
protected |
Container accessors: generic iteration: next.
Definition at line 305 of file TGenCollectionProxy.h.
|
protected |
On file class.
Definition at line 322 of file TGenCollectionProxy.h.
|
protected |
Flag to indicate if containee has pointers (key or value)
Definition at line 300 of file TGenCollectionProxy.h.
|
protected |
Optimization: Keep proxies once they were created.
Definition at line 318 of file TGenCollectionProxy.h.
|
protected |
Stack of recursive proxies.
Definition at line 317 of file TGenCollectionProxy.h.
|
mutableprotected |
Array of bundle of TStreamerInfoActions to stream out (read)
Definition at line 291 of file TGenCollectionProxy.h.
|
protected |
Container accessors: resize container.
Definition at line 303 of file TGenCollectionProxy.h.
|
protected |
Container accessors: size of container.
Definition at line 302 of file TGenCollectionProxy.h.
|
protected |
Optimization: Keep staged array once they were created.
Definition at line 319 of file TGenCollectionProxy.h.
|
protected |
STL container type.
Definition at line 320 of file TGenCollectionProxy.h.
|
protected |
Type information.
Definition at line 321 of file TGenCollectionProxy.h.
|
protected |
Descriptor of the Value_type.
Definition at line 312 of file TGenCollectionProxy.h.
|
protected |
Offset between two consecutive value_types (memory layout).
Definition at line 316 of file TGenCollectionProxy.h.
|
protected |
Offset from key to value (in maps)
Definition at line 315 of file TGenCollectionProxy.h.
|
protected |
Descriptor of the container value type.
Definition at line 311 of file TGenCollectionProxy.h.
|
mutableprotected |
Definition at line 293 of file TGenCollectionProxy.h.