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
28class TFile;
29class TClass;
30class TObjArray;
34class TClassStreamer;
35namespace ROOT { namespace Detail { class TCollectionProxyInfo; } }
36
38
39protected:
40 Bool_t fOptimized : 1; //! true if the StreamerInfo has been optimized
41 Bool_t fIsBuilt : 1; //! true if the StreamerInfo has been 'built' (i.e. has all the StreamerElements it should have)
42 std::atomic<Bool_t> fIsCompiled; //! true if the StreamerInfo has been compiled (i.e. fully built, ready to use for streaming).
43
44protected:
45 static Bool_t fgCanDelete; //True if ReadBuffer can delete object
46 static Bool_t fgOptimize; //True if optimization on
47 static Bool_t fgStreamMemberWise; //True if the collections are to be stream "member-wise" (when possible).
49
52
55 ResetBit(kIsCompiled); /* for backward compatibility */
56 }
59 SetBit(kIsCompiled); /* for backward compatibility */
60 }
61
62public:
63
64 //status bits
67 kIgnoreTObjectStreamer = BIT(13), // eventhough BIT(13) is taken up by TObject (to preserve forward compatibility)
72 kBuildRunning = BIT(18)
73 };
74
76 // This bit duplicates TObject::kInvalidObject. As the semantic of kIgnoreTObjectStreamer is a persistent,
77 // we can not change its value without breaking forward compatibility.
78 // Furthermore, TObject::kInvalidObject and its semantic is not (and should not be)
79 // used in TVirtualStreamerInfo
81 };
82
84 kBase = 0, kOffsetL = 20, kOffsetP = 40, kCounter = 6, kCharStar = 7,
85 kChar = 1, kShort = 2, kInt = 3, kLong = 4, kFloat = 5,
87 kUChar = 11, kUShort = 12, kUInt = 13, kULong = 14, kBits = 15,
88 kLong64 = 16, kULong64 = 17, kBool = 18, kFloat16 = 19,
89 kObject = 61, kAny = 62, kObjectp = 63, kObjectP = 64, kTString = 65,
90 kTObject = 66, kTNamed = 67, kAnyp = 68, kAnyP = 69, kAnyPnoVT = 70,
91 kSTLp = 71,
92 kSkip = 100, kSkipL = 120, kSkipP = 140,
93 kConv = 200, kConvL = 220, kConvP = 240,
94 kSTL = ROOT::kSTLany /* 300 */,
96 kStreamer = 500, kStreamLoop = 501,
97 kCache = 600, // Cache the value in memory than is not part of the object but is accessible via a SchemaRule
99 kCacheNew = 1001,
102 kMissing = 99999
103 };
104
105// Some comments about EReadWrite
106// kBase : base class element
107// kOffsetL : fixed size array
108// kOffsetP : pointer to object
109// kCounter : counter for array size
110// kCharStar: pointer to array of char
111// kBits : TObject::fBits in case of a referenced object
112// kObject : Class derived from TObject
113// kObjectp : Class* derived from TObject and with comment field //->Class
114// kObjectP : Class* derived from TObject and with NO comment field //->Class
115// kAny : Class not derived from TObject
116// kAnyp : Class* not derived from TObject with comment field //->Class
117// kAnyP : Class* not derived from TObject with NO comment field //->Class
118// kAnyPnoVT: Class* not derived from TObject with NO comment field //->Class and Class has NO virtual table
119// kSTLp : Pointer to STL container.
120// kTString : TString, special case
121// kTObject : TObject, special case
122// kTNamed : TNamed , special case
123
124
125
128 virtual ~TVirtualStreamerInfo();
129 virtual void Build(Bool_t isTransient = kFALSE) = 0;
130 virtual void BuildCheck(TFile *file = 0, Bool_t load = kTRUE) = 0;
131 virtual void BuildEmulated(TFile *file) = 0;
132 virtual void BuildOld() = 0;
133 virtual Bool_t BuildFor( const TClass *cl ) = 0;
134 virtual void CallShowMembers(const void* obj, TMemberInspector &insp, Bool_t isTransient) const = 0;
135 virtual void Clear(Option_t *) = 0;
136 virtual Bool_t CompareContent(TClass *cl,TVirtualStreamerInfo *info, Bool_t warn, Bool_t complete, TFile *file) = 0;
137 virtual void Compile() = 0;
138 virtual void ForceWriteInfo(TFile *file, Bool_t force=kFALSE) = 0;
139 virtual Int_t GenerateHeaderFile(const char *dirname, const TList *subClasses = 0, const TList *extrainfos = 0) = 0;
140 virtual TClass *GetActualClass(const void *obj) const = 0;
141 virtual TClass *GetClass() const = 0;
142 virtual UInt_t GetCheckSum() const = 0;
143 virtual Int_t GetClassVersion() const = 0;
144 virtual TStreamerElement *GetElem(Int_t id) const = 0;
145 virtual TStreamerElement *GetElement(Int_t id) const = 0;
146 virtual TObjArray *GetElements() const = 0;
147 virtual Int_t GetOffset(const char *) const = 0;
148 virtual Int_t GetOffset(Int_t id) const = 0;
149 virtual Int_t GetElementOffset(Int_t id) const = 0;
150 virtual Version_t GetOldVersion() const = 0;
151 virtual Int_t GetOnFileClassVersion() const = 0;
152 virtual Int_t GetNumber() const = 0;
153 virtual Int_t GetSize() const = 0;
154 virtual TStreamerElement *GetStreamerElement(const char*datamember, Int_t& offset) const = 0;
155 Bool_t IsBuilt() const { return fIsBuilt; }
156 Bool_t IsCompiled() const { return fIsCompiled; }
157 Bool_t IsOptimized() const { return fOptimized; }
158 Int_t IsRecovered() const { return TestBit(kRecovered); }
159 virtual void ls(Option_t *option="") const = 0;
161 virtual void *New(void *obj = 0) = 0;
162 virtual void *NewArray(Long_t nElements, void* ary = 0) = 0;
163 virtual void Destructor(void* p, Bool_t dtorOnly = kFALSE) = 0;
164 virtual void DeleteArray(void* p, Bool_t dtorOnly = kFALSE) = 0;
165
166 virtual void SetCheckSum(UInt_t checksum) = 0;
167 virtual void SetClass(TClass *cl) = 0;
168 virtual void SetClassVersion(Int_t vers) = 0;
169 static Bool_t SetStreamMemberWise(Bool_t enable = kTRUE);
170 virtual void TagFile(TFile *fFile) = 0;
171 virtual void Update(const TClass *oldClass, TClass *newClass) = 0;
172
173 static const char *GetElementCounterStart(const char *dmTitle);
174 static TStreamerBasicType *GetElementCounter(const char *countName, TClass *cl);
175
176 static Bool_t CanOptimize();
178 static void Optimize(Bool_t opt=kTRUE);
179 static Bool_t CanDelete();
180 static void SetCanDelete(Bool_t opt=kTRUE);
181 static void SetFactory(TVirtualStreamerInfo *factory);
182
183 // \brief Generate the TClass and TStreamerInfo for the requested pair.
184 // This creates a TVirtualStreamerInfo for the pair and trigger the BuildCheck/Old to
185 // provokes the creation of the corresponding TClass. This relies on the dictionary for
186 // std::pair<const int, int> to already exist (or the interpreter information being available)
187 // as it is used as a template.
188 virtual TVirtualStreamerInfo *GenerateInfoForPair(const std::string &pairclassname, bool silent, size_t hint_pair_offset, size_t hint_pair_size) = 0;
189 virtual TVirtualStreamerInfo *GenerateInfoForPair(const std::string &firstname, const std::string &secondname, bool silent, size_t hint_pair_offset, size_t hint_pair_size) = 0;
190
191 virtual TVirtualCollectionProxy *GenEmulatedProxy(const char* class_name, Bool_t silent) = 0;
192 virtual TClassStreamer *GenEmulatedClassStreamer(const char* class_name, Bool_t silent) = 0;
193 virtual TVirtualCollectionProxy *GenExplicitProxy( const ::ROOT::Detail::TCollectionProxyInfo &info, TClass *cl ) = 0;
194 virtual TClassStreamer *GenExplicitClassStreamer( const ::ROOT::Detail::TCollectionProxyInfo &info, TClass *cl ) = 0;
196
197 //WARNING this class version must be the same as TStreamerInfo
198 ClassDef(TVirtualStreamerInfo,6) //Abstract Interface describing Streamer information for one class
199};
200
201#endif
short Version_t
Definition: RtypesCore.h:63
const Bool_t kFALSE
Definition: RtypesCore.h:90
long Long_t
Definition: RtypesCore.h:52
const Bool_t kTRUE
Definition: RtypesCore.h:89
const char Option_t
Definition: RtypesCore.h:64
#define ClassDef(name, id)
Definition: Rtypes.h:322
#define BIT(n)
Definition: Rtypes.h:83
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:53
A doubly linked list.
Definition: TList.h:44
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:37
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:694
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
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
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 ls(Option_t *option="") const =0
List TNamed name and title.
virtual Int_t GenerateHeaderFile(const char *dirname, const TList *subClasses=0, const TList *extrainfos=0)=0
virtual void Clear(Option_t *)=0
Set name and title to empty strings ("").
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 void * NewArray(Long_t nElements, void *ary=0)=0
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 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...
Definition: StringConv.hxx:21
@ kSTLstring
Definition: ESTLType.h:48
@ kSTLany
Definition: ESTLType.h:47
Definition: file.py:1