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;
380#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + ElementOffset(idx)); { x ;} ++idx;} break;}
399 DOLOOP(i->read_std_string_pointer(
b));
401 DOLOOP(i->read_tstring_pointer(vsn3,
b));
412#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)TGenCollectionProxy::At(idx); { x ;} ++idx;} break;}
424 DOLOOP(i->read_std_string_pointer(
b));
426 DOLOOP(i->read_tstring_pointer(vsn3,
b));
438#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + ElementOffset(idx)); { x ;} ++idx;}}
440 auto buffer = std::make_unique<char[]>(
len);
459 DOLOOP(i->read_std_string_pointer(
b))
463 DOLOOP(i->read_tstring_pointer(vsn3,
b));
479 Bool_t vsn3 =
b.GetInfo() &&
b.GetInfo()->GetOldVersion() <= 3;
488 std::vector<std::string> inside;
499#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + ElementOffset(idx)); { x ;} ++idx;} break;}
526#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)TGenCollectionProxy::At(idx); { x ;} ++idx;} break;}
537 char **where = (
char**)(
void*) & i;
551#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + ElementOffset(idx)); { x ;} ++idx;}}
553 auto buffer = std::make_unique<char[]>(
len);
559 char **where = (
char**)(
void*) & i;
584 switch (
int(
v->fKind)) {
635 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n",
v->fKind);
639 b.StreamObject(i,
v->fType);
645 i->
set(
b.ReadObjectAny(
v->fType));
656template <
typename To>
727 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n", readtype);
736 Bool_t vsn3 =
b.GetInfo() &&
b.GetInfo()->GetOldVersion() <= 3;
739 char buffer[8096], *addr, *temp;
744 fEnv->
fStart = (
len <
sizeof(buffer) ? buffer : memory =::operator
new(
len));
748 int onFileValueKind[2];
755 for (
int loop, idx = 0; idx < nElements; ++idx) {
758 for (loop = 0; loop < 2; loop++) {
764 int readtype = (
int)(onFileValueKind[loop]);
765 switch (
int(
v->fKind)) {
767 i->
boolean = readOneValue<bool>(
b,readtype);
770 i->
s_char = readOneValue<Char_t>(
b,readtype);
773 i->
s_short = readOneValue<Short_t>(
b,readtype);
776 i->
s_int = readOneValue<Int_t>(
b,readtype);
779 i->
s_long = readOneValue<Long_t>(
b,readtype);
782 i->
s_longlong = readOneValue<Long64_t>(
b,readtype);
785 i->
flt = readOneValue<Float_t>(
b,readtype);
788 i->
flt = readOneValue<Float16_t>(
b,readtype);
791 i->
dbl = readOneValue<Double_t>(
b,readtype);
794 i->
u_char = readOneValue<UChar_t>(
b,readtype);
797 i->
u_short = readOneValue<UShort_t>(
b,readtype);
800 i->
u_int = readOneValue<UInt_t>(
b,readtype);
803 i->
u_long = readOneValue<ULong_t>(
b,readtype);
806 i->
u_longlong = readOneValue<ULong64_t>(
b,readtype);
809 i->
dbl = readOneValue<Double32_t>(
b,readtype);
814 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n",
v->fKind);
817 switch (
int(
v->fKind)) {
868 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n",
v->fKind);
873 b.StreamObject(i,
v->fType);
879 i->
set(
b.ReadObjectAny(
v->fType));
895 ::operator
delete(memory);
919 b.WriteFastArray(&itm->
boolean , nElements);
922 b.WriteFastArray(&itm->
s_char , nElements);
925 b.WriteFastArray(&itm->
s_short , nElements);
928 b.WriteFastArray(&itm->
s_int , nElements);
931 b.WriteFastArray(&itm->
s_long , nElements);
937 b.WriteFastArray(&itm->
flt , nElements);
940 b.WriteFastArrayFloat16(&itm->
flt, nElements);
943 b.WriteFastArray(&itm->
dbl , nElements);
946 b.WriteFastArray(&itm->
u_char , nElements);
949 b.WriteFastArray(&itm->
u_short , nElements);
952 b.WriteFastArray(&itm->
u_int , nElements);
955 b.WriteFastArray(&itm->
u_long , nElements);
961 b.WriteFastArrayDouble32(&itm->
dbl, nElements);
966 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n",
fVal->
fKind);
969 ::operator
delete(memory);
981#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)(((char*)itm) + ElementOffset(idx)); { x ;} ++idx;} break;}
995 DOLOOP(i->write_std_string_pointer(
b));
998 DOLOOP(i->write_tstring_pointer(
b));
1014#define DOLOOP(x) {int idx=0; while(idx<nElements) {StreamHelper* i=(StreamHelper*)TGenCollectionProxy::At(idx); { x ;} ++idx;} break;}
1023 DOLOOP(i->write_std_string_pointer(
b));
1025 DOLOOP(i->write_tstring_pointer(
b));
1040 for (
int loop, idx = 0; idx < nElements; ++idx) {
1043 for (loop = 0; loop < 2; ++loop) {
1048 switch (
int(
v->fKind)) {
1097 Error(
"TGenCollectionStreamer",
"fType %d is not supported yet!\n",
v->fKind);
1101 b.StreamObject(i,
v->fType);
1107 b.WriteObjectAny(i->
ptr(),
v->fType);
1122template <
typename From,
typename To>
1125 From *temp =
new From[nElements];
1126 b.ReadFastArray(temp, nElements);
1127 std::vector<To> *
const vec = (std::vector<To>*)(obj);
1128 for(
Int_t ind = 0; ind < nElements; ++ind) {
1129 (*vec)[ind] = (To)temp[ind];
1134template <
typename To>
1138 b.ReadFastArrayFloat16(temp, nElements);
1139 std::vector<To> *
const vec = (std::vector<To>*)(obj);
1140 for(
Int_t ind = 0; ind < nElements; ++ind) {
1141 (*vec)[ind] = (To)temp[ind];
1146template <
typename To>
1150 b.ReadFastArrayDouble32(temp, nElements);
1151 std::vector<To> *
const vec = (std::vector<To>*)(obj);
1152 for(
Int_t ind = 0; ind < nElements; ++ind) {
1153 (*vec)[ind] = (To)temp[ind];
1158template <
typename To>
1181template <
typename basictype>
1189 DispatchConvertBufferVectorPrimitives<basictype>(
b,obj,nElements,onFileClass->
GetCollectionProxy());
1193 b.ReadFastArray((basictype*)iterators.
fBegin, nElements);
1204 DispatchConvertBufferVectorPrimitives<Float16_t>(
b,obj,nElements,onFileClass->
GetCollectionProxy());
1219 DispatchConvertBufferVectorPrimitives<Double32_t>(
b,obj,nElements,onFileClass->
GetCollectionProxy());
1253 Fatal(
"TGenCollectionStreamer::ReadBufferDefault",
"No CreateIterators function for %s",
fName.c_str());
1263 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Char_t>;
1266 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Short_t>;
1269 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Int_t>;
1272 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Long_t>;
1275 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Long64_t>;
1278 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Float_t>;
1284 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<Double_t>;
1287 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<UChar_t>;
1290 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<UShort_t>;
1293 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<UInt_t>;
1296 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<ULong_t>;
1299 fReadBufferFunc = &TGenCollectionStreamer::ReadBufferVectorPrimitives<ULong64_t>;
1322 if (nElements == 0) {
1326 }
else if (nElements > 0) {
1393 ReadMap(nElements,
b, onFileClass);
1402 if (
b.IsReading()) {
1408 if (nElements > 0) {
1442 if (nElements > 0) {
1480 if (
b.IsReading()) {
1486 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)
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 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.
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
float Float_t
Float 4 bytes (float)
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.
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
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.
std::size_t ElementOffset(std::size_t n) const
Byte offset of the n-th element.
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_...
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++...
Defines a common interface to inspect/change the contents of an object that represents a collection.
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...
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.
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)