File indexing completed on 2025-01-18 10:11:34
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TBufferText
0013 #define ROOT_TBufferText
0014
0015 #include "TBufferIO.h"
0016
0017 class TStreamerBase;
0018 class TExMap;
0019
0020 class TBufferText : public TBufferIO {
0021
0022 protected:
0023 TBufferText();
0024 TBufferText(TBuffer::EMode mode, TObject *parent = nullptr);
0025
0026 public:
0027 ~TBufferText() override;
0028
0029
0030
0031 void StreamObject(void *obj, const std::type_info &typeinfo, const TClass *onFileClass = nullptr) override;
0032 void StreamObject(void *obj, const char *className, const TClass *onFileClass = nullptr) override;
0033 void StreamObject(TObject *obj) override;
0034 using TBuffer::StreamObject;
0035
0036 Int_t ApplySequence(const TStreamerInfoActions::TActionSequence &sequence, void *object) final;
0037 Int_t ApplySequenceVecPtr(const TStreamerInfoActions::TActionSequence &sequence, void *start_collection,
0038 void *end_collection) final;
0039 Int_t
0040 ApplySequence(const TStreamerInfoActions::TActionSequence &sequence, void *start_collection, void *end_collection) final;
0041
0042 void ReadFloat16(Float_t *f, TStreamerElement *ele = nullptr) final;
0043 void WriteFloat16(Float_t *f, TStreamerElement *ele = nullptr) final;
0044 void ReadDouble32(Double_t *d, TStreamerElement *ele = nullptr) final;
0045 void WriteDouble32(Double_t *d, TStreamerElement *ele = nullptr) final;
0046 void ReadWithFactor(Float_t *ptr, Double_t factor, Double_t minvalue) final;
0047 void ReadWithNbits(Float_t *ptr, Int_t nbits) final;
0048 void ReadWithFactor(Double_t *ptr, Double_t factor, Double_t minvalue) final;
0049 void ReadWithNbits(Double_t *ptr, Int_t nbits) final;
0050
0051 Int_t ReadArrayFloat16(Float_t *&f, TStreamerElement *ele = nullptr) override;
0052 Int_t ReadArrayDouble32(Double_t *&d, TStreamerElement *ele = nullptr) override;
0053
0054 Int_t ReadStaticArrayFloat16(Float_t *f, TStreamerElement *ele = nullptr) final;
0055 Int_t ReadStaticArrayDouble32(Double_t *d, TStreamerElement *ele = nullptr) final;
0056
0057 void ReadFastArrayFloat16(Float_t *f, Int_t n, TStreamerElement *ele = nullptr) final;
0058 void ReadFastArrayDouble32(Double_t *d, Int_t n, TStreamerElement *ele = nullptr) final;
0059 void ReadFastArrayWithFactor(Float_t *ptr, Int_t n, Double_t factor, Double_t minvalue) final;
0060 void ReadFastArrayWithNbits(Float_t *ptr, Int_t n, Int_t nbits) final;
0061 void ReadFastArrayWithFactor(Double_t *ptr, Int_t n, Double_t factor, Double_t minvalue) final;
0062 void ReadFastArrayWithNbits(Double_t *ptr, Int_t n, Int_t nbits) final;
0063
0064 void WriteArrayFloat16(const Float_t *f, Int_t n, TStreamerElement *ele = nullptr) final;
0065 void WriteArrayDouble32(const Double_t *d, Int_t n, TStreamerElement *ele = nullptr) final;
0066
0067 void WriteFastArrayFloat16(const Float_t *d, Long64_t n, TStreamerElement *ele = nullptr) final;
0068 void WriteFastArrayDouble32(const Double_t *d, Long64_t n, TStreamerElement *ele = nullptr) final;
0069
0070
0071 Int_t ReadClassBuffer(const TClass * , void * , const TClass * = nullptr) override;
0072 Int_t ReadClassBuffer(const TClass * , void * , Int_t , UInt_t ,
0073 UInt_t , const TClass * = nullptr) override;
0074 Int_t WriteClassBuffer(const TClass *cl, void *pointer) override;
0075
0076
0077
0078 Int_t CheckByteCount(UInt_t , UInt_t , const TClass * ) final { return 0; }
0079 Int_t CheckByteCount(UInt_t , UInt_t , const char * ) final { return 0; }
0080 void SetByteCount(UInt_t , Bool_t = kFALSE) final {}
0081 void SkipVersion(const TClass *cl = nullptr) final;
0082 Version_t ReadVersionNoCheckSum(UInt_t *, UInt_t *) final { return 0; }
0083
0084 Int_t ReadBuf(void * , Int_t ) final
0085 {
0086 Error("ReadBuf", "useless in text streamers");
0087 return 0;
0088 }
0089 void WriteBuf(const void * , Int_t ) final { Error("WriteBuf", "useless in text streamers"); }
0090
0091 char *ReadString(char * , Int_t ) final
0092 {
0093 Error("ReadString", "useless");
0094 return nullptr;
0095 }
0096 void WriteString(const char * ) final { Error("WriteString", "useless"); }
0097
0098 Version_t ReadVersionForMemberWise(const TClass * = nullptr) final
0099 {
0100 Error("ReadVersionForMemberWise", "not defined in text-based streamers");
0101 return 0;
0102 }
0103 UInt_t WriteVersionMemberWise(const TClass * , Bool_t = kFALSE) final
0104 {
0105 Error("WriteVersionMemberWise", "not defined in text-based streamers");
0106 return 0;
0107 }
0108
0109 TObject *ReadObject(const TClass * ) final
0110 {
0111 Error("ReadObject", "not yet implemented for text-based streamers");
0112 return nullptr;
0113 }
0114
0115
0116 Int_t ReadClassEmulated(const TClass * , void * , const TClass * = nullptr) final
0117 {
0118 Error("ReadClassEmulated", "not defined in text-based streamers");
0119 return 0;
0120 }
0121
0122 virtual void WriteBaseClass(void *start, TStreamerBase *elem);
0123
0124 virtual void ReadBaseClass(void *start, TStreamerBase *elem);
0125
0126 static void SetFloatFormat(const char *fmt = "%e");
0127 static const char *GetFloatFormat();
0128 static void SetDoubleFormat(const char *fmt = "%.14e");
0129 static const char *GetDoubleFormat();
0130
0131 static void CompactFloatString(char *buf, unsigned len);
0132 static const char *ConvertFloat(Float_t v, char *buf, unsigned len, Bool_t not_optimize = kFALSE);
0133 static const char *ConvertDouble(Double_t v, char *buf, unsigned len, Bool_t not_optimize = kFALSE);
0134
0135 protected:
0136 static const char *fgFloatFmt;
0137 static const char *fgDoubleFmt;
0138
0139 ClassDefOverride(TBufferText, 0);
0140 };
0141
0142 #endif