Logo ROOT  
Reference Guide
TVirtualStreamerInfo.h
Go to the documentation of this file.
1// @(#)root/meta:$Id$
2// Author: Rene Brun 05/02/2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TVirtualStreamerInfo
13#define ROOT_TVirtualStreamerInfo
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// TVirtualStreamerInfo Abstract Interface class //
19// //
20// Abstract Interface describing Streamer information for one class. //
21// //
22//////////////////////////////////////////////////////////////////////////
23
24#include "TNamed.h"
25
26#include "ESTLType.h"
27
28#ifdef _MSC_VER
29// On Windows, Disable the warning:
30// 'kIgnoreTObjectStreamer': illegal qualified name in member declaration
31#pragma warning( push )
32#pragma warning( disable : 4596 )
33#endif
34
35class TFile;
36class TClass;
37class TObjArray;
41class TClassStreamer;
42namespace ROOT { namespace Detail { class TCollectionProxyInfo; } }
43
45
46protected:
47 Bool_t fOptimized : 1; //! true if the StreamerInfo has been optimized
48 Bool_t fIsBuilt : 1; //! true if the StreamerInfo has been 'built' (i.e. has all the StreamerElements it should have)
49 std::atomic<Bool_t> fIsCompiled; //! true if the StreamerInfo has been compiled (i.e. fully built, ready to use for streaming).
50
51protected:
52 static Bool_t fgCanDelete; //True if ReadBuffer can delete object
53 static Bool_t fgOptimize; //True if optimization on
54 static Bool_t fgStreamMemberWise; //True if the collections are to be stream "member-wise" (when possible).
56
59
62 ResetBit(kIsCompiled); /* for backward compatibility */
63 }
66 SetBit(kIsCompiled); /* for backward compatibility */
67 }
68
69public:
70
71 //status bits
74 kIgnoreTObjectStreamer = BIT(13), // eventhough BIT(13) is taken up by TObject (to preserve forward compatibility)
79 kBuildRunning = BIT(18)
80 };
81
83 // This bit duplicates TObject::kInvalidObject. As the semantic of kIgnoreTObjectStreamer is a persistent,
84 // we can not change its value without breaking forward compatibility.
85 // Furthermore, TObject::kInvalidObject and its semantic is not (and should not be)
86 // used in TVirtualStreamerInfo
88 };
89
91 kBase = 0, kOffsetL = 20, kOffsetP = 40, kCounter = 6, kCharStar = 7,
92 kChar = 1, kShort = 2, kInt = 3, kLong = 4, kFloat = 5,
94 kUChar = 11, kUShort = 12, kUInt = 13, kULong = 14, kBits = 15,
95 kLong64 = 16, kULong64 = 17, kBool = 18, kFloat16 = 19,
96 kObject = 61, kAny = 62, kObjectp = 63, kObjectP = 64, kTString = 65,
97 kTObject = 66, kTNamed = 67, kAnyp = 68, kAnyP = 69, kAnyPnoVT = 70,
98 kSTLp = 71,
99 kSkip = 100, kSkipL = 120, kSkipP = 140,
100 kConv = 200, kConvL = 220, kConvP = 240,
101 kSTL = ROOT::kSTLany /* 300 */,
103 kStreamer = 500, kStreamLoop = 501,
104 kCache = 600, // Cache the value in memory than is not part of the object but is accessible via a SchemaRule
106 kCacheNew = 1001,
109 kMissing = 99999
110 };
111
112// Some comments about EReadWrite
113// kBase : base class element
114// kOffsetL : fixed size array
115// kOffsetP : pointer to object
116// kCounter : counter for array size
117// kCharStar: pointer to array of char
118// kBits : TObject::fBits in case of a referenced object
119// kObject : Class derived from TObject
120// kObjectp : Class* derived from TObject and with comment field //->Class
121// kObjectP : Class* derived from TObject and with NO comment field //->Class
122// kAny : Class not derived from TObject
123// kAnyp : Class* not derived from TObject with comment field //->Class
124// kAnyP : Class* not derived from TObject with NO comment field //->Class
125// kAnyPnoVT: Class* not derived from TObject with NO comment field //->Class and Class has NO virtual table
126// kSTLp : Pointer to STL container.
127// kTString : TString, special case
128// kTObject : TObject, special case
129// kTNamed : TNamed , special case
130
131
132
135 virtual ~TVirtualStreamerInfo();
136 virtual void Build(Bool_t isTransient = kFALSE) = 0;
137 virtual void BuildCheck(TFile *file = 0, Bool_t load = kTRUE) = 0;
138 virtual void BuildEmulated(TFile *file) = 0;
139 virtual void BuildOld() = 0;
140 virtual Bool_t BuildFor( const TClass *cl ) = 0;
141 virtual void CallShowMembers(const void* obj, TMemberInspector &insp, Bool_t isTransient) const = 0;
142 virtual void Clear(Option_t * = "") override = 0;
143 virtual Bool_t CompareContent(TClass *cl,TVirtualStreamerInfo *info, Bool_t warn, Bool_t complete, TFile *file) = 0;
144 virtual void Compile() = 0;
145 virtual void ForceWriteInfo(TFile *file, Bool_t force=kFALSE) = 0;
146 virtual Int_t GenerateHeaderFile(const char *dirname, const TList *subClasses = 0, const TList *extrainfos = 0) = 0;
147 virtual TClass *GetActualClass(const void *obj) const = 0;
148 virtual TClass *GetClass() const = 0;
149 virtual UInt_t GetCheckSum() const = 0;
150 virtual Int_t GetClassVersion() const = 0;
151 virtual TStreamerElement *GetElem(Int_t id) const = 0;
152 virtual TStreamerElement *GetElement(Int_t id) const = 0;
153 virtual TObjArray *GetElements() const = 0;
154 virtual Int_t GetOffset(const char *) const = 0;
155 virtual Int_t GetOffset(Int_t id) const = 0;
156 virtual Int_t GetElementOffset(Int_t id) const = 0;
157 virtual Version_t GetOldVersion() const = 0;
158 virtual Int_t GetOnFileClassVersion() const = 0;
159 virtual Int_t GetNumber() const = 0;
160 virtual Int_t GetSize() const = 0;
161 virtual TStreamerElement *GetStreamerElement(const char*datamember, Int_t& offset) const = 0;
162 Bool_t IsBuilt() const { return fIsBuilt; }
163 Bool_t IsCompiled() const { return fIsCompiled; }
164 Bool_t IsOptimized() const { return fOptimized; }
165 Int_t IsRecovered() const { return TestBit(kRecovered); }
166 virtual void ls(Option_t * = "") const override = 0;
168 virtual void *New(void *obj = 0) = 0;
169 virtual void *NewArray(Long_t nElements, void* ary = nullptr) = 0;
170 virtual void Destructor(void* p, Bool_t dtorOnly = kFALSE) = 0;
171 virtual void DeleteArray(void* p, Bool_t dtorOnly = kFALSE) = 0;
172
173 virtual void SetCheckSum(UInt_t checksum) = 0;
174 virtual void SetClass(TClass *cl) = 0;
175 virtual void SetClassVersion(Int_t vers) = 0;
176 static Bool_t SetStreamMemberWise(Bool_t enable = kTRUE);
177 virtual void TagFile(TFile *fFile) = 0;
178 virtual void Update(const TClass *oldClass, TClass *newClass) = 0;
179
180 static const char *GetElementCounterStart(const char *dmTitle);
181 static TStreamerBasicType *GetElementCounter(const char *countName, TClass *cl);
182
183 static Bool_t CanOptimize();
185 static void Optimize(Bool_t opt=kTRUE);
186 static Bool_t CanDelete();
187 static void SetCanDelete(Bool_t opt=kTRUE);
188 static void SetFactory(TVirtualStreamerInfo *factory);
189
190 /// \brief Generate the TClass and TStreamerInfo for the requested pair.
191 /// This creates a TVirtualStreamerInfo for the pair and trigger the BuildCheck/Old to
192 /// provokes the creation of the corresponding TClass. This relies on the dictionary for
193 /// std::pair<const int, int> to already exist (or the interpreter information being available)
194 /// as it is used as a template.
195 /// \note The returned object is owned by the caller.
196 virtual TVirtualStreamerInfo *GenerateInfoForPair(const std::string &pairclassname, bool silent, size_t hint_pair_offset, size_t hint_pair_size) = 0;
197 virtual TVirtualStreamerInfo *GenerateInfoForPair(const std::string &firstname, const std::string &secondname, bool silent, size_t hint_pair_offset, size_t hint_pair_size) = 0;
198
199 virtual TVirtualCollectionProxy *GenEmulatedProxy(const char* class_name, Bool_t silent) = 0;
200 virtual TClassStreamer *GenEmulatedClassStreamer(const char* class_name, Bool_t silent) = 0;
201 virtual TVirtualCollectionProxy *GenExplicitProxy( const ::ROOT::Detail::TCollectionProxyInfo &info, TClass *cl ) = 0;
202 virtual TClassStreamer *GenExplicitClassStreamer( const ::ROOT::Detail::TCollectionProxyInfo &info, TClass *cl ) = 0;
204
205 //WARNING this class version must be the same as TStreamerInfo
206 ClassDefOverride(TVirtualStreamerInfo,6) //Abstract Interface describing Streamer information for one class
207};
208
209#ifdef _MSC_VER
210#pragma warning( pop )
211#endif
212
213#endif
short Version_t
Definition: RtypesCore.h:65
const Bool_t kFALSE
Definition: RtypesCore.h:101
long Long_t
Definition: RtypesCore.h:54
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
#define BIT(n)
Definition: Rtypes.h:85
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
winID h TVirtualViewer3D TVirtualGLPainter p
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 offset
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
Definition: TFile.h:54
A doubly linked list.
Definition: TList.h:38
Abstract base class for accessing the data-members of a class.
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
An array of TObjects.
Definition: TObjArray.h:31
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:187
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:696
void ResetBit(UInt_t f)
Definition: TObject.h:186
EStatusBits
Definition: TObject.h:57
Abstract Interface class describing Streamer information for one class.
virtual TVirtualStreamerInfo * GenerateInfoForPair(const std::string &pairclassname, bool silent, size_t hint_pair_offset, size_t hint_pair_size)=0
Generate the TClass and TStreamerInfo for the requested pair.
static Bool_t GetStreamMemberWise()
Return whether the TStreamerInfos will save the collections in "member-wise" order whenever possible.
virtual void DeleteArray(void *p, Bool_t dtorOnly=kFALSE)=0
virtual void Clear(Option_t *="") override=0
Set name and title to empty strings ("").
Bool_t fIsBuilt
true if the StreamerInfo has been optimized
virtual void CallShowMembers(const void *obj, TMemberInspector &insp, Bool_t isTransient) const =0
virtual void SetClassVersion(Int_t vers)=0
virtual TClassStreamer * GenEmulatedClassStreamer(const char *class_name, Bool_t silent)=0
virtual Int_t GetOffset(Int_t id) const =0
virtual void ForceWriteInfo(TFile *file, Bool_t force=kFALSE)=0
virtual TStreamerElement * GetStreamerElement(const char *datamember, Int_t &offset) const =0
static void SetFactory(TVirtualStreamerInfo *factory)
static function: Set the StreamerInfo factory
virtual TVirtualStreamerInfo * NewInfo(TClass *cl)=0
virtual void SetCheckSum(UInt_t checksum)=0
virtual void BuildCheck(TFile *file=0, Bool_t load=kTRUE)=0
virtual TClass * GetActualClass(const void *obj) const =0
virtual void BuildEmulated(TFile *file)=0
virtual UInt_t GetCheckSum() const =0
static Bool_t fgStreamMemberWise
virtual Int_t GetOffset(const char *) const =0
TVirtualStreamerInfo()
Default constructor.
std::atomic< Bool_t > fIsCompiled
true if the StreamerInfo has been 'built' (i.e. has all the StreamerElements it should have)
static const char * GetElementCounterStart(const char *dmTitle)
Given a comment/title declaring an array counter, for example:
virtual void Build(Bool_t isTransient=kFALSE)=0
static TVirtualStreamerInfo * fgInfoFactory
virtual Bool_t BuildFor(const TClass *cl)=0
virtual void Compile()=0
virtual TVirtualCollectionProxy * GenExplicitProxy(const ::ROOT::Detail::TCollectionProxyInfo &info, TClass *cl)=0
static Bool_t fgCanDelete
true if the StreamerInfo has been compiled (i.e. fully built, ready to use for streaming).
static Bool_t SetStreamMemberWise(Bool_t enable=kTRUE)
Set whether the TStreamerInfos will save the collections in "member-wise" order whenever possible.
virtual void * NewArray(Long_t nElements, void *ary=nullptr)=0
virtual Int_t GenerateHeaderFile(const char *dirname, const TList *subClasses=0, const TList *extrainfos=0)=0
virtual TVirtualStreamerInfo * GenerateInfoForPair(const std::string &firstname, const std::string &secondname, bool silent, size_t hint_pair_offset, size_t hint_pair_size)=0
virtual TVirtualCollectionProxy * GenEmulatedProxy(const char *class_name, Bool_t silent)=0
virtual void SetClass(TClass *cl)=0
virtual TStreamerElement * GetElement(Int_t id) const =0
static Bool_t CanOptimize()
static function returning true if optimization can be on
static TStreamerBasicType * GetElementCounter(const char *countName, TClass *cl)
Get pointer to a TStreamerBasicType in TClass *cl static function.
virtual TStreamerElement * GetElem(Int_t id) const =0
virtual TObjArray * GetElements() const =0
static void SetCanDelete(Bool_t opt=kTRUE)
This is a static function.
static Bool_t CanDelete()
static function returning true if ReadBuffer can delete object
virtual Int_t GetNumber() const =0
virtual Int_t GetSize() const =0
virtual void BuildOld()=0
virtual void TagFile(TFile *fFile)=0
static TVirtualStreamerInfo * Factory()
Static function returning a pointer to a new TVirtualStreamerInfo object.
TVirtualStreamerInfo & operator=(const TVirtualStreamerInfo &)
assignment operator
virtual Int_t GetElementOffset(Int_t id) const =0
virtual Version_t GetOldVersion() const =0
virtual void * New(void *obj=0)=0
virtual Int_t GetOnFileClassVersion() const =0
virtual void Destructor(void *p, Bool_t dtorOnly=kFALSE)=0
virtual Bool_t CompareContent(TClass *cl, TVirtualStreamerInfo *info, Bool_t warn, Bool_t complete, TFile *file)=0
virtual Int_t GetClassVersion() const =0
virtual void Update(const TClass *oldClass, TClass *newClass)=0
virtual ~TVirtualStreamerInfo()
Destructor.
virtual void ls(Option_t *="") const override=0
List TNamed name and title.
virtual TClass * GetClass() const =0
static void Optimize(Bool_t opt=kTRUE)
This is a static function.
virtual TClassStreamer * GenExplicitClassStreamer(const ::ROOT::Detail::TCollectionProxyInfo &info, TClass *cl)=0
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
@ kSTLstring
Definition: ESTLType.h:49
@ kSTLany
Definition: ESTLType.h:48
Definition: file.py:1