144template <
typename From,
typename To>
147 From *
r = getaddress<From>( *read );
148 To *w = getaddress<To>( *write );
149 for(
int i = 0; i < nElements; ++i) {
155template <
typename From>
160 ConvertArray<From,bool>(read,write,nElements);
163 ConvertArray<From,Char_t>(read,write,nElements);
166 ConvertArray<From,Short_t>(read,write,nElements);
169 ConvertArray<From,Int_t>(read,write,nElements);
172 ConvertArray<From,Long64_t>(read,write,nElements);
175 ConvertArray<From,Long64_t>(read,write,nElements);
178 ConvertArray<From,Float_t>(read,write,nElements);
181 ConvertArray<From,Float16_t>(read,write,nElements);
184 ConvertArray<From,Double_t>(read,write,nElements);
187 ConvertArray<From,UChar_t>(read,write,nElements);
190 ConvertArray<From,UShort_t>(read,write,nElements);
193 ConvertArray<From,UInt_t>(read,write,nElements);
196 ConvertArray<From,ULong_t>(read,write,nElements);
199 ConvertArray<From,ULong64_t>(read,write,nElements);
202 ConvertArray<From,Double32_t>(read,write,nElements);
207 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n", writeType);
235 itmstore = (
StreamHelper*)(len <
sizeof(buffer) ? buffer : memory =::operator
new(len));
252 b.ReadFastArray(&itmread->
boolean , nElements);
255 b.ReadFastArray(&itmread->
s_char , nElements);
258 b.ReadFastArray(&itmread->
s_short , nElements);
261 b.ReadFastArray(&itmread->
s_int , nElements);
264 b.ReadFastArray(&itmread->
s_long , nElements);
270 b.ReadFastArray(&itmread->
flt , nElements);
273 b.ReadFastArrayFloat16(&itmread->
flt, nElements);
276 b.ReadFastArray(&itmread->
dbl , nElements);
279 b.ReadFastArray(&itmread->
u_char , nElements);
282 b.ReadFastArray(&itmread->
u_short , nElements);
285 b.ReadFastArray(&itmread->
u_int , nElements);
288 b.ReadFastArray(&itmread->
u_long , nElements);
294 b.ReadFastArrayDouble32(&itmread->
dbl, nElements);
299 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n", readkind);
304 DispatchConvertArray<bool>(
fVal->
fKind, itmread, itmstore, nElements);
307 DispatchConvertArray<Char_t>(
fVal->
fKind, itmread, itmstore, nElements);
310 DispatchConvertArray<Short_t>(
fVal->
fKind, itmread, itmstore, nElements);
313 DispatchConvertArray<Int_t>(
fVal->
fKind, itmread, itmstore, nElements);
316 DispatchConvertArray<Long_t>(
fVal->
fKind, itmread, itmstore, nElements);
319 DispatchConvertArray<Long64_t>(
fVal->
fKind, itmread, itmstore, nElements);
322 DispatchConvertArray<Float_t>(
fVal->
fKind, itmread, itmstore, nElements);
325 DispatchConvertArray<Float16_t>(
fVal->
fKind, itmread, itmstore, nElements);
328 DispatchConvertArray<Double_t>(
fVal->
fKind, itmread, itmstore, nElements);
331 DispatchConvertArray<UChar_t>(
fVal->
fKind, itmread, itmstore, nElements);
334 DispatchConvertArray<UShort_t>(
fVal->
fKind, itmread, itmstore, nElements);
337 DispatchConvertArray<UInt_t>(
fVal->
fKind, itmread, itmstore, nElements);
340 DispatchConvertArray<ULong_t>(
fVal->
fKind, itmread, itmstore, nElements);
343 DispatchConvertArray<ULong64_t>(
fVal->
fKind, itmread, itmstore, nElements);
346 DispatchConvertArray<Double_t>(
fVal->
fKind, itmread, itmstore, nElements);
351 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n", readkind);
353 ::operator
delete((
void*)itmconv);
358 ::operator
delete(memory);
366 Bool_t vsn3 =
b.GetInfo() &&
b.GetInfo()->GetOldVersion() <= 3;
378#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
396 DOLOOP(i->read_std_string_pointer(
b));
398 DOLOOP(i->read_tstring_pointer(vsn3,
b));
408#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)TGenCollectionProxy::At(idx); { x ;} ++idx;} break;}
420 DOLOOP(i->read_std_string_pointer(
b));
422 DOLOOP(i->read_tstring_pointer(vsn3,
b));
433#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;}}
452 DOLOOP(i->read_std_string_pointer(
b))
456 DOLOOP(i->read_tstring_pointer(vsn3,
b));
466 ::operator
delete(memory);
474 Bool_t vsn3 =
b.GetInfo() &&
b.GetInfo()->GetOldVersion() <= 3;
485 std::vector<std::string> inside;
495#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;}}
550 char **where = (
char**)(
void*) & i;
563 ::operator
delete(memory);
577 switch (
int(
v->fKind)) {
628 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n",
v->fKind);
632 b.StreamObject(i,
v->fType);
638 i->
set(
b.ReadObjectAny(
v->fType));
649template <
typename To>
720 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n", readtype);
729 Bool_t vsn3 =
b.GetInfo() &&
b.GetInfo()->GetOldVersion() <= 3;
732 char buffer[8096], *addr, *temp;
737 fEnv->
fStart = (len <
sizeof(buffer) ? buffer : memory =::operator
new(len));
741 int onFileValueKind[2];
748 for (
int loop, idx = 0; idx < nElements; ++idx) {
751 for (loop = 0; loop < 2; loop++) {
757 int readtype = (
int)(onFileValueKind[loop]);
758 switch (
int(
v->fKind)) {
760 i->
boolean = readOneValue<bool>(
b,readtype);
763 i->
s_char = readOneValue<Char_t>(
b,readtype);
766 i->
s_short = readOneValue<Short_t>(
b,readtype);
769 i->
s_int = readOneValue<Int_t>(
b,readtype);
772 i->
s_long = readOneValue<Long_t>(
b,readtype);
775 i->
s_longlong = readOneValue<Long64_t>(
b,readtype);
778 i->
flt = readOneValue<Float_t>(
b,readtype);
781 i->
flt = readOneValue<Float16_t>(
b,readtype);
784 i->
dbl = readOneValue<Double_t>(
b,readtype);
787 i->
u_char = readOneValue<UChar_t>(
b,readtype);
790 i->
u_short = readOneValue<UShort_t>(
b,readtype);
793 i->
u_int = readOneValue<UInt_t>(
b,readtype);
796 i->
u_long = readOneValue<ULong_t>(
b,readtype);
799 i->
u_longlong = readOneValue<ULong64_t>(
b,readtype);
802 i->
dbl = readOneValue<Double32_t>(
b,readtype);
807 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n",
v->fKind);
810 switch (
int(
v->fKind)) {
861 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n",
v->fKind);
866 b.StreamObject(i,
v->fType);
872 i->
set(
b.ReadObjectAny(
v->fType));
888 ::operator
delete(memory);
912 b.WriteFastArray(&itm->
boolean , nElements);
915 b.WriteFastArray(&itm->
s_char , nElements);
918 b.WriteFastArray(&itm->
s_short , nElements);
921 b.WriteFastArray(&itm->
s_int , nElements);
924 b.WriteFastArray(&itm->
s_long , nElements);
930 b.WriteFastArray(&itm->
flt , nElements);
933 b.WriteFastArrayFloat16(&itm->
flt, nElements);
936 b.WriteFastArray(&itm->
dbl , nElements);
939 b.WriteFastArray(&itm->
u_char , nElements);
942 b.WriteFastArray(&itm->
u_short , nElements);
945 b.WriteFastArray(&itm->
u_int , nElements);
948 b.WriteFastArray(&itm->
u_long , nElements);
954 b.WriteFastArrayDouble32(&itm->
dbl, nElements);
959 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n",
fVal->
fKind);
962 ::operator
delete(memory);
973#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + fValDiff*idx); { x ;} ++idx;} break;}
986 DOLOOP(i->write_std_string_pointer(
b));
989 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>;
1311 if (nElements == 0) {
1315 }
else if (nElements > 0) {
1381 ReadMap(nElements,
b, onFileClass);
1390 if (
b.IsReading()) {
1396 if (nElements > 0) {
1429 if (nElements > 0) {
1466 if (
b.IsReading()) {
1472 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.
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.
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
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)