File indexing completed on 2025-01-18 10:12:34
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TVirtualStreamerInfo
0013 #define ROOT_TVirtualStreamerInfo
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 #include "TNamed.h"
0025
0026 #include "ESTLType.h"
0027
0028 #ifdef _MSC_VER
0029
0030
0031 #pragma warning( push )
0032 #pragma warning( disable : 4596 )
0033 #endif
0034
0035 class TFile;
0036 class TClass;
0037 class TObjArray;
0038 class TStreamerElement;
0039 class TStreamerBasicType;
0040 class TVirtualCollectionProxy;
0041 class TClassStreamer;
0042 namespace ROOT { namespace Detail { class TCollectionProxyInfo; } }
0043
0044 class TVirtualStreamerInfo : public TNamed {
0045
0046 protected:
0047 Bool_t fOptimized : 1;
0048 Bool_t fIsBuilt : 1;
0049 std::atomic<Bool_t> fIsCompiled;
0050
0051 protected:
0052 static Bool_t fgCanDelete;
0053 static Bool_t fgOptimize;
0054 static Bool_t fgStreamMemberWise;
0055 static TVirtualStreamerInfo *fgInfoFactory;
0056
0057 TVirtualStreamerInfo(const TVirtualStreamerInfo& info);
0058 TVirtualStreamerInfo& operator=(const TVirtualStreamerInfo&);
0059
0060 void ResetIsCompiled() {
0061 fIsCompiled = kFALSE;
0062 ResetBit(kIsCompiled);
0063 }
0064 void SetIsCompiled() {
0065 fIsCompiled = kTRUE;
0066 SetBit(kIsCompiled);
0067 }
0068
0069 public:
0070
0071
0072 enum EStatusBits {
0073 kCannotOptimize = BIT(12),
0074 kIgnoreTObjectStreamer = BIT(13),
0075 kRecovered = BIT(14),
0076 kNeedCheck = BIT(15),
0077 kIsCompiled = BIT(16),
0078 kBuildOldUsed = BIT(17),
0079 kBuildRunning = BIT(18)
0080 };
0081
0082 enum class EStatusBitsDupExceptions {
0083
0084
0085
0086
0087 kIgnoreTObjectStreamer = TVirtualStreamerInfo::kIgnoreTObjectStreamer
0088 };
0089
0090 enum EReadWrite {
0091 kBase = 0, kOffsetL = 20, kOffsetP = 40, kCounter = 6, kCharStar = 7,
0092 kChar = 1, kShort = 2, kInt = 3, kLong = 4, kFloat = 5,
0093 kDouble = 8, kDouble32= 9,
0094 kUChar = 11, kUShort = 12, kUInt = 13, kULong = 14, kBits = 15,
0095 kLong64 = 16, kULong64 = 17, kBool = 18, kFloat16 = 19,
0096 kObject = 61, kAny = 62, kObjectp = 63, kObjectP = 64, kTString = 65,
0097 kTObject = 66, kTNamed = 67, kAnyp = 68, kAnyP = 69, kAnyPnoVT = 70,
0098 kSTLp = 71,
0099 kSkip = 100, kSkipL = 120, kSkipP = 140,
0100 kConv = 200, kConvL = 220, kConvP = 240,
0101 kSTL = ROOT::kSTLany ,
0102 kSTLstring = ROOT::kSTLstring ,
0103 kStreamer = 500, kStreamLoop = 501,
0104 kCache = 600,
0105 kArtificial = 1000,
0106 kCacheNew = 1001,
0107 kCacheDelete = 1002,
0108 kNeedObjectForVirtualBaseClass = 99997,
0109 kMissing = 99999
0110 };
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132
0133 TVirtualStreamerInfo();
0134 TVirtualStreamerInfo(TClass * );
0135 virtual ~TVirtualStreamerInfo();
0136 virtual void Build(Bool_t isTransient = kFALSE) = 0;
0137 virtual void BuildCheck(TFile *file = nullptr, Bool_t load = kTRUE) = 0;
0138 virtual void BuildEmulated(TFile *file) = 0;
0139 virtual void BuildOld() = 0;
0140 virtual Bool_t BuildFor( const TClass *cl ) = 0;
0141 virtual void CallShowMembers(const void* obj, TMemberInspector &insp, Bool_t isTransient) const = 0;
0142 virtual void Clear(Option_t * = "") override = 0;
0143 virtual Bool_t CompareContent(TClass *cl,TVirtualStreamerInfo *info, Bool_t warn, Bool_t complete, TFile *file) = 0;
0144 virtual void Compile() = 0;
0145 virtual void ForceWriteInfo(TFile *file, Bool_t force=kFALSE) = 0;
0146 virtual Int_t GenerateHeaderFile(const char *dirname, const TList *subClasses = nullptr, const TList *extrainfos = nullptr) = 0;
0147 virtual TClass *GetActualClass(const void *obj) const = 0;
0148 virtual TClass *GetClass() const = 0;
0149 virtual UInt_t GetCheckSum() const = 0;
0150 virtual Int_t GetClassVersion() const = 0;
0151 virtual TStreamerElement *GetElem(Int_t id) const = 0;
0152 virtual TStreamerElement *GetElement(Int_t id) const = 0;
0153 virtual TObjArray *GetElements() const = 0;
0154 virtual Int_t GetOffset(const char *) const = 0;
0155 virtual Int_t GetOffset(Int_t id) const = 0;
0156 virtual Int_t GetElementOffset(Int_t id) const = 0;
0157 virtual Version_t GetOldVersion() const = 0;
0158 virtual Int_t GetOnFileClassVersion() const = 0;
0159 virtual Int_t GetNumber() const = 0;
0160 virtual Int_t GetSize() const = 0;
0161 virtual TStreamerElement *GetStreamerElement(const char*datamember, Int_t& offset) const = 0;
0162 Bool_t IsBuilt() const { return fIsBuilt; }
0163 Bool_t IsCompiled() const { return fIsCompiled; }
0164 Bool_t IsOptimized() const { return fOptimized; }
0165 Int_t IsRecovered() const { return TestBit(kRecovered); }
0166 virtual void ls(Option_t * = "") const override = 0;
0167 virtual TVirtualStreamerInfo *NewInfo(TClass *cl) = 0;
0168 virtual void *New(void *obj = nullptr) = 0;
0169 virtual void *NewArray(Long_t nElements, void* ary = nullptr) = 0;
0170 virtual void Destructor(void* p, Bool_t dtorOnly = kFALSE) = 0;
0171 virtual void DeleteArray(void* p, Bool_t dtorOnly = kFALSE) = 0;
0172
0173 virtual void SetCheckSum(UInt_t checksum) = 0;
0174 virtual void SetClass(TClass *cl) = 0;
0175 virtual void SetClassVersion(Int_t vers) = 0;
0176 static Bool_t SetStreamMemberWise(Bool_t enable = kTRUE);
0177 virtual void TagFile(TFile *fFile) = 0;
0178 virtual void Update(const TClass *oldClass, TClass *newClass) = 0;
0179
0180 static const char *GetElementCounterStart(const char *dmTitle);
0181 static TStreamerBasicType *GetElementCounter(const char *countName, TClass *cl);
0182
0183 static Bool_t CanOptimize();
0184 static Bool_t GetStreamMemberWise();
0185 static void Optimize(Bool_t opt=kTRUE);
0186 static Bool_t CanDelete();
0187 static void SetCanDelete(Bool_t opt=kTRUE);
0188 static void SetFactory(TVirtualStreamerInfo *factory);
0189
0190
0191
0192
0193
0194
0195
0196 virtual TVirtualStreamerInfo *GenerateInfoForPair(const std::string &pairclassname, bool silent, size_t hint_pair_offset, size_t hint_pair_size) = 0;
0197 virtual TVirtualStreamerInfo *GenerateInfoForPair(const std::string &firstname, const std::string &secondname, bool silent, size_t hint_pair_offset, size_t hint_pair_size) = 0;
0198
0199 virtual TVirtualCollectionProxy *GenEmulatedProxy(const char* class_name, Bool_t silent) = 0;
0200 virtual TClassStreamer *GenEmulatedClassStreamer(const char* class_name, Bool_t silent) = 0;
0201 virtual TVirtualCollectionProxy *GenExplicitProxy( const ::ROOT::Detail::TCollectionProxyInfo &info, TClass *cl ) = 0;
0202 virtual TClassStreamer *GenExplicitClassStreamer( const ::ROOT::Detail::TCollectionProxyInfo &info, TClass *cl ) = 0;
0203 static TVirtualStreamerInfo *Factory();
0204
0205
0206 ClassDefOverride(TVirtualStreamerInfo,6)
0207 };
0208
0209 #ifdef _MSC_VER
0210 #pragma warning( pop )
0211 #endif
0212
0213 #endif