Warning, file /include/root/TStreamerInfo.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TStreamerInfo
0013 #define ROOT_TStreamerInfo
0014
0015 #include <atomic>
0016 #include <vector>
0017
0018 #include "TVirtualStreamerInfo.h"
0019
0020 #include "TVirtualCollectionProxy.h"
0021
0022 #include "TObjArray.h"
0023
0024
0025 class TFile;
0026 class TClass;
0027 class TClonesArray;
0028 class TDataMember;
0029 class TMemberStreamer;
0030 class TStreamerElement;
0031 class TStreamerBasicType;
0032 class TClassStreamer;
0033 class TVirtualArray;
0034 namespace ROOT { namespace Detail { class TCollectionProxyInfo; } }
0035 namespace ROOT { class TSchemaRule; }
0036
0037 namespace TStreamerInfoActions { class TActionSequence; }
0038
0039 class TStreamerInfo : public TVirtualStreamerInfo {
0040
0041 class TCompInfo {
0042
0043 private:
0044
0045
0046 public:
0047 Int_t fType;
0048 Int_t fNewType;
0049 Int_t fOffset;
0050 Int_t fLength;
0051 TStreamerElement *fElem;
0052 ULongptr_t fMethod;
0053 TClass *fClass;
0054 TClass *fNewClass;
0055 TString fClassName;
0056 TMemberStreamer *fStreamer;
0057 TCompInfo() : fType(-1), fNewType(0), fOffset(0), fLength(0), fElem(nullptr), fMethod(0),
0058 fClass(nullptr), fNewClass(nullptr), fClassName(), fStreamer(nullptr) {}
0059 ~TCompInfo() {}
0060 void Update(const TClass *oldcl, TClass *newcl);
0061 };
0062 friend class TStreamerInfoActions::TActionSequence;
0063
0064 public:
0065
0066 typedef TCompInfo TCompInfo_t;
0067
0068 protected:
0069
0070
0071
0072 class TPointerCollectionAdapter
0073 {
0074 public:
0075 TPointerCollectionAdapter( TVirtualCollectionProxy *proxy ):
0076 fProxy( proxy ) {}
0077
0078 char* operator[]( UInt_t idx ) const
0079 {
0080 char **el = (char**)fProxy->At(idx);
0081 return *el;
0082 }
0083 private:
0084 TVirtualCollectionProxy *fProxy;
0085 };
0086
0087 private:
0088 UInt_t fCheckSum;
0089 Int_t fClassVersion;
0090 Int_t fOnFileClassVersion;
0091 Int_t fNumber;
0092 Int_t fSize;
0093 Int_t fNdata;
0094 Int_t fNfulldata;
0095 Int_t fNslots;
0096 TCompInfo *fComp;
0097 TCompInfo **fCompOpt;
0098 TCompInfo **fCompFull;
0099 TClass *fClass;
0100 TObjArray *fElements;
0101 Version_t fOldVersion;
0102 Int_t fNVirtualInfoLoc;
0103 ULong_t *fVirtualInfoLoc;
0104 TStreamerInfoActions::TActionSequence *fReadObjectWise;
0105 TStreamerInfoActions::TActionSequence *fReadMemberWise;
0106 TStreamerInfoActions::TActionSequence *fReadMemberWiseVecPtr;
0107 TStreamerInfoActions::TActionSequence *fReadText;
0108 TStreamerInfoActions::TActionSequence *fWriteObjectWise;
0109 TStreamerInfoActions::TActionSequence *fWriteMemberWise;
0110 TStreamerInfoActions::TActionSequence *fWriteMemberWiseVecPtr;
0111 TStreamerInfoActions::TActionSequence *fWriteText;
0112
0113 static std::atomic<Int_t> fgCount;
0114
0115 template <typename T> static T GetTypedValueAux(Int_t type, void *ladd, int k, Int_t len);
0116 static void PrintValueAux(char *ladd, Int_t atype, TStreamerElement * aElement, Int_t aleng, Int_t *count);
0117
0118 UInt_t GenerateIncludes(FILE *fp, char *inclist, const TList *extrainfos);
0119 void GenerateDeclaration(FILE *fp, FILE *sfp, const TList *subClasses, Bool_t top = kTRUE);
0120 void InsertArtificialElements(std::vector<const ROOT::TSchemaRule*> &rules);
0121 void DestructorImpl(void* p, Bool_t dtorOnly);
0122
0123 private:
0124 TStreamerInfo(const TStreamerInfo&) = delete;
0125 TStreamerInfo& operator=(const TStreamerInfo&) = delete;
0126 void AddReadAction(TStreamerInfoActions::TActionSequence *readSequence, Int_t index, TCompInfo *compinfo);
0127 void AddWriteAction(TStreamerInfoActions::TActionSequence *writeSequence, Int_t index, TCompInfo *compinfo);
0128 void AddReadTextAction(TStreamerInfoActions::TActionSequence *readSequence, Int_t index, TCompInfo *compinfo);
0129 void AddWriteTextAction(TStreamerInfoActions::TActionSequence *writeSequence, Int_t index, TCompInfo *compinfo);
0130 void AddReadMemberWiseVecPtrAction(TStreamerInfoActions::TActionSequence *readSequence, Int_t index, TCompInfo *compinfo);
0131 void AddWriteMemberWiseVecPtrAction(TStreamerInfoActions::TActionSequence *writeSequence, Int_t index, TCompInfo *compinfo);
0132
0133 public:
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160 enum EReadWrite {
0161 kBase = 0, kOffsetL = 20, kOffsetP = 40, kCounter = 6, kCharStar = 7,
0162 kChar = 1, kShort = 2, kInt = 3, kLong = 4, kFloat = 5,
0163 kDouble = 8, kDouble32= 9,
0164 kLegacyChar = 10,
0165 kUChar = 11, kUShort = 12, kUInt = 13, kULong = 14, kBits = 15,
0166 kLong64 = 16, kULong64 = 17, kBool = 18, kFloat16 = 19,
0167 kObject = 61, kAny = 62, kObjectp = 63, kObjectP = 64, kTString = 65,
0168 kTObject = 66, kTNamed = 67, kAnyp = 68, kAnyP = 69, kAnyPnoVT = 70,
0169 kSTLp = 71,
0170 kSkip = 100, kSkipL = 120, kSkipP = 140,
0171 kConv = 200, kConvL = 220, kConvP = 240,
0172 kSTL = 300, kSTLstring = 365,
0173 kStreamer = 500, kStreamLoop = 501,
0174 kCache = 600,
0175 kArtificial = 1000,
0176 kCacheNew = 1001,
0177 kCacheDelete = 1002,
0178 kNeedObjectForVirtualBaseClass = 99997,
0179 kMissing = 99999
0180 };
0181
0182 TStreamerInfo();
0183 TStreamerInfo(TClass *cl);
0184 ~TStreamerInfo() override;
0185 void Build(Bool_t isTransient = kFALSE) override;
0186 void BuildCheck(TFile *file = nullptr, Bool_t load = kTRUE) override;
0187 void BuildEmulated(TFile *file) override;
0188 void BuildOld() override;
0189 Bool_t BuildFor( const TClass *cl ) override;
0190 void CallShowMembers(const void* obj, TMemberInspector &insp, Bool_t isTransient) const override;
0191 void Clear(Option_t * = "") override;
0192 TObject *Clone(const char *newname = "") const override;
0193 Bool_t CompareContent(TClass *cl,TVirtualStreamerInfo *info, Bool_t warn, Bool_t complete, TFile *file) override;
0194 void Compile() override;
0195 void ComputeSize();
0196 void ForceWriteInfo(TFile *file, Bool_t force = kFALSE) override;
0197 Int_t GenerateHeaderFile(const char *dirname, const TList *subClasses = nullptr, const TList *extrainfos = nullptr) override;
0198 TClass *GetActualClass(const void *obj) const override;
0199 TClass *GetClass() const override { return fClass; }
0200 UInt_t GetCheckSum() const override { return fCheckSum; }
0201 UInt_t GetCheckSum(TClass::ECheckSum code) const;
0202 Int_t GetClassVersion() const override { return fClassVersion; }
0203 Int_t GetDataMemberOffset(TDataMember *dm, TMemberStreamer *&streamer) const;
0204 TObjArray *GetElements() const override {return fElements;}
0205 TStreamerElement *GetElem(Int_t id) const override { return fComp[id].fElem; }
0206 TStreamerElement *GetElement(Int_t id) const override {return (TStreamerElement*)fElements->At(id);}
0207 Int_t GetElementOffset(Int_t id) const override {return fCompFull[id]->fOffset;}
0208 TStreamerInfoActions::TActionSequence *GetReadMemberWiseActions(Bool_t forCollection) { return forCollection ? fReadMemberWiseVecPtr : fReadMemberWise; }
0209 TStreamerInfoActions::TActionSequence *GetReadObjectWiseActions() { return fReadObjectWise; }
0210 TStreamerInfoActions::TActionSequence *GetReadTextActions() { return fReadText; }
0211 TStreamerInfoActions::TActionSequence *GetWriteMemberWiseActions(Bool_t forCollection) { return forCollection ? fWriteMemberWiseVecPtr : fWriteMemberWise; }
0212 TStreamerInfoActions::TActionSequence *GetWriteObjectWiseActions() { return fWriteObjectWise; }
0213 TStreamerInfoActions::TActionSequence *GetWriteTextActions() { return fWriteText; }
0214 Int_t GetNdata() const {return fNdata;}
0215 Int_t GetNelement() const { return fElements->GetEntriesFast(); }
0216 Int_t GetNumber() const override { return fNumber; }
0217 Int_t GetLength(Int_t id) const {return fComp[id].fLength;}
0218 ULongptr_t GetMethod(Int_t id) const {return fComp[id].fMethod;}
0219 Int_t GetNewType(Int_t id) const {return fComp[id].fNewType;}
0220 Int_t GetOffset(const char *) const override;
0221 Int_t GetOffset(Int_t id) const override {return fComp[id].fOffset;}
0222 Version_t GetOldVersion() const override {return fOldVersion;}
0223 Int_t GetOnFileClassVersion() const override {return fOnFileClassVersion;}
0224 Int_t GetSize() const override;
0225 Int_t GetSizeElements() const;
0226 TStreamerElement *GetStreamerElement(const char*datamember, Int_t& offset) const override;
0227 TStreamerElement *GetStreamerElementReal(Int_t i, Int_t j) const;
0228 Int_t GetType(Int_t id) const {return fComp[id].fType;}
0229 template <typename T> T GetTypedValue(char *pointer, Int_t i, Int_t j, Int_t len) const;
0230 template <typename T> T GetTypedValueClones(TClonesArray *clones, Int_t i, Int_t j, Int_t k, Int_t eoffset) const;
0231 template <typename T> T GetTypedValueSTL(TVirtualCollectionProxy *cont, Int_t i, Int_t j, Int_t k, Int_t eoffset) const;
0232 template <typename T> T GetTypedValueSTLP(TVirtualCollectionProxy *cont, Int_t i, Int_t j, Int_t k, Int_t eoffset) const;
0233 Double_t GetValue(char *pointer, Int_t i, Int_t j, Int_t len) const { return GetTypedValue<Double_t>(pointer, i, j, len); }
0234 Double_t GetValueClones(TClonesArray *clones, Int_t i, Int_t j, Int_t k, Int_t eoffset) const { return GetTypedValueClones<Double_t>(clones, i, j, k, eoffset); }
0235 Double_t GetValueSTL(TVirtualCollectionProxy *cont, Int_t i, Int_t j, Int_t k, Int_t eoffset) const { return GetTypedValueSTL<Double_t>(cont, i, j, k, eoffset); }
0236 Double_t GetValueSTLP(TVirtualCollectionProxy *cont, Int_t i, Int_t j, Int_t k, Int_t eoffset) const { return GetTypedValueSTLP<Double_t>(cont, i, j, k, eoffset); }
0237 void ls(Option_t *option="") const override;
0238 Bool_t MatchLegacyCheckSum(UInt_t checksum) const;
0239 TVirtualStreamerInfo *NewInfo(TClass *cl) override { return new TStreamerInfo(cl); }
0240 void *New(void *obj = nullptr) override;
0241 void *NewArray(Long_t nElements, void* ary = nullptr) override;
0242 void Destructor(void* p, Bool_t dtorOnly = kFALSE) override;
0243 void DeleteArray(void* p, Bool_t dtorOnly = kFALSE) override;
0244 void PrintValue(const char *name, char *pointer, Int_t i, Int_t len, Int_t lenmax=1000) const;
0245 void PrintValueClones(const char *name, TClonesArray *clones, Int_t i, Int_t eoffset, Int_t lenmax=1000) const;
0246 void PrintValueSTL(const char *name, TVirtualCollectionProxy *cont, Int_t i, Int_t eoffset, Int_t lenmax=1000) const;
0247
0248 template <class T>
0249 Int_t ReadBuffer(TBuffer &b, const T &arrptr, TCompInfo *const*const compinfo, Int_t first, Int_t last, Int_t narr=1,Int_t eoffset=0,Int_t mode=0);
0250 template <class T>
0251 Int_t ReadBufferSkip(TBuffer &b, const T &arrptr, const TCompInfo *compinfo,Int_t kase, TStreamerElement *aElement, Int_t narr, Int_t eoffset);
0252 template <class T>
0253 Int_t ReadBufferConv(TBuffer &b, const T &arrptr, const TCompInfo *compinfo,Int_t kase, TStreamerElement *aElement, Int_t narr, Int_t eoffset);
0254 template <class T>
0255 Int_t ReadBufferArtificial(TBuffer &b, const T &arrptr, TStreamerElement *aElement, Int_t narr, Int_t eoffset);
0256
0257 Int_t ReadBufferClones(TBuffer &b, TClonesArray *clones, Int_t nc, Int_t first, Int_t eoffset);
0258 Int_t ReadBufferSTL(TBuffer &b, TVirtualCollectionProxy *cont, Int_t nc, Int_t eoffset, Bool_t v7 = kTRUE );
0259 void SetCheckSum(UInt_t checksum) override { fCheckSum = checksum; }
0260 void SetClass(TClass *cl) override;
0261 void SetClassVersion(Int_t vers) override { fClassVersion = vers; }
0262 void SetOnFileClassVersion(Int_t vers) { fOnFileClassVersion = vers; }
0263 void TagFile(TFile *fFile) override;
0264 private:
0265
0266 Int_t WriteBuffer(TBuffer &b, char *pointer, Int_t first);
0267 Int_t WriteBufferClones(TBuffer &b, TClonesArray *clones, Int_t nc, Int_t first, Int_t eoffset);
0268 Int_t WriteBufferSTL (TBuffer &b, TVirtualCollectionProxy *cont, Int_t nc);
0269 Int_t WriteBufferSTLPtrs( TBuffer &b, TVirtualCollectionProxy *cont, Int_t nc, Int_t first, Int_t eoffset);
0270 public:
0271 void Update(const TClass *oldClass, TClass *newClass) override;
0272
0273
0274
0275
0276
0277
0278
0279 TVirtualStreamerInfo *GenerateInfoForPair(const std::string &pairclassname, bool silent, size_t hint_pair_offset, size_t hint_pair_size) override;
0280 TVirtualStreamerInfo *GenerateInfoForPair(const std::string &firstname, const std::string &secondname, bool silent, size_t hint_pair_offset, size_t hint_pair_size) override;
0281
0282 TVirtualCollectionProxy *GenEmulatedProxy(const char* class_name, Bool_t silent) override;
0283 TClassStreamer *GenEmulatedClassStreamer(const char* class_name, Bool_t silent) override;
0284 TVirtualCollectionProxy *GenExplicitProxy(const ::ROOT::Detail::TCollectionProxyInfo &info, TClass *cl) override;
0285 TClassStreamer *GenExplicitClassStreamer(const ::ROOT::Detail::TCollectionProxyInfo &info, TClass *cl) override;
0286
0287 static TStreamerElement *GetCurrentElement();
0288
0289 public:
0290
0291 template <class T>
0292 Int_t WriteBufferAux (TBuffer &b, const T &arr, TCompInfo *const*const compinfo, Int_t first, Int_t last, Int_t narr,Int_t eoffset,Int_t mode);
0293
0294
0295 ClassDefOverride(TStreamerInfo,9)
0296 };
0297
0298
0299 #endif