146template <
typename From,
typename To>
151 for(
int i = 0; i < nElements; ++i) {
157template <
typename From>
209 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n", writeType);
222 fEnv->fSize = nElements;
233 fEnv->fStart = itmstore;
238 itmstore = (
StreamHelper*)(len <
sizeof(buffer) ? buffer : memory =::operator
new(len));
241 fEnv->fStart = itmstore;
251 readkind =
fVal->fKind;
255 b.ReadFastArray(&itmread->
boolean , nElements);
258 b.ReadFastArray(&itmread->
s_char , nElements);
261 b.ReadFastArray(&itmread->
s_short , nElements);
264 b.ReadFastArray(&itmread->
s_int , nElements);
267 b.ReadFastArray(&itmread->
s_long , nElements);
273 b.ReadFastArray(&itmread->
flt , nElements);
276 b.ReadFastArrayFloat16(&itmread->
flt, nElements);
279 b.ReadFastArray(&itmread->
dbl , nElements);
282 b.ReadFastArray(&itmread->
u_char , nElements);
285 b.ReadFastArray(&itmread->
u_short , nElements);
288 b.ReadFastArray(&itmread->
u_int , nElements);
291 b.ReadFastArray(&itmread->
u_long , nElements);
297 b.ReadFastArrayDouble32(&itmread->
dbl, nElements);
302 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n", readkind);
354 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n", readkind);
356 ::operator
delete((
void*)itmconv);
361 ::operator
delete(memory);
369 Bool_t vsn3 =
b.GetInfo() &&
b.GetInfo()->GetOldVersion() <= 3;
375 fEnv->fSize = nElements;
379#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
389 switch (
fVal->fCase) {
391 DOLOOP(
b.StreamObject(i,
fVal->fType, onFileValClass ));
397 DOLOOP(i->read_std_string_pointer(
b));
399 DOLOOP(i->read_tstring_pointer(vsn3,
b));
410#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)TGenCollectionProxy::At(idx); { x ;} ++idx;} break;}
414 switch (
fVal->fCase) {
416 DOLOOP(
b.StreamObject(i,
fVal->fType, onFileValClass));
422 DOLOOP(i->read_std_string_pointer(
b));
424 DOLOOP(i->read_tstring_pointer(vsn3,
b));
435#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;}}
436 auto buffer = std::make_unique<char[]>(len);
439 switch (
fVal->fCase) {
441 DOLOOP(
b.StreamObject(i,
fVal->fType, onFileValClass));
455 DOLOOP(i->read_std_string_pointer(
b))
459 DOLOOP(i->read_tstring_pointer(vsn3,
b));
475 Bool_t vsn3 =
b.GetInfo() &&
b.GetInfo()->GetOldVersion() <= 3;
484 std::vector<std::string> inside;
490 fEnv->fSize = nElements;
494#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
504 switch (
fVal->fCase) {
520#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)TGenCollectionProxy::At(idx); { x ;} ++idx;} break;}
528 switch (
fVal->fCase) {
531 char **where = (
char**)(
void*) & i;
544#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;}}
545 auto buffer = std::make_unique<char[]>(len);
548 switch (
fVal->fCase) {
551 char **where = (
char**)(
void*) & i;
576 switch (
int(
v->fKind)) {
627 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n",
v->fKind);
631 b.StreamObject(i,
v->fType);
637 i->
set(
b.ReadObjectAny(
v->fType));
648template <
typename To>
719 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n", readtype);
728 Bool_t vsn3 =
b.GetInfo() &&
b.GetInfo()->GetOldVersion() <= 3;
731 char buffer[8096], *addr, *temp;
735 fEnv->fSize = nElements;
736 fEnv->fStart = (len <
sizeof(buffer) ? buffer : memory =::operator
new(len));
737 addr = temp = (
char*)
fEnv->fStart;
740 int onFileValueKind[2];
747 for (
int loop, idx = 0; idx < nElements; ++idx) {
750 for (loop = 0; loop < 2; loop++) {
756 int readtype = (
int)(onFileValueKind[loop]);
757 switch (
int(
v->fKind)) {
806 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n",
v->fKind);
809 switch (
int(
v->fKind)) {
860 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n",
v->fKind);
865 b.StreamObject(i,
v->fType);
871 i->
set(
b.ReadObjectAny(
v->fType));
887 ::operator
delete(memory);
905 fEnv->fStart = itm = (
StreamHelper*)(len <
sizeof(buffer) ? buffer : memory =::operator
new(len));
909 switch (
int(
fVal->fKind)) {
911 b.WriteFastArray(&itm->
boolean , nElements);
914 b.WriteFastArray(&itm->
s_char , nElements);
917 b.WriteFastArray(&itm->
s_short , nElements);
920 b.WriteFastArray(&itm->
s_int , nElements);
923 b.WriteFastArray(&itm->
s_long , nElements);
929 b.WriteFastArray(&itm->
flt , nElements);
932 b.WriteFastArrayFloat16(&itm->
flt, nElements);
935 b.WriteFastArray(&itm->
dbl , nElements);
938 b.WriteFastArray(&itm->
u_char , nElements);
941 b.WriteFastArray(&itm->
u_short , nElements);
944 b.WriteFastArray(&itm->
u_int , nElements);
947 b.WriteFastArray(&itm->
u_long , nElements);
953 b.WriteFastArrayDouble32(&itm->
dbl, nElements);
958 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n",
fVal->fKind);
961 ::operator
delete(memory);
972#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
974 switch (
fVal->fCase) {
985 DOLOOP(i->write_std_string_pointer(
b));
988 DOLOOP(i->write_tstring_pointer(
b));
1004#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)TGenCollectionProxy::At(idx); { x ;} ++idx;} break;}
1005 switch (
fVal->fCase) {
1013 DOLOOP(i->write_std_string_pointer(
b));
1015 DOLOOP(i->write_tstring_pointer(
b));
1030 for (
int loop, idx = 0; idx < nElements; ++idx) {
1033 for (loop = 0; loop < 2; ++loop) {
1038 switch (
int(
v->fKind)) {
1087 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n",
v->fKind);
1091 b.StreamObject(i,
v->fType);
1097 b.WriteObjectAny(i->
ptr(),
v->fType);
1112template <
typename From,
typename To>
1115 From *temp =
new From[nElements];
1116 b.ReadFastArray(temp, nElements);
1117 std::vector<To> *
const vec = (std::vector<To>*)(obj);
1118 for(
Int_t ind = 0; ind < nElements; ++ind) {
1119 (*vec)[ind] = (To)temp[ind];
1124template <
typename To>
1128 b.ReadFastArrayFloat16(temp, nElements);
1129 std::vector<To> *
const vec = (std::vector<To>*)(obj);
1130 for(
Int_t ind = 0; ind < nElements; ++ind) {
1131 (*vec)[ind] = (To)temp[ind];
1136template <
typename To>
1140 b.ReadFastArrayDouble32(temp, nElements);
1141 std::vector<To> *
const vec = (std::vector<To>*)(obj);
1142 for(
Int_t ind = 0; ind < nElements; ++ind) {
1143 (*vec)[ind] = (To)temp[ind];
1148template <
typename To>
1171template <
typename basictype>
1183 b.ReadFastArray((basictype*)iterators.
fBegin, nElements);
1243 Fatal(
"TGenCollectionStreamer::ReadBufferDefault",
"No CreateIterators function for %s",
fName.c_str());
1248 switch (
int(
fVal->fKind)) {
1312 if (nElements == 0) {
1316 }
else if (nElements > 0) {
1337 switch (
fVal->fCase) {
1362 switch (
fVal->fCase) {
1383 ReadMap(nElements,
b, onFileClass);
1392 if (
b.IsReading()) {
1395 if (
fEnv->fObject) {
1398 if (nElements > 0) {
1411 switch (
fVal->fCase) {
1430 int nElements =
fEnv->fObject ? *(
size_t*)
fSize.invoke(
fEnv) : 0;
1432 if (nElements > 0) {
1446 switch (
fVal->fCase) {
1470 if (
b.IsReading()) {
1473 if (
fEnv->fObject) {
1476 if (nElements > 0) {
float Float16_t
Float 4 bytes in memory, written to disk as 3 bytes (24-bits) by default or as a 4 bytes fixed-point-...
unsigned short UShort_t
Unsigned Short integer 2 bytes (unsigned short).
double Double32_t
Double 8 bytes in memory, written to disk as a 4 bytes Float_t (32-bits) by default,...
int Int_t
Signed integer 4 bytes (int).
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char).
char Char_t
Character 1 byte (char).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
bool Bool_t
Boolean (0=false, 1=true) (bool).
short Short_t
Signed Short integer 2 bytes (short).
double Double_t
Double 8 bytes.
long long Long64_t
Portable signed long integer 8 bytes.
unsigned long long ULong64_t
Portable unsigned long integer 8 bytes.
float Float_t
Float 4 bytes (float).
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
void Fatal(const char *location, const char *msgfmt,...)
Use this function in case of a fatal error. It will abort the program.
bool * getaddress< bool >(TGenCollectionProxy::StreamHelper &itm)
void DispatchConvertArray(int writeType, TGenCollectionProxy::StreamHelper *read, TGenCollectionProxy::StreamHelper *write, int nElements)
UChar_t * getaddress< UChar_t >(TGenCollectionProxy::StreamHelper &itm)
Long_t * getaddress< Long_t >(TGenCollectionProxy::StreamHelper &itm)
ULong64_t * getaddress< ULong64_t >(TGenCollectionProxy::StreamHelper &itm)
UInt_t * getaddress< UInt_t >(TGenCollectionProxy::StreamHelper &itm)
Long64_t * getaddress< Long64_t >(TGenCollectionProxy::StreamHelper &itm)
UShort_t * getaddress< UShort_t >(TGenCollectionProxy::StreamHelper &itm)
To readOneValue(TBuffer &b, int readtype)
Float_t * getaddress< Float_t >(TGenCollectionProxy::StreamHelper &itm)
ULong_t * getaddress< ULong_t >(TGenCollectionProxy::StreamHelper &itm)
Char_t * getaddress< Char_t >(TGenCollectionProxy::StreamHelper &itm)
Int_t * getaddress< Int_t >(TGenCollectionProxy::StreamHelper &itm)
Short_t * getaddress< Short_t >(TGenCollectionProxy::StreamHelper &itm)
T * getaddress(TGenCollectionProxy::StreamHelper &itm)
Double_t * getaddress< Double_t >(TGenCollectionProxy::StreamHelper &itm)
void ConvertArray(TGenCollectionProxy::StreamHelper *read, TGenCollectionProxy::StreamHelper *write, int nElements)
Buffer base class used for serializing objects.
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).
Method fFirst
Container accessors: generic iteration: first.
std::atomic< Value * > fValue
Descriptor of the container value type.
int fValOffset
Offset from key to value (in maps).
TClass * GetValueClass() const override
Return a pointer to the TClass representing the content.
EnvironBase_t * fEnv
Address of the currently proxied object.
Collectfunc_t fCollect
Method to collect objects from container.
TGenCollectionProxy * Initialize(Bool_t silent) const
Proxy initializer.
virtual TGenCollectionProxy * InitializeEx(Bool_t silent)
Proxy initializer.
std::string fName
Name of the class being proxied.
int fSTL_type
STL container type.
Value * fKey
Descriptor of the key_type.
void Clear(const char *opt="") override
Clear the emulated collection.
Sizing_t fDestruct
Container accessors: block destruct.
Value * fVal
Descriptor of the Value_type.
TClass * fOnFileClass
On file class.
Sizing_t fResize
Container accessors: resize container.
ArrIterfunc_t fConstruct
Container accessors: block construct.
void * At(UInt_t idx) override
Return the address of the value at index 'idx'.
CreateIterators_t fFunctionCreateIterators
Method fSize
Container accessors: size of container.
Method fClear
Method cache for container accessors: clear container.
Feedfunc_t fFeed
Container accessors: block feed.
CreateIterators_t GetFunctionCreateIterators(Bool_t read=kTRUE) override
See typedef void (*CreateIterators_t)(void *collection, void *&begin_arena, void *&end_arena); begin_...
int fValDiff
Offset between two consecutive value_types (memory layout).
const std::type_info & Info_t
void ReadBufferDefault(TBuffer &b, void *obj, const TClass *onFileClass)
void ReadPrimitives(int nElements, TBuffer &b, const TClass *onfileClass)
void WriteObjects(int nElements, TBuffer &b)
void DispatchConvertBufferVectorPrimitives(TBuffer &b, void *obj, Int_t nElements, const TVirtualCollectionProxy *onfileProxy)
void ReadBufferVectorPrimitivesDouble32(TBuffer &b, void *obj, const TClass *onFileClass)
void WriteMap(int nElements, TBuffer &b)
void ReadMapHelper(StreamHelper *i, Value *v, Bool_t vsn3, TBuffer &b)
~TGenCollectionStreamer() override
void Streamer(TBuffer &refBuffer) override
Streamer Function.
void ReadBuffer(TBuffer &b, void *obj, const TClass *onfileClass) override
void ReadBufferVectorPrimitivesFloat16(TBuffer &b, void *obj, const TClass *onFileClass)
void ReadObjects(int nElements, TBuffer &b, const TClass *onfileClass)
void WritePrimitives(int nElements, TBuffer &b)
void ConvertBufferVectorPrimitivesFloat16(TBuffer &b, void *obj, Int_t nElements)
void ReadPairFromMap(int nElements, TBuffer &b)
TGenCollectionStreamer(const TGenCollectionStreamer ©)
void ReadMap(int nElements, TBuffer &b, const TClass *onfileClass)
void ConvertBufferVectorPrimitivesDouble32(TBuffer &b, void *obj, Int_t nElements)
void ConvertBufferVectorPrimitives(TBuffer &b, void *obj, Int_t nElements)
virtual void StreamerAsMap(TBuffer &refBuffer)
void ReadBufferGeneric(TBuffer &b, void *obj, const TClass *onFileClass)
ReadBuffer_t fReadBufferFunc
void ReadBufferVectorPrimitives(TBuffer &b, void *obj, const TClass *onFileClass)
TVirtualCollectionProxy * Generate() const override
Virtual copy constructor.
const char * GetName() const override
Returns name of object.
TObject * At(Int_t idx) const override
Describe one element (data member) to be Streamed.
Describes a persistent version of a class.
TStreamerInfoActions::TActionSequence * GetReadObjectWiseActions()
TObjArray * GetElements() const override
virtual void Streamer(TBuffer &)
Stream a string object.
RAII helper class that ensures that PushProxy() / PopProxy() are called when entering / leaving a C++...
virtual ULong_t GetIncrement() const =0
Return the offset between two consecutive in-memory values (which depends on the sizeof() and alignme...
virtual EDataType GetType() const =0
If the value type is a fundamental data type, return its type (see enumeration EDataType).
@ kNeedDelete
The collection contains directly or indirectly (via other collection) some pointers that need explici...
virtual TClass * GetValueClass() const =0
If the value type is a user-defined class, return a pointer to the TClass representing the value type...
TVirtualCollectionProxy(const TVirtualCollectionProxy &)=delete
Abstract Interface class describing Streamer information for one class.
EReadWrite
EReadWrite Enumerator.
@ kUChar
Equal to TDataType's kchar.
virtual TObjArray * GetElements() const =0
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.
Small helper to describe the Value_type or the key_type of an STL container.
void CreateIterators(void *collection)
Helper class to facilitate I/O.
void read_tstring_pointer(Bool_t vsn3, TBuffer &b)
void write_std_string_pointer(TBuffer &b)
void write_tstring_pointer(TBuffer &b)
void read_std_string_pointer(TBuffer &b)
void read_std_string(TBuffer &b)