146template <
typename From,
typename To>
149 From *
r = getaddress<From>( *read );
150 To *
w = getaddress<To>( *write );
151 for(
int i = 0; i < nElements; ++i) {
157template <
typename From>
162 ConvertArray<From,bool>(read,write,nElements);
165 ConvertArray<From,Char_t>(read,write,nElements);
168 ConvertArray<From,Short_t>(read,write,nElements);
171 ConvertArray<From,Int_t>(read,write,nElements);
174 ConvertArray<From,Long64_t>(read,write,nElements);
177 ConvertArray<From,Long64_t>(read,write,nElements);
180 ConvertArray<From,Float_t>(read,write,nElements);
183 ConvertArray<From,Float16_t>(read,write,nElements);
186 ConvertArray<From,Double_t>(read,write,nElements);
189 ConvertArray<From,UChar_t>(read,write,nElements);
192 ConvertArray<From,UShort_t>(read,write,nElements);
195 ConvertArray<From,UInt_t>(read,write,nElements);
198 ConvertArray<From,ULong_t>(read,write,nElements);
201 ConvertArray<From,ULong64_t>(read,write,nElements);
204 ConvertArray<From,Double32_t>(read,write,nElements);
209 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n", writeType);
238 itmstore = (
StreamHelper*)(
len <
sizeof(buffer) ? buffer : memory =::operator
new(
len));
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);
307 DispatchConvertArray<bool>(
fVal->
fKind, itmread, itmstore, nElements);
310 DispatchConvertArray<Char_t>(
fVal->
fKind, itmread, itmstore, nElements);
313 DispatchConvertArray<Short_t>(
fVal->
fKind, itmread, itmstore, nElements);
316 DispatchConvertArray<Int_t>(
fVal->
fKind, itmread, itmstore, nElements);
319 DispatchConvertArray<Long_t>(
fVal->
fKind, itmread, itmstore, nElements);
322 DispatchConvertArray<Long64_t>(
fVal->
fKind, itmread, itmstore, nElements);
325 DispatchConvertArray<Float_t>(
fVal->
fKind, itmread, itmstore, nElements);
328 DispatchConvertArray<Float16_t>(
fVal->
fKind, itmread, itmstore, nElements);
331 DispatchConvertArray<Double_t>(
fVal->
fKind, itmread, itmstore, nElements);
334 DispatchConvertArray<UChar_t>(
fVal->
fKind, itmread, itmstore, nElements);
337 DispatchConvertArray<UShort_t>(
fVal->
fKind, itmread, itmstore, nElements);
340 DispatchConvertArray<UInt_t>(
fVal->
fKind, itmread, itmstore, nElements);
343 DispatchConvertArray<ULong_t>(
fVal->
fKind, itmread, itmstore, nElements);
346 DispatchConvertArray<ULong64_t>(
fVal->
fKind, itmread, itmstore, nElements);
349 DispatchConvertArray<Double_t>(
fVal->
fKind, itmread, itmstore, nElements);
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;
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));
410#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)TGenCollectionProxy::At(idx); { x ;} ++idx;} break;}
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);
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;
494#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
520#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)TGenCollectionProxy::At(idx); { x ;} ++idx;} break;}
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);
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;
736 fEnv->
fStart = (
len <
sizeof(buffer) ? buffer : memory =::operator
new(
len));
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)) {
759 i->
boolean = readOneValue<bool>(
b,readtype);
762 i->
s_char = readOneValue<Char_t>(
b,readtype);
765 i->
s_short = readOneValue<Short_t>(
b,readtype);
768 i->
s_int = readOneValue<Int_t>(
b,readtype);
771 i->
s_long = readOneValue<Long_t>(
b,readtype);
774 i->
s_longlong = readOneValue<Long64_t>(
b,readtype);
777 i->
flt = readOneValue<Float_t>(
b,readtype);
780 i->
flt = readOneValue<Float16_t>(
b,readtype);
783 i->
dbl = readOneValue<Double_t>(
b,readtype);
786 i->
u_char = readOneValue<UChar_t>(
b,readtype);
789 i->
u_short = readOneValue<UShort_t>(
b,readtype);
792 i->
u_int = readOneValue<UInt_t>(
b,readtype);
795 i->
u_long = readOneValue<ULong_t>(
b,readtype);
798 i->
u_longlong = readOneValue<ULong64_t>(
b,readtype);
801 i->
dbl = readOneValue<Double32_t>(
b,readtype);
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);
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;}
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;}
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>
1179 DispatchConvertBufferVectorPrimitives<basictype>(
b,obj,nElements,onFileClass->
GetCollectionProxy());
1183 b.ReadFastArray((basictype*)iterators.
fBegin, nElements);
1194 DispatchConvertBufferVectorPrimitives<Float16_t>(
b,obj,nElements,onFileClass->
GetCollectionProxy());
1209 DispatchConvertBufferVectorPrimitives<Double32_t>(
b,obj,nElements,onFileClass->
GetCollectionProxy());
1243 Fatal(
"TGenCollectionStreamer::ReadBufferDefault",
"No CreateIterators function for %s",
fName.c_str());
1253 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Char_t>;
1256 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Short_t>;
1259 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Int_t>;
1262 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Long_t>;
1265 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Long64_t>;
1268 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Float_t>;
1274 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Double_t>;
1277 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<UChar_t>;
1280 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<UShort_t>;
1283 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<UInt_t>;
1286 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<ULong_t>;
1289 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<ULong64_t>;
1312 if (nElements == 0) {
1316 }
else if (nElements > 0) {
1383 ReadMap(nElements,
b, onFileClass);
1392 if (
b.IsReading()) {
1398 if (nElements > 0) {
1432 if (nElements > 0) {
1470 if (
b.IsReading()) {
1476 if (nElements > 0) {
unsigned long long ULong64_t
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Fatal(const char *location, const char *msgfmt,...)
Use this function in case of a fatal error. It will abort the program.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
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.
TClass instances represent classes, structs and namespaces in the ROOT type system.
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).
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.
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.
EDataType GetType() const override
If the content is a simple numerical value, return its type (see TDataType)
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)
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)
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)
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
Describes a persistent version of a class.
EReadWrite
Status bits See TVirtualStreamerInfo::EStatusBits for the values.
@ kUChar
Equal to TDataType's kchar.
TStreamerInfoActions::TActionSequence * GetReadObjectWiseActions()
TObjArray * GetElements() const override
virtual void Streamer(TBuffer &)
Stream a string object.
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
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.
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)