145template <
typename From,
typename To>
148 From *
r = getaddress<From>( *read );
149 To *w = getaddress<To>( *write );
150 for(
int i = 0; i < nElements; ++i) {
156template <
typename From>
161 ConvertArray<From,bool>(read,write,nElements);
164 ConvertArray<From,Char_t>(read,write,nElements);
167 ConvertArray<From,Short_t>(read,write,nElements);
170 ConvertArray<From,Int_t>(read,write,nElements);
173 ConvertArray<From,Long64_t>(read,write,nElements);
176 ConvertArray<From,Long64_t>(read,write,nElements);
179 ConvertArray<From,Float_t>(read,write,nElements);
182 ConvertArray<From,Float16_t>(read,write,nElements);
185 ConvertArray<From,Double_t>(read,write,nElements);
188 ConvertArray<From,UChar_t>(read,write,nElements);
191 ConvertArray<From,UShort_t>(read,write,nElements);
194 ConvertArray<From,UInt_t>(read,write,nElements);
197 ConvertArray<From,ULong_t>(read,write,nElements);
200 ConvertArray<From,ULong64_t>(read,write,nElements);
203 ConvertArray<From,Double32_t>(read,write,nElements);
208 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n", writeType);
236 itmstore = (
StreamHelper*)(len <
sizeof(buffer) ? buffer : memory =::operator
new(len));
253 b.ReadFastArray(&itmread->
boolean , nElements);
256 b.ReadFastArray(&itmread->
s_char , nElements);
259 b.ReadFastArray(&itmread->
s_short , nElements);
262 b.ReadFastArray(&itmread->
s_int , nElements);
265 b.ReadFastArray(&itmread->
s_long , nElements);
271 b.ReadFastArray(&itmread->
flt , nElements);
274 b.ReadFastArrayFloat16(&itmread->
flt, nElements);
277 b.ReadFastArray(&itmread->
dbl , nElements);
280 b.ReadFastArray(&itmread->
u_char , nElements);
283 b.ReadFastArray(&itmread->
u_short , nElements);
286 b.ReadFastArray(&itmread->
u_int , nElements);
289 b.ReadFastArray(&itmread->
u_long , nElements);
295 b.ReadFastArrayDouble32(&itmread->
dbl, nElements);
300 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n", readkind);
305 DispatchConvertArray<bool>(
fVal->
fKind, itmread, itmstore, nElements);
308 DispatchConvertArray<Char_t>(
fVal->
fKind, itmread, itmstore, nElements);
311 DispatchConvertArray<Short_t>(
fVal->
fKind, itmread, itmstore, nElements);
314 DispatchConvertArray<Int_t>(
fVal->
fKind, itmread, itmstore, nElements);
317 DispatchConvertArray<Long_t>(
fVal->
fKind, itmread, itmstore, nElements);
320 DispatchConvertArray<Long64_t>(
fVal->
fKind, itmread, itmstore, nElements);
323 DispatchConvertArray<Float_t>(
fVal->
fKind, itmread, itmstore, nElements);
326 DispatchConvertArray<Float16_t>(
fVal->
fKind, itmread, itmstore, nElements);
329 DispatchConvertArray<Double_t>(
fVal->
fKind, itmread, itmstore, nElements);
332 DispatchConvertArray<UChar_t>(
fVal->
fKind, itmread, itmstore, nElements);
335 DispatchConvertArray<UShort_t>(
fVal->
fKind, itmread, itmstore, nElements);
338 DispatchConvertArray<UInt_t>(
fVal->
fKind, itmread, itmstore, nElements);
341 DispatchConvertArray<ULong_t>(
fVal->
fKind, itmread, itmstore, nElements);
344 DispatchConvertArray<ULong64_t>(
fVal->
fKind, itmread, itmstore, nElements);
347 DispatchConvertArray<Double_t>(
fVal->
fKind, itmread, itmstore, nElements);
352 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n", readkind);
354 ::operator
delete((
void*)itmconv);
359 ::operator
delete(memory);
367 Bool_t vsn3 =
b.GetInfo() &&
b.GetInfo()->GetOldVersion() <= 3;
379#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
397 DOLOOP(i->read_std_string_pointer(
b));
399 DOLOOP(i->read_tstring_pointer(vsn3,
b));
409#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)TGenCollectionProxy::At(idx); { x ;} ++idx;} break;}
421 DOLOOP(i->read_std_string_pointer(
b));
423 DOLOOP(i->read_tstring_pointer(vsn3,
b));
434#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;}}
453 DOLOOP(i->read_std_string_pointer(
b))
457 DOLOOP(i->read_tstring_pointer(vsn3,
b));
467 ::operator
delete(memory);
475 Bool_t vsn3 =
b.GetInfo() &&
b.GetInfo()->GetOldVersion() <= 3;
486 std::vector<std::string> inside;
496#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
521#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)TGenCollectionProxy::At(idx); { x ;} ++idx;} break;}
532 char **where = (
char**)(
void*) & i;
545#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;}}
551 char **where = (
char**)(
void*) & i;
564 ::operator
delete(memory);
578 switch (
int(
v->fKind)) {
629 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n",
v->fKind);
633 b.StreamObject(i,
v->fType);
639 i->
set(
b.ReadObjectAny(
v->fType));
650template <
typename To>
721 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n", readtype);
730 Bool_t vsn3 =
b.GetInfo() &&
b.GetInfo()->GetOldVersion() <= 3;
733 char buffer[8096], *addr, *temp;
738 fEnv->
fStart = (len <
sizeof(buffer) ? buffer : memory =::
operator new(len));
742 int onFileValueKind[2];
749 for (
int loop, idx = 0; idx < nElements; ++idx) {
752 for (loop = 0; loop < 2; loop++) {
758 int readtype = (int)(onFileValueKind[loop]);
759 switch (
int(
v->fKind)) {
761 i->
boolean = readOneValue<bool>(
b,readtype);
764 i->
s_char = readOneValue<Char_t>(
b,readtype);
767 i->
s_short = readOneValue<Short_t>(
b,readtype);
770 i->
s_int = readOneValue<Int_t>(
b,readtype);
773 i->
s_long = readOneValue<Long_t>(
b,readtype);
776 i->
s_longlong = readOneValue<Long64_t>(
b,readtype);
779 i->
flt = readOneValue<Float_t>(
b,readtype);
782 i->
flt = readOneValue<Float16_t>(
b,readtype);
785 i->
dbl = readOneValue<Double_t>(
b,readtype);
788 i->
u_char = readOneValue<UChar_t>(
b,readtype);
791 i->
u_short = readOneValue<UShort_t>(
b,readtype);
794 i->
u_int = readOneValue<UInt_t>(
b,readtype);
797 i->
u_long = readOneValue<ULong_t>(
b,readtype);
800 i->
u_longlong = readOneValue<ULong64_t>(
b,readtype);
803 i->
dbl = readOneValue<Double32_t>(
b,readtype);
808 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n",
v->fKind);
811 switch (
int(
v->fKind)) {
862 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n",
v->fKind);
867 b.StreamObject(i,
v->fType);
873 i->
set(
b.ReadObjectAny(
v->fType));
889 ::operator
delete(memory);
913 b.WriteFastArray(&itm->
boolean , nElements);
916 b.WriteFastArray(&itm->
s_char , nElements);
919 b.WriteFastArray(&itm->
s_short , nElements);
922 b.WriteFastArray(&itm->
s_int , nElements);
925 b.WriteFastArray(&itm->
s_long , nElements);
931 b.WriteFastArray(&itm->
flt , nElements);
934 b.WriteFastArrayFloat16(&itm->
flt, nElements);
937 b.WriteFastArray(&itm->
dbl , nElements);
940 b.WriteFastArray(&itm->
u_char , nElements);
943 b.WriteFastArray(&itm->
u_short , nElements);
946 b.WriteFastArray(&itm->
u_int , nElements);
949 b.WriteFastArray(&itm->
u_long , nElements);
955 b.WriteFastArrayDouble32(&itm->
dbl, nElements);
960 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n",
fVal->
fKind);
963 ::operator
delete(memory);
974#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
987 DOLOOP(i->write_std_string_pointer(
b));
990 DOLOOP(i->write_tstring_pointer(
b));
1005#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)TGenCollectionProxy::At(idx); { x ;} ++idx;} break;}
1014 DOLOOP(i->write_std_string_pointer(
b));
1016 DOLOOP(i->write_tstring_pointer(
b));
1031 for (
int loop, idx = 0; idx < nElements; ++idx) {
1034 for (loop = 0; loop < 2; ++loop) {
1039 switch (
int(
v->fKind)) {
1088 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n",
v->fKind);
1092 b.StreamObject(i,
v->fType);
1098 b.WriteObjectAny(i->
ptr(),
v->fType);
1113template <
typename From,
typename To>
1116 From *temp =
new From[nElements];
1117 b.ReadFastArray(temp, nElements);
1118 std::vector<To> *
const vec = (std::vector<To>*)(obj);
1119 for(
Int_t ind = 0; ind < nElements; ++ind) {
1120 (*vec)[ind] = (To)temp[ind];
1125template <
typename To>
1129 b.ReadFastArrayFloat16(temp, nElements);
1130 std::vector<To> *
const vec = (std::vector<To>*)(obj);
1131 for(
Int_t ind = 0; ind < nElements; ++ind) {
1132 (*vec)[ind] = (To)temp[ind];
1137template <
typename To>
1141 b.ReadFastArrayDouble32(temp, nElements);
1142 std::vector<To> *
const vec = (std::vector<To>*)(obj);
1143 for(
Int_t ind = 0; ind < nElements; ++ind) {
1144 (*vec)[ind] = (To)temp[ind];
1149template <
typename To>
1172template <
typename basictype>
1180 DispatchConvertBufferVectorPrimitives<basictype>(
b,obj,nElements,onFileClass->
GetCollectionProxy());
1184 b.ReadFastArray((basictype*)iterators.
fBegin, nElements);
1195 DispatchConvertBufferVectorPrimitives<Float16_t>(
b,obj,nElements,onFileClass->
GetCollectionProxy());
1210 DispatchConvertBufferVectorPrimitives<Double32_t>(
b,obj,nElements,onFileClass->
GetCollectionProxy());
1244 Fatal(
"TGenCollectionStreamer::ReadBufferDefault",
"No CreateIterators function for %s",
fName.c_str());
1254 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Char_t>;
1257 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Short_t>;
1260 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Int_t>;
1263 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Long_t>;
1266 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Long64_t>;
1269 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Float_t>;
1275 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Double_t>;
1278 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<UChar_t>;
1281 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<UShort_t>;
1284 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<UInt_t>;
1287 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<ULong_t>;
1290 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<ULong64_t>;
1312 if (nElements == 0) {
1316 }
else if (nElements > 0) {
1382 ReadMap(nElements,
b, onFileClass);
1391 if (
b.IsReading()) {
1397 if (nElements > 0) {
1430 if (nElements > 0) {
1467 if (
b.IsReading()) {
1473 if (nElements > 0) {
unsigned long long ULong64_t
void Error(const char *location, const char *msgfmt,...)
void Fatal(const char *location, const char *msgfmt,...)
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)
static T * getaddress(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)
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.
The ROOT global object gROOT contains a list of all defined classes.
TVirtualStreamerInfo * GetStreamerInfo(Int_t version=0) 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).
void * invoke(void *obj) const
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.
virtual EDataType GetType() const
If the content is a simple numerical value, return its type (see TDataType)
int fValOffset
Offset from key to value (in maps)
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.
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.
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.
Method fSize
Container accessors: size of container.
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).
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)
virtual TVirtualCollectionProxy * Generate() const
Virtual copy constructor.
void ReadBufferVectorPrimitivesDouble32(TBuffer &b, void *obj, const TClass *onFileClass)
virtual void Streamer(TBuffer &refBuffer)
Streamer Function.
void WriteMap(int nElements, TBuffer &b)
void ReadMapHelper(StreamHelper *i, Value *v, Bool_t vsn3, TBuffer &b)
void ReadBufferVectorPrimitivesFloat16(TBuffer &b, void *obj, const TClass *onFileClass)
virtual ~TGenCollectionStreamer()
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)
virtual void ReadBuffer(TBuffer &b, void *obj, const TClass *onfileClass)
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)
virtual const char * GetName() const
Returns name of object.
TObject * At(Int_t idx) const
Describe Streamer information for one class version.
TObjArray * GetElements() const
EReadWrite
Status bits See TVirtualStreamerInfo::EStatusBits for the values.
@ kUChar
Equal to TDataType's kchar.
TStreamerInfoActions::TActionSequence * GetReadObjectWiseActions()
virtual ULong_t GetIncrement() const =0
virtual EDataType GetType() const =0
virtual TClass * GetValueClass() const =0
Abstract Interface class describing Streamer information for one class.
virtual TObjArray * GetElements() const =0
V GetOffset(E val1, E val2, V iso)
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.
static constexpr double second
Small helper to describe the Value_type or the key_type of an STL container.
UInt_t fCase
type of data of Value_type
TClassRef fType
TClass reference of Value_type in collection.
EDataType fKind
kind of ROOT-fundamental type
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)