Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
90 // clang-format off
91 /// EReadWrite Enumerator
92 /// | Enum Constant | Description |
93 /// |-------------|--------------------|
94 /// | kBase | Base class element |
95 /// | kOffsetL | Fixed size array |
96 /// | kOffsetP | Pointer to object |
97 /// | kCounter | Counter for array size |
98 /// | kCharStar | Pointer to array of char |
99 /// | kLegacyChar | Equal to TDataType's kchar |
100 /// | kBits | TObject::fBits in case of a referenced object |
101 /// | kObject | Class derived from TObject, or for TStreamerSTL::fCtype non-pointer elements |
102 /// | kObjectp | Class* derived from TObject and with comment field //->Class, or for TStreamerSTL::fCtype: pointer elements |
103 /// | kObjectP | Class* derived from TObject and with NO comment field //->Class |
104 /// | kAny | Class not derived from TObject |
105 /// | kAnyp | Class* not derived from TObject with comment field //->Class |
106 /// | kAnyP | Class* not derived from TObject with NO comment field //->Class |
107 /// | kAnyPnoVT | Class* not derived from TObject with NO comment field //->Class and Class has NO virtual table |
108 /// | kSTLp | Pointer to STL container |
109 /// | kTString | TString, special case |
110 /// | kTObject | TObject, special case |
111 /// | kTNamed | TNamed , special case |
112 /// | kCache | Cache the value in memory than is not part of the object but is accessible via a SchemaRule |
113 /// | kNoType | Indicator that we don't know the current type because the member does not exist in memory |
114 /// | kUnsupportedConversion | The member type onfile and in memory can not be converted |
115 /// | kUnset | default value |
117 kBase = 0, kOffsetL = 20, kOffsetP = 40, kCounter = 6, kCharStar = 7,
118 kChar = 1, kShort = 2, kInt = 3, kLong = 4, kFloat = 5,
120 kLegacyChar = 10, /// Equal to TDataType's kchar
121 kUChar = 11, kUShort = 12, kUInt = 13, kULong = 14, kBits = 15,
122 kLong64 = 16, kULong64 = 17, kBool = 18, kFloat16 = 19,
123 kObject = 61, kAny = 62, kObjectp = 63, kObjectP = 64, kTString = 65,
124 kTObject = 66, kTNamed = 67, kAnyp = 68, kAnyP = 69, kAnyPnoVT = 70,
125 kSTLp = 71,
126 kSkip = 100, kSkipL = 120, kSkipP = 140,
127 kConv = 200, kConvL = 220, kConvP = 240,
128 kSTL = ROOT::kSTLany /* 300 */,
130 kStreamer = 500, kStreamLoop = 501,
131 kCache = 600, // Cache the value in memory than is not part of the object but is accessible via a SchemaRule
133 kCacheNew = 1001,
136 kMissing = 99999,
137 kNoType = -1, /// Type corresponding to a 'missing' data member (with kMissing offset)
139 kUnset = -3
140 };
141 // clang-format off
142
145 virtual ~TVirtualStreamerInfo();
146 virtual void Build(Bool_t isTransient = kFALSE) = 0;
147 virtual void BuildCheck(TFile *file = nullptr, Bool_t load = kTRUE) = 0;
148 virtual void BuildEmulated(TFile *file) = 0;
149 virtual void BuildOld() = 0;
150 virtual Bool_t BuildFor( const TClass *cl ) = 0;
151 virtual void CallShowMembers(const void* obj, TMemberInspector &insp, Bool_t isTransient) const = 0;
152 virtual void Clear(Option_t * = "") override = 0;
153 virtual Bool_t CompareContent(TClass *cl,TVirtualStreamerInfo *info, Bool_t warn, Bool_t complete, TFile *file) = 0;
154 virtual void Compile() = 0;
155 virtual void ForceWriteInfo(TFile *file, Bool_t force=kFALSE) = 0;
156 virtual Int_t GenerateHeaderFile(const char *dirname, const TList *subClasses = nullptr, const TList *extrainfos = nullptr) = 0;
157 virtual TClass *GetActualClass(const void *obj) const = 0;
158 virtual TClass *GetClass() const = 0;
159 virtual UInt_t GetCheckSum() const = 0;
160 virtual Int_t GetClassVersion() const = 0;
161 virtual TStreamerElement *GetElem(Int_t id) const = 0;
162 virtual TStreamerElement *GetElement(Int_t id) const = 0;
163 virtual TObjArray *GetElements() const = 0;
164 virtual Int_t GetOffset(const char *) const = 0;
165 virtual Int_t GetOffset(Int_t id) const = 0;
166 virtual Int_t GetElementOffset(Int_t id) const = 0;
167 virtual Version_t GetOldVersion() const = 0;
168 virtual Int_t GetOnFileClassVersion() const = 0;
169 virtual Int_t GetNumber() const = 0;
170 virtual Int_t GetSize() const = 0;
171 virtual TStreamerElement *GetStreamerElement(const char*datamember, Int_t& offset) const = 0;
172 Bool_t IsBuilt() const { return fIsBuilt; }
173 Bool_t IsCompiled() const { return fIsCompiled; }
174 Bool_t IsOptimized() const { return fOptimized; }
175 Int_t IsRecovered() const { return TestBit(kRecovered); }
176 virtual void ls(Option_t * = "") const override = 0;
178 virtual void *New(void *obj = nullptr) = 0;
179 virtual void *NewArray(Long_t nElements, void* ary = nullptr) = 0;
180 virtual void Destructor(void* p, Bool_t dtorOnly = kFALSE) = 0;
181 virtual void DeleteArray(void* p, Bool_t dtorOnly = kFALSE) = 0;
182
183 virtual void SetCheckSum(UInt_t checksum) = 0;
184 virtual void SetClass(TClass *cl) = 0;
185 virtual void SetClassVersion(Int_t vers) = 0;
186 static Bool_t SetStreamMemberWise(Bool_t enable = kTRUE);
187 virtual void TagFile(TFile *fFile) = 0;
188 virtual void Update(const TClass *oldClass, TClass *newClass) = 0;
189
190 static const char *GetElementCounterStart(const char *dmTitle);
191 static TStreamerBasicType *GetElementCounter(const char *countName, TClass *cl);
192
193 static Bool_t CanOptimize();
195 static void Optimize(Bool_t opt=kTRUE);
196 static Bool_t CanDelete();
197 static void SetCanDelete(Bool_t opt=kTRUE);
198 static void SetFactory(TVirtualStreamerInfo *factory);
199
200 /// \brief Generate the TClass and TStreamerInfo for the requested pair.
201 /// This creates a TVirtualStreamerInfo for the pair and trigger the BuildCheck/Old to
202 /// provokes the creation of the corresponding TClass. This relies on the dictionary for
203 /// std::pair<const int, int> to already exist (or the interpreter information being available)
204 /// as it is used as a template.
205 /// \note The returned object is owned by the caller.
206 virtual TVirtualStreamerInfo *GenerateInfoForPair(const std::string &pairclassname, bool silent, size_t hint_pair_offset, size_t hint_pair_size) = 0;
207 virtual TVirtualStreamerInfo *GenerateInfoForPair(const std::string &firstname, const std::string &secondname, bool silent, size_t hint_pair_offset, size_t hint_pair_size) = 0;
208
209 virtual TVirtualCollectionProxy *GenEmulatedProxy(const char* class_name, Bool_t silent) = 0;
210 virtual TClassStreamer *GenEmulatedClassStreamer(const char* class_name, Bool_t silent) = 0;
211 virtual TVirtualCollectionProxy *GenExplicitProxy( const ::ROOT::Detail::TCollectionProxyInfo &info, TClass *cl ) = 0;
212 virtual TClassStreamer *GenExplicitClassStreamer( const ::ROOT::Detail::TCollectionProxyInfo &info, TClass *cl ) = 0;
214
215 //WARNING this class version must be the same as TStreamerInfo
216 ClassDefOverride(TVirtualStreamerInfo,6) //Abstract Interface describing Streamer information for one class
217};
218
219#ifdef _MSC_VER
220#pragma warning( pop )
221#endif
222
223#endif
short Version_t
Definition RtypesCore.h:65
long Long_t
Definition RtypesCore.h:54
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
const char Option_t
Definition RtypesCore.h:66
#define BIT(n)
Definition Rtypes.h:90
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
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:81
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
Definition TFile.h:53
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:199
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:798
void ResetBit(UInt_t f)
Definition TObject.h:198
Defines a common interface to inspect/change the contents of an object that represents a collection.
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 Int_t GenerateHeaderFile(const char *dirname, const TList *subClasses=nullptr, const TList *extrainfos=nullptr)=0
virtual TClass * GetActualClass(const void *obj) const =0
virtual void BuildEmulated(TFile *file)=0
virtual UInt_t GetCheckSum() const =0
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 void BuildCheck(TFile *file=nullptr, Bool_t load=kTRUE)=0
virtual Bool_t BuildFor(const TClass *cl)=0
virtual void Compile()=0
EReadWrite
EReadWrite Enumerator.
@ kUChar
Equal to TDataType's kchar.
@ kUnsupportedConversion
Type corresponding to a 'missing' data member (with kMissing offset)
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 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 void * New(void *obj=nullptr)=0
virtual Version_t GetOldVersion() const =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
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
@ kSTLstring
Definition ESTLType.h:49
@ kSTLany
Definition ESTLType.h:48