Logo ROOT   6.14/05
Reference Guide
TClass.h
Go to the documentation of this file.
1 // @(#)root/meta:$Id$
2 // Author: Rene Brun 07/01/95
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, 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_TClass
13 #define ROOT_TClass
14 
15 //////////////////////////////////////////////////////////////////////////
16 // //
17 // TClass //
18 // //
19 // Dictionary of a class. //
20 // //
21 //////////////////////////////////////////////////////////////////////////
22 
23 #include "TDictionary.h"
24 #include "TString.h"
25 #include "TObjArray.h"
26 #include "TObjString.h"
27 
28 #include <map>
29 #include <string>
30 #include <set>
31 #include <unordered_set>
32 #include <vector>
33 
34 #include <atomic>
35 #include "ThreadLocalStorage.h"
36 
37 class TBaseClass;
38 class TBrowser;
39 class TDataMember;
40 class TCling;
41 class TMethod;
42 class TRealData;
43 class TBuffer;
46 class TMethodCall;
47 class TVirtualIsAProxy;
48 class TVirtualRefProxy;
49 class THashTable;
50 class TListOfFunctions;
52 class TListOfDataMembers;
53 class TListOfEnums;
54 class TViewPubFunctions;
56 class TFunctionTemplate;
57 class TProtoClass;
58 
59 namespace ROOT {
60  class TGenericClassInfo;
61  class TMapTypeToTClass;
62  class TMapDeclIdToTClass;
63  namespace Detail {
64  class TSchemaRuleSet;
65  class TCollectionProxyInfo;
66  }
67  namespace Internal {
68  class TCheckHashRecursiveRemoveConsistency;
69  }
70 }
71 
72 typedef ROOT::TMapTypeToTClass IdMap_t;
73 typedef ROOT::TMapDeclIdToTClass DeclIdMap_t;
74 
75 class TClass : public TDictionary {
76 
77 friend class TCling;
78 friend void ROOT::ResetClassVersion(TClass*, const char*, Short_t);
80 friend class TProtoClass;
82 
83 public:
84  // TClass status bits
85  enum EStatusBits {
86  kReservedLoading = BIT(7), // Internal status bits, set and reset only during initialization
87 
88  kClassSaved = BIT(12),
89  kHasLocalHashMember = BIT(14),
90  kIgnoreTObjectStreamer = BIT(15),
91  kUnloaded = BIT(16), // The library containing the dictionary for this class was
92  // loaded and has been unloaded from memory.
93  kIsTObject = BIT(17),
94  kIsForeign = BIT(18),
95  kIsEmulation = BIT(19), // Deprecated
96  kStartWithTObject = BIT(20), // see comments for IsStartingWithTObject()
97  kWarned = BIT(21),
98  kHasNameMapNode = BIT(22),
99  kHasCustomStreamerMember = BIT(23) // The class has a Streamer method and it is implemented by the user or an older (not StreamerInfo based) automatic streamer.
100  };
101  enum ENewType { kRealNew = 0, kClassNew, kDummyNew };
102  enum ECheckSum {
103  kCurrentCheckSum = 0,
104  kNoEnum = 1, // Used since v3.3
105  kReflexNoComment = 2, // Up to v5.34.18 (has no range/comment and no typedef at all)
106  kNoRange = 3, // Up to v5.17
107  kWithTypeDef = 4, // Up to v5.34.18 and v5.99/06
108  kReflex = 5, // Up to v5.34.18 (has no typedef at all)
109  kNoRangeCheck = 6, // Up to v5.34.18 and v5.99/06
110  kNoBaseCheckSum = 7, // Up to v5.34.18 and v5.99/06
111  kLatestCheckSum = 8
112  };
113 
114  // Describe the current state of the TClass itself.
115  enum EState {
116  kNoInfo, // The state has not yet been initialized, i.e. the TClass
117  // was just created and/or there is no trace of it in the interpreter.
118  kForwardDeclared, // The interpreted knows the entity is a class but that's it.
119  kEmulated, // The information about the class only comes from a TStreamerInfo
120  kInterpreted, // The class is described completely/only in the interpreter database.
121  kHasTClassInit, // The class has a TClass proper bootstrap coming from a run
122  // through rootcling/genreflex/TMetaUtils and the library
123  // containing this dictionary has been loaded in memory.
124  kLoaded = kHasTClassInit,
125  kNamespaceForMeta // Very transient state necessary to bootstrap namespace entries
126  // in ROOT Meta w/o interpreter information
127  };
128 
129 private:
130 
131 
132 
134  // A class which is used to collect decl names starting from normalised
135  // names (typedef resolution is excluded here, just string manipulation
136  // is performed). At the heart of the implementation, an unordered set.
137  public:
138  TDeclNameRegistry(Int_t verbLevel=0);
139  void AddQualifiedName(const char *name);
140  Bool_t HasDeclName(const char *name) const;
142  private:
143  Int_t fVerbLevel=0;
144  std::unordered_set<std::string> fClassNamesSet;
145  mutable std::atomic_flag fSpinLock; // MSVC doesn't support = ATOMIC_FLAG_INIT;
146  };
147 
149  // Trivial RAII used to insert names in the registry
151  const char* fName;
153  public:
154  InsertTClassInRegistryRAII(TClass::EState &state, const char *name, TDeclNameRegistry &emuRegistry);
156  };
157 
158  // TClass objects can be created as a result of opening a TFile (in which
159  // they are in emulated mode) or as a result of loading the dictionary for
160  // the corresponding class. When a dictionary is loaded any pre-existing
161  // emulated TClass is replaced by the one created/coming from the dictionary.
162  // To have a reference that always point to the 'current' TClass object for
163  // a given class, one should use a TClassRef.
164  // TClassRef works by holding on to the fPersistentRef which is updated
165  // atomically whenever a TClass is replaced. During the replacement the
166  // value of fPersistentRef is set to zero, leading the TClassRef to call
167  // TClass::GetClass which is also locked by the replacement. At the end
168  // of the replacement, fPersistentRef points to the new TClass object.
169  std::atomic<TClass**> fPersistentRef;//!Persistent address of pointer to this TClass object and its successors.
170 
171  typedef std::atomic<std::map<std::string, TObjArray*>*> ConvSIMap_t;
172 
173  mutable TObjArray *fStreamerInfo; //Array of TVirtualStreamerInfo
174  mutable ConvSIMap_t fConversionStreamerInfo; //Array of the streamer infos derived from another class.
175  TList *fRealData; //linked list for persistent members including base classes
176  std::atomic<TList*> fBase; //linked list for base classes
177  TListOfDataMembers *fData; //linked list for data members
178 
179  std::atomic<TListOfEnums*> fEnums; //linked list for the enums
180  TListOfFunctionTemplates *fFuncTemplate; //linked list for function templates [Not public until implemented as active list]
181  std::atomic<TListOfFunctions*> fMethod; //linked list for methods
182 
183  TViewPubDataMembers*fAllPubData; //all public data members (including from base classes)
184  TViewPubFunctions *fAllPubMethod; //all public methods (including from base classes)
185  mutable TList *fClassMenuList; //list of class menu items
186 
187  const char *fDeclFileName; //name of class declaration file
188  const char *fImplFileName; //name of class implementation file
189  Short_t fDeclFileLine; //line of class declaration
190  Short_t fImplFileLine; //line of class implementation
191  UInt_t fInstanceCount; //number of instances of this class
192  UInt_t fOnHeap; //number of instances on heap
193  mutable std::atomic<UInt_t> fCheckSum; //checksum of data members and base classes
194  TVirtualCollectionProxy *fCollectionProxy; //Collection interface
195  Version_t fClassVersion; //Class version Identifier
196  ClassInfo_t *fClassInfo; //pointer to CINT class info class
197  TString fContextMenuTitle;//context menu title
198  const std::type_info *fTypeInfo; //pointer to the C++ type information.
199  ShowMembersFunc_t fShowMembers; //pointer to the class's ShowMembers function
200  TClassStreamer *fStreamer; //pointer to streamer function
201  TString fSharedLibs; //shared libraries containing class code
202 
203  TVirtualIsAProxy *fIsA; //!pointer to the class's IsA proxy.
204  IsAGlobalFunc_t fGlobalIsA; //pointer to a global IsA function.
205  mutable std::atomic<TMethodCall*> fIsAMethod; //!saved info to call a IsA member function
206 
207  ROOT::MergeFunc_t fMerge; //pointer to a function implementing Merging objects of this class.
208  ROOT::ResetAfterMergeFunc_t fResetAfterMerge; //pointer to a function implementing Merging objects of this class.
209  ROOT::NewFunc_t fNew; //pointer to a function newing one object.
210  ROOT::NewArrFunc_t fNewArray; //pointer to a function newing an array of objects.
211  ROOT::DelFunc_t fDelete; //pointer to a function deleting one object.
212  ROOT::DelArrFunc_t fDeleteArray; //pointer to a function deleting an array of objects.
213  ROOT::DesFunc_t fDestructor; //pointer to a function call an object's destructor.
214  ROOT::DirAutoAdd_t fDirAutoAdd; //pointer which implements the Directory Auto Add feature for this class.']'
215  ClassStreamerFunc_t fStreamerFunc; //Wrapper around this class custom Streamer member function.
216  ClassConvStreamerFunc_t fConvStreamerFunc; //Wrapper around this class custom conversion Streamer member function.
217  Int_t fSizeof; //Sizeof the class.
218 
219  Int_t fCanSplit; //!Indicates whether this class can be split or not.
220  mutable std::atomic<Long_t> fProperty; //!Property
221  mutable Long_t fClassProperty; //!C++ Property of the class (is abstract, has virtual table, etc.)
222 
223  // fHasRootPcmInfo needs to be atomic as long as GetListOfBases needs to modify it.
224  std::atomic<Bool_t> fHasRootPcmInfo; //!Whether info was loaded from a root pcm.
225  mutable std::atomic<Bool_t> fCanLoadClassInfo; //!Indicates whether the ClassInfo is supposed to be available.
226  mutable std::atomic<Bool_t> fIsOffsetStreamerSet; //!saved remember if fOffsetStreamer has been set.
227  mutable std::atomic<Bool_t> fVersionUsed; //!Indicates whether GetClassVersion has been called
228 
230  kNotInitialized = 0,
231  kSet = BIT(0),
232  // kInconsistent when kSet & !kConsistent.
233  kConsistentHash = BIT(1)
234  };
236  return l & static_cast<UChar_t>(r);
237  }
238  mutable std::atomic<UChar_t> fRuntimeProperties; //! Properties that can only be evaluated at run-time
239 
240  mutable Long_t fOffsetStreamer; //!saved info to call Streamer
241  Int_t fStreamerType; //!cached of the streaming method to use
242  EState fState; //!Current 'state' of the class (Emulated,Interpreted,Loaded)
243  mutable std::atomic<TVirtualStreamerInfo*> fCurrentInfo; //!cached current streamer info.
244  mutable std::atomic<TVirtualStreamerInfo*> fLastReadInfo; //!cached streamer info used in the last read.
245  TVirtualRefProxy *fRefProxy; //!Pointer to reference proxy if this class represents a reference
246  ROOT::Detail::TSchemaRuleSet *fSchemaRules; //! Schema evolution rules
247 
248  typedef void (*StreamerImpl_t)(const TClass* pThis, void *obj, TBuffer &b, const TClass *onfile_class);
249 #ifdef R__NO_ATOMIC_FUNCTION_POINTER
250  mutable StreamerImpl_t fStreamerImpl; //! Pointer to the function implementing streaming for this class
251 #else
252  mutable std::atomic<StreamerImpl_t> fStreamerImpl; //! Pointer to the function implementing streaming for this class
253 #endif
254 
255  Bool_t CanSplitBaseAllow();
256  TListOfFunctions *GetMethodList();
257  TMethod *GetClassMethod(Long_t faddr);
258  TMethod *FindClassOrBaseMethodWithId(DeclId_t faddr);
259  Int_t GetBaseClassOffsetRecurse(const TClass *toBase);
260  void Init(const char *name, Version_t cversion, const std::type_info *info,
261  TVirtualIsAProxy *isa,
262  const char *dfil, const char *ifil,
263  Int_t dl, Int_t il,
264  ClassInfo_t *classInfo,
265  Bool_t silent);
266  void ForceReload (TClass* oldcl);
267  void LoadClassInfo() const;
268 
269  static TClass *LoadClassDefault(const char *requestedname, Bool_t silent);
270  static TClass *LoadClassCustom(const char *requestedname, Bool_t silent);
271 
272  void SetClassVersion(Version_t version);
273  void SetClassSize(Int_t sizof) { fSizeof = sizof; }
274  TVirtualStreamerInfo* DetermineCurrentStreamerInfo();
275 
276  void SetStreamerImpl();
277 
278  void SetRuntimeProperties();
279 
280  // Various implementation for TClass::Stramer
281  static void StreamerExternal(const TClass* pThis, void *object, TBuffer &b, const TClass *onfile_class);
282  static void StreamerTObject(const TClass* pThis, void *object, TBuffer &b, const TClass *onfile_class);
283  static void StreamerTObjectInitialized(const TClass* pThis, void *object, TBuffer &b, const TClass *onfile_class);
284  static void StreamerTObjectEmulated(const TClass* pThis, void *object, TBuffer &b, const TClass *onfile_class);
285  static void StreamerInstrumented(const TClass* pThis, void *object, TBuffer &b, const TClass *onfile_class);
286  static void ConvStreamerInstrumented(const TClass* pThis, void *object, TBuffer &b, const TClass *onfile_class);
287  static void StreamerStreamerInfo(const TClass* pThis, void *object, TBuffer &b, const TClass *onfile_class);
288  static void StreamerDefault(const TClass* pThis, void *object, TBuffer &b, const TClass *onfile_class);
289 
290  static IdMap_t *GetIdMap(); //Map from typeid to TClass pointer
291  static DeclIdMap_t *GetDeclIdMap(); //Map from DeclId_t to TClass pointer
292  static std::atomic<Int_t> fgClassCount; //provides unique id for a each class
293  //stored in TObject::fUniqueID
294  static TDeclNameRegistry fNoInfoOrEmuOrFwdDeclNameRegistry; // Store decl names of the forwardd and no info instances
295  static Bool_t HasNoInfoOrEmuOrFwdDeclaredDecl(const char*);
296 
297  // Internal status bits, set and reset only during initialization and thus under the protection of the global lock.
298  enum { kLoading = kReservedLoading, kUnloading = kReservedLoading };
299  // Internal streamer type.
300  enum EStreamerType {kDefault=0, kEmulatedStreamer=1, kTObject=2, kInstrumented=4, kForeign=8, kExternal=16};
301 
302  // When a new class is created, we need to be able to find
303  // if there are any existing classes that have the same name
304  // after any typedefs are expanded. (This only really affects
305  // template arguments.) To avoid having to search through all classes
306  // in that case, we keep a hash table mapping from the fully
307  // typedef-expanded names to the original class names.
308  // An entry is made in the table only if they are actually different.
309  //
310  // In these objects, the TObjString base holds the typedef-expanded
311  // name (the hash key), and fOrigName holds the original class name
312  // (the value to which the key maps).
313  //
314  class TNameMapNode : public TObjString
315  {
316  public:
317  TNameMapNode (const char* typedf, const char* orig);
319  };
320 
321  // These are the above-referenced hash tables. (The pointers are null
322  // if no entries have been made.)
324 
325 private:
326  TClass(const TClass& tc) = delete;
327  TClass& operator=(const TClass&) = delete;
328 
329 protected:
330  TVirtualStreamerInfo *FindStreamerInfo(TObjArray *arr, UInt_t checksum) const;
331  void GetMissingDictionariesForBaseClasses(TCollection &result, TCollection &visited, bool recurse);
332  void GetMissingDictionariesForMembers(TCollection &result, TCollection &visited, bool recurse);
333  void GetMissingDictionariesWithRecursionCheck(TCollection &result, TCollection &visited, bool recurse);
334  void GetMissingDictionariesForPairElements(TCollection &result, TCollection &visited, bool recurse);
335 
336 public:
337  TClass();
338  TClass(const char *name, Bool_t silent = kFALSE);
339  TClass(const char *name, Version_t cversion, Bool_t silent = kFALSE);
340  TClass(const char *name, Version_t cversion, EState theState, Bool_t silent = kFALSE);
341  TClass(ClassInfo_t *info, Version_t cversion,
342  const char *dfil, const char *ifil = 0,
343  Int_t dl = 0, Int_t il = 0, Bool_t silent = kFALSE);
344  TClass(const char *name, Version_t cversion,
345  const char *dfil, const char *ifil = 0,
346  Int_t dl = 0, Int_t il = 0, Bool_t silent = kFALSE);
347  TClass(const char *name, Version_t cversion,
348  const std::type_info &info, TVirtualIsAProxy *isa,
349  const char *dfil, const char *ifil,
350  Int_t dl, Int_t il, Bool_t silent = kFALSE);
351  virtual ~TClass();
352 
353  void AddInstance(Bool_t heap = kFALSE) { fInstanceCount++; if (heap) fOnHeap++; }
354  void AddImplFile(const char *filename, int line);
355  static Bool_t AddRule(const char *rule);
356  static Int_t ReadRules(const char *filename);
357  static Int_t ReadRules();
358  void AdoptSchemaRules( ROOT::Detail::TSchemaRuleSet *rules );
359  virtual void Browse(TBrowser *b);
360  void BuildRealData(void *pointer=0, Bool_t isTransient = kFALSE);
361  void BuildEmulatedRealData(const char *name, Long_t offset, TClass *cl);
362  void CalculateStreamerOffset() const;
363  Bool_t CallShowMembers(const void* obj, TMemberInspector &insp, Bool_t isTransient = kFALSE) const;
364  Bool_t CanSplit() const;
365  Bool_t CanIgnoreTObjectStreamer() { return TestBit(kIgnoreTObjectStreamer);}
366  Long_t ClassProperty() const;
367  TObject *Clone(const char *newname="") const;
368  void CopyCollectionProxy(const TVirtualCollectionProxy&);
369  void Draw(Option_t *option="");
370  void Dump() const { TDictionary::Dump(); }
371  void Dump(const void *obj, Bool_t noAddr = kFALSE) const;
372  char *EscapeChars(const char *text) const;
373  TVirtualStreamerInfo *FindStreamerInfo(UInt_t checksum) const;
374  TVirtualStreamerInfo *GetConversionStreamerInfo( const char* onfile_classname, Int_t version ) const;
375  TVirtualStreamerInfo *FindConversionStreamerInfo( const char* onfile_classname, UInt_t checksum ) const;
376  TVirtualStreamerInfo *GetConversionStreamerInfo( const TClass* onfile_cl, Int_t version ) const;
377  TVirtualStreamerInfo *FindConversionStreamerInfo( const TClass* onfile_cl, UInt_t checksum ) const;
378  Bool_t HasDataMemberInfo() const { return fHasRootPcmInfo || HasInterpreterInfo(); }
379  Bool_t HasDefaultConstructor() const;
380  Bool_t HasInterpreterInfoInMemory() const { return 0 != fClassInfo; }
381  Bool_t HasInterpreterInfo() const { return fCanLoadClassInfo || fClassInfo; }
382  UInt_t GetCheckSum(ECheckSum code = kCurrentCheckSum) const;
383  UInt_t GetCheckSum(Bool_t &isvalid) const;
384  UInt_t GetCheckSum(ECheckSum code, Bool_t &isvalid) const;
385  TVirtualCollectionProxy *GetCollectionProxy() const;
386  TVirtualIsAProxy *GetIsAProxy() const;
387  TMethod *GetClassMethod(const char *name, const char *params, Bool_t objectIsConst = kFALSE);
388  TMethod *GetClassMethodWithPrototype(const char *name, const char *proto,
389  Bool_t objectIsConst = kFALSE,
391  Version_t GetClassVersion() const { fVersionUsed = kTRUE; return fClassVersion; }
392  Int_t GetClassSize() const { return Size(); }
393  TDataMember *GetDataMember(const char *datamember) const;
394  Long_t GetDataMemberOffset(const char *membername) const;
395  const char *GetDeclFileName() const { return fDeclFileName; }
396  Short_t GetDeclFileLine() const { return fDeclFileLine; }
397  ROOT::DelFunc_t GetDelete() const;
398  ROOT::DesFunc_t GetDestructor() const;
399  ROOT::DelArrFunc_t GetDeleteArray() const;
400  ClassInfo_t *GetClassInfo() const {
401  if (fCanLoadClassInfo && !TestBit(kLoading))
402  LoadClassInfo();
403  return fClassInfo;
404  }
405  const char *GetContextMenuTitle() const { return fContextMenuTitle; }
407  if (fCurrentInfo.load()) return fCurrentInfo;
408  else return DetermineCurrentStreamerInfo();
409  }
410  TVirtualStreamerInfo *GetLastReadInfo() const { return fLastReadInfo; }
411  void SetLastReadInfo(TVirtualStreamerInfo *info) { fLastReadInfo = info; }
412  TList *GetListOfDataMembers(Bool_t load = kTRUE);
413  TList *GetListOfEnums(Bool_t load = kTRUE);
414  TList *GetListOfFunctionTemplates(Bool_t load = kTRUE);
415  TList *GetListOfBases();
417  TCollection *GetListOfMethodOverloads(const char* name) const;
418  TList *GetListOfRealData() const { return fRealData; }
419  const TList *GetListOfAllPublicMethods(Bool_t load = kTRUE);
420  TList *GetListOfAllPublicDataMembers(Bool_t load = kTRUE);
421  const char *GetImplFileName() const { return fImplFileName; }
422  Short_t GetImplFileLine() const { return fImplFileLine; }
423  TClass *GetActualClass(const void *object) const;
424  TClass *GetBaseClass(const char *classname);
425  TClass *GetBaseClass(const TClass *base);
426  Int_t GetBaseClassOffset(const TClass *toBase, void *address = 0, bool isDerivedObject = true);
427  TClass *GetBaseDataMember(const char *datamember);
428  ROOT::ESTLType GetCollectionType() const;
429  ROOT::DirAutoAdd_t GetDirectoryAutoAdd() const;
430  TFunctionTemplate *GetFunctionTemplate(const char *name);
431  UInt_t GetInstanceCount() const { return fInstanceCount; }
432  UInt_t GetHeapInstanceCount() const { return fOnHeap; }
433  void GetMenuItems(TList *listitems);
434  TList *GetMenuList() const;
435  TMethod *GetMethod(const char *method, const char *params, Bool_t objectIsConst = kFALSE);
436  TMethod *GetMethodWithPrototype(const char *method, const char *proto, Bool_t objectIsConst = kFALSE,
438  TMethod *GetMethodAny(const char *method);
439  TMethod *GetMethodAllAny(const char *method);
440  Int_t GetNdata();
441  ROOT::MergeFunc_t GetMerge() const;
442  ROOT::ResetAfterMergeFunc_t GetResetAfterMerge() const;
443  ROOT::NewFunc_t GetNew() const;
444  ROOT::NewArrFunc_t GetNewArray() const;
445  Int_t GetNmethods();
446  TClass *const*GetPersistentRef() const { return fPersistentRef; }
447  TRealData *GetRealData(const char *name) const;
448  TVirtualRefProxy *GetReferenceProxy() const { return fRefProxy; }
449  const ROOT::Detail::TSchemaRuleSet *GetSchemaRules() const;
450  ROOT::Detail::TSchemaRuleSet *GetSchemaRules(Bool_t create = kFALSE);
451  const char *GetSharedLibs();
452  ShowMembersFunc_t GetShowMembersWrapper() const { return fShowMembers; }
453  EState GetState() const { return fState; }
454  TClassStreamer *GetStreamer() const;
455  ClassStreamerFunc_t GetStreamerFunc() const;
456  ClassConvStreamerFunc_t GetConvStreamerFunc() const;
457  const TObjArray *GetStreamerInfos() const { return fStreamerInfo; }
458  TVirtualStreamerInfo *GetStreamerInfo(Int_t version=0) const;
459  TVirtualStreamerInfo *GetStreamerInfoAbstractEmulated(Int_t version=0) const;
460  TVirtualStreamerInfo *FindStreamerInfoAbstractEmulated(UInt_t checksum) const;
461  const std::type_info *GetTypeInfo() const { return fTypeInfo; };
462 
463  /// @brief Return 'true' if we can guarantee that if this class (or any class in
464  /// this class inheritance hierarchy) overload TObject::Hash it also starts
465  /// the RecursiveRemove process from its own destructor.
467  {
468  if (!fRuntimeProperties)
469  SetRuntimeProperties();
470  return fRuntimeProperties.load() & ERuntimeProperties::kConsistentHash;
471  }
472  Bool_t HasDictionary() const;
473  static Bool_t HasDictionarySelection(const char* clname);
474  Bool_t HasLocalHashMember() const;
475  void GetMissingDictionaries(THashTable& result, bool recurse = false);
476  void IgnoreTObjectStreamer(Bool_t ignore=kTRUE);
477  Bool_t InheritsFrom(const char *cl) const;
478  Bool_t InheritsFrom(const TClass *cl) const;
479  void InterpretedShowMembers(void* obj, TMemberInspector &insp, Bool_t isTransient);
480  Bool_t IsFolder() const { return kTRUE; }
481  Bool_t IsLoaded() const;
482  Bool_t IsForeign() const;
483  Bool_t IsStartingWithTObject() const;
484  Bool_t IsVersioned() const { return !( GetClassVersion()<=1 && IsForeign() ); }
485  Bool_t IsTObject() const;
486  static TClass *LoadClass(const char *requestedname, Bool_t silent);
487  void ls(Option_t *opt="") const;
488  void MakeCustomMenuList();
489  Bool_t MatchLegacyCheckSum(UInt_t checksum) const;
490  void Move(void *arenaFrom, void *arenaTo) const;
491  void *New(ENewType defConstructor = kClassNew, Bool_t quiet = kFALSE) const;
492  void *New(void *arena, ENewType defConstructor = kClassNew) const;
493  void *NewArray(Long_t nElements, ENewType defConstructor = kClassNew) const;
494  void *NewArray(Long_t nElements, void *arena, ENewType defConstructor = kClassNew) const;
495  virtual void PostLoadCheck();
496  Long_t Property() const;
497  Int_t ReadBuffer(TBuffer &b, void *pointer, Int_t version, UInt_t start, UInt_t count);
498  Int_t ReadBuffer(TBuffer &b, void *pointer);
499  void RegisterStreamerInfo(TVirtualStreamerInfo *info);
500  void RemoveStreamerInfo(Int_t slot);
501  void ReplaceWith(TClass *newcl) const;
502  void ResetCaches();
503  void ResetClassInfo(Long_t tagnum);
504  void ResetClassInfo();
505  void ResetInstanceCount() { fInstanceCount = fOnHeap = 0; }
506  void ResetMenuList();
507  Int_t Size() const;
508  void SetCanSplit(Int_t splitmode);
509  void SetCollectionProxy(const ROOT::Detail::TCollectionProxyInfo&);
510  void SetContextMenuTitle(const char *title);
511  void SetCurrentStreamerInfo(TVirtualStreamerInfo *info);
512  void SetGlobalIsA(IsAGlobalFunc_t);
513  void SetDeclFile(const char *name, int line) { fDeclFileName = name; fDeclFileLine = line; }
514  void SetDelete(ROOT::DelFunc_t deleteFunc);
515  void SetDeleteArray(ROOT::DelArrFunc_t deleteArrayFunc);
516  void SetDirectoryAutoAdd(ROOT::DirAutoAdd_t dirAutoAddFunc);
517  void SetDestructor(ROOT::DesFunc_t destructorFunc);
518  void SetImplFileName(const char *implFileName) { fImplFileName = implFileName; }
519  void SetMerge(ROOT::MergeFunc_t mergeFunc);
520  void SetResetAfterMerge(ROOT::ResetAfterMergeFunc_t resetFunc);
521  void SetNew(ROOT::NewFunc_t newFunc);
522  void SetNewArray(ROOT::NewArrFunc_t newArrayFunc);
523  TVirtualStreamerInfo *SetStreamerInfo(Int_t version, const char *info="");
524  void SetUnloaded();
525  Int_t WriteBuffer(TBuffer &b, void *pointer, const char *info="");
526 
527  void AdoptReferenceProxy(TVirtualRefProxy* proxy);
528  void AdoptStreamer(TClassStreamer *strm);
529  void AdoptMemberStreamer(const char *name, TMemberStreamer *strm);
530  void SetMemberStreamer(const char *name, MemberStreamerFunc_t strm);
531  void SetStreamerFunc(ClassStreamerFunc_t strm);
532  void SetConvStreamerFunc(ClassConvStreamerFunc_t strm);
533 
534  // Function to retrieve the TClass object and dictionary function
535  static void AddClass(TClass *cl);
536  static void AddClassToDeclIdMap(TDictionary::DeclId_t id, TClass* cl);
537  static void RemoveClass(TClass *cl);
538  static void RemoveClassDeclId(TDictionary::DeclId_t id);
539  static TClass *GetClass(const char *name, Bool_t load = kTRUE, Bool_t silent = kFALSE);
540  static TClass *GetClass(const std::type_info &typeinfo, Bool_t load = kTRUE, Bool_t silent = kFALSE);
541  static TClass *GetClass(ClassInfo_t *info, Bool_t load = kTRUE, Bool_t silent = kFALSE);
542  static Bool_t GetClass(DeclId_t id, std::vector<TClass*> &classes);
543  static DictFuncPtr_t GetDict (const char *cname);
544  static DictFuncPtr_t GetDict (const std::type_info &info);
545 
546  static Int_t AutoBrowse(TObject *obj, TBrowser *browser);
547  static ENewType IsCallingNew();
548  static TClass *Load(TBuffer &b);
549  void Store(TBuffer &b) const;
550 
551  // Pseudo-method apply to the 'obj'. In particular those are used to
552  // implement TObject like methods for non-TObject classes
553 
554  Int_t Browse(void *obj, TBrowser *b) const;
555  void DeleteArray(void *ary, Bool_t dtorOnly = kFALSE);
556  void Destructor(void *obj, Bool_t dtorOnly = kFALSE);
557  void *DynamicCast(const TClass *base, void *obj, Bool_t up = kTRUE);
558  const void *DynamicCast(const TClass *base, const void *obj, Bool_t up = kTRUE);
559  Bool_t IsFolder(void *obj) const;
560 
561  inline void Streamer(void *obj, TBuffer &b, const TClass *onfile_class = 0) const
562  {
563  // Inline for performance, skipping one function call.
564 #ifdef R__NO_ATOMIC_FUNCTION_POINTER
565  fStreamerImpl(this,obj,b,onfile_class);
566 #else
567  auto t = fStreamerImpl.load();
568  t(this,obj,b,onfile_class);
569 #endif
570  }
571 
572  ClassDef(TClass,0) //Dictionary containing class information
573 };
574 
575 namespace ROOT {
576 
577 template <typename T> TClass *GetClass(T * /* dummy */) { return TClass::GetClass(typeid(T)); }
578 template <typename T> TClass *GetClass(const T * /* dummy */) { return TClass::GetClass(typeid(T)); }
579 
580 #ifndef R__NO_CLASS_TEMPLATE_SPECIALIZATION
581  // This can only be used when the template overload resolution can distinguish between T* and T**
582  template <typename T> TClass* GetClass( T** /* dummy */) { return GetClass((T*)0); }
583  template <typename T> TClass* GetClass(const T** /* dummy */) { return GetClass((T*)0); }
584  template <typename T> TClass* GetClass( T* const* /* dummy */) { return GetClass((T*)0); }
585  template <typename T> TClass* GetClass(const T* const* /* dummy */) { return GetClass((T*)0); }
586 #endif
587 
588  extern TClass *CreateClass(const char *cname, Version_t id,
589  const char *dfil, const char *ifil,
590  Int_t dl, Int_t il);
591 }
592 
593 #endif // ROOT_TClass
void AddClass(const char *cname, Version_t id, const std::type_info &info, DictFuncPtr_t dict, Int_t pragmabits)
Global function called by the ctor of a class&#39;s init class (see the ClassImp macro).
Short_t GetImplFileLine() const
Definition: TClass.h:422
Bool_t operator &(const TBits::TReference &lhs, const TBits::TReference &rhs)
Definition: TBits.h:152
ShowMembersFunc_t fShowMembers
Definition: TClass.h:199
Bool_t HasInterpreterInfoInMemory() const
Definition: TClass.h:380
A collection of TDataMember objects designed for fast access given a DeclId_t and for keep track of T...
ESTLType
Definition: ESTLType.h:28
An array of TObjects.
Definition: TObjArray.h:37
ROOT::NewArrFunc_t fNewArray
Definition: TClass.h:210
void(* ClassStreamerFunc_t)(TBuffer &, void *)
Definition: Rtypes.h:65
std::atomic< TMethodCall * > fIsAMethod
Definition: TClass.h:205
const char * GetDeclFileName() const
Definition: TClass.h:395
void(* ShowMembersFunc_t)(const void *obj, TMemberInspector &R__insp, Bool_t isTransient)
Definition: Rtypes.h:91
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
short Version_t
Definition: RtypesCore.h:61
TLine * line
void(* DelArrFunc_t)(void *)
Definition: Rtypes.h:108
const char * GetImplFileName() const
Definition: TClass.h:421
Collectable string class.
Definition: TObjString.h:28
void SetDeclFile(const char *name, int line)
Definition: TClass.h:513
ConvSIMap_t fConversionStreamerInfo
Definition: TClass.h:174
Long64_t(* MergeFunc_t)(void *, TCollection *, TFileMergeInfo *)
Definition: Rtypes.h:111
const char Option_t
Definition: RtypesCore.h:62
Dictionary for function template This class describes one single function template.
All ROOT classes may have RTTI (run time type identification) support added.
Definition: TDataMember.h:31
const char * Size
Definition: TXMLSetup.cxx:55
A collection of TFunction objects designed for fast access given a DeclId_t and for keep track of TFu...
Short_t GetDeclFileLine() const
Definition: TClass.h:396
double T(double x)
Definition: ChebyshevPol.h:34
ENewType
Definition: TClass.h:101
T ReadBuffer(TBufferFile *buf)
One of the template functions used to read objects from messages.
Definition: MPSendRecv.h:157
std::atomic< TListOfEnums * > fEnums
Definition: TClass.h:179
TViewPubFunctions * fAllPubMethod
Definition: TClass.h:184
#define BIT(n)
Definition: Rtypes.h:78
Persistent version of a TClass.
Definition: TProtoClass.h:35
std::atomic< Bool_t > fHasRootPcmInfo
C++ Property of the class (is abstract, has virtual table, etc.)
Definition: TClass.h:224
static THashTable * fgClassTypedefHash
Definition: TClass.h:323
const std::type_info * GetTypeInfo() const
Definition: TClass.h:461
std::atomic< std::map< std::string, TObjArray * > * > ConvSIMap_t
Persistent address of pointer to this TClass object and its successors.
Definition: TClass.h:171
ROOT::DirAutoAdd_t fDirAutoAdd
Definition: TClass.h:214
Buffer base class used for serializing objects.
Definition: TBuffer.h:40
Bool_t HasInterpreterInfo() const
Definition: TClass.h:381
Basic string class.
Definition: TString.h:131
TString fContextMenuTitle
Definition: TClass.h:197
TVirtualStreamerInfo * GetCurrentStreamerInfo()
Definition: TClass.h:406
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TVirtualRefProxy * fRefProxy
cached streamer info used in the last read.
Definition: TClass.h:245
const char * GetContextMenuTitle() const
Definition: TClass.h:405
Int_t fStreamerType
saved info to call Streamer
Definition: TClass.h:241
Abstract base class for accessing the data-members of a class.
void SetImplFileName(const char *implFileName)
Definition: TClass.h:518
UInt_t GetHeapInstanceCount() const
Definition: TClass.h:432
const void * DeclId_t
Definition: TDictionary.h:205
std::atomic< Bool_t > fIsOffsetStreamerSet
Indicates whether the ClassInfo is supposed to be available.
Definition: TClass.h:226
std::atomic< TVirtualStreamerInfo * > fLastReadInfo
cached current streamer info.
Definition: TClass.h:244
void SetClassSize(Int_t sizof)
Definition: TClass.h:273
Short_t fImplFileLine
Definition: TClass.h:190
ROOT::NewFunc_t fNew
Definition: TClass.h:209
void ResetInstanceCount()
Definition: TClass.h:505
void SetLastReadInfo(TVirtualStreamerInfo *info)
Definition: TClass.h:411
TDeclNameRegistry & fNoInfoOrEmuOrFwdDeclNameRegistry
Definition: TClass.h:152
TClass * GetClass(T *)
Definition: TClass.h:577
THashTable implements a hash table to store TObject&#39;s.
Definition: THashTable.h:35
#define ClassDef(name, id)
Definition: Rtypes.h:320
void Dump() const
Dump contents of object on stdout.
Definition: TClass.h:370
std::atomic< TList * > fBase
Definition: TClass.h:176
ClassStreamerFunc_t fStreamerFunc
Definition: TClass.h:215
ECheckSum
Definition: TClass.h:102
void Init(TClassEdit::TInterpreterLookupHelper *helper)
Definition: TClassEdit.cxx:121
void(* MemberStreamerFunc_t)(TBuffer &, void *, Int_t)
Definition: Rtypes.h:67
ROOT::ResetAfterMergeFunc_t fResetAfterMerge
Definition: TClass.h:208
EFunctionMatchMode
Definition: TDictionary.h:151
EState GetState() const
Definition: TClass.h:453
ClassInfo_t * GetClassInfo() const
Definition: TClass.h:400
void *(* NewFunc_t)(void *)
Definition: Rtypes.h:105
Method or function calling interface.
Definition: TMethodCall.h:37
std::atomic< Bool_t > fVersionUsed
saved remember if fOffsetStreamer has been set.
Definition: TClass.h:227
TListOfFunctionTemplates * fFuncTemplate
Definition: TClass.h:180
TClass *(* DictFuncPtr_t)()
Definition: Rtypes.h:73
const TObjArray * GetStreamerInfos() const
Definition: TClass.h:457
TViewPubDataMembers * fAllPubData
Definition: TClass.h:183
TList * fClassMenuList
Definition: TClass.h:185
ROOT::Detail::TSchemaRuleSet * fSchemaRules
Pointer to reference proxy if this class represents a reference.
Definition: TClass.h:246
void(* ClassConvStreamerFunc_t)(TBuffer &, void *, const TClass *)
Definition: Rtypes.h:66
std::atomic< StreamerImpl_t > fStreamerImpl
Definition: TClass.h:252
TList * fRealData
Definition: TClass.h:175
TCppMethod_t GetMethod(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:727
EStreamerType
Definition: TClass.h:300
A doubly linked list.
Definition: TList.h:44
View implementing the TList interface and giving access all the TDictionary describing public data me...
const char * fImplFileName
Definition: TClass.h:188
TCppType_t GetActualClass(TCppType_t klass, TCppObject_t obj)
Definition: Cppyy.cxx:207
void(* ResetAfterMergeFunc_t)(void *, TFileMergeInfo *)
Definition: Rtypes.h:112
ShowMembersFunc_t GetShowMembersWrapper() const
Definition: TClass.h:452
void AddInstance(Bool_t heap=kFALSE)
Definition: TClass.h:353
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
Int_t fCanSplit
Definition: TClass.h:219
th1 Draw()
std::atomic< TVirtualStreamerInfo * > fCurrentInfo
Current &#39;state&#39; of the class (Emulated,Interpreted,Loaded)
Definition: TClass.h:243
void ResetClassVersion(TClass *, const char *, Short_t)
Global function to update the version number.
void *(* NewArrFunc_t)(Long_t size, void *arena)
Definition: Rtypes.h:106
TString fOrigName
Definition: TClass.h:318
ROOT::R::TRInterface & r
Definition: Object.C:4
UInt_t GetInstanceCount() const
Definition: TClass.h:431
void RemoveClass(const char *cname)
Global function called by the dtor of a class&#39;s init class (see the ClassImp macro).
TVirtualStreamerInfo * GetLastReadInfo() const
Definition: TClass.h:410
This class defines an abstract interface that must be implemented by all classes that contain diction...
Definition: TDictionary.h:158
Collection abstract base class.
Definition: TCollection.h:63
unsigned int UInt_t
Definition: RtypesCore.h:42
TClass * CreateClass(const char *cname, Version_t id, const std::type_info &info, TVirtualIsAProxy *isa, const char *dfil, const char *ifil, Int_t dl, Int_t il)
Global function called by a class&#39; static Dictionary() method (see the ClassDef macro).
Definition: TClass.cxx:5599
short Short_t
Definition: RtypesCore.h:35
The TRealData class manages the effective list of all data members for a given class.
Definition: TRealData.h:30
Bool_t CanIgnoreTObjectStreamer()
Definition: TClass.h:365
TClass *const * GetPersistentRef() const
Definition: TClass.h:446
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:75
TVirtualCollectionProxy * fCollectionProxy
Definition: TClass.h:194
ROOT::TMapTypeToTClass IdMap_t
Definition: TClass.h:72
std::atomic< UChar_t > fRuntimeProperties
Definition: TClass.h:238
UInt_t fInstanceCount
Definition: TClass.h:191
TVirtualRefProxy * GetReferenceProxy() const
Definition: TClass.h:448
void Streamer(void *obj, TBuffer &b, const TClass *onfile_class=0) const
Definition: TClass.h:561
UInt_t fOnHeap
Definition: TClass.h:192
Each class (see TClass) has a linked list of its base class(es).
Definition: TBaseClass.h:33
Bool_t HasConsistentHashMember()
Return &#39;true&#39; if we can guarantee that if this class (or any class in this class inheritance hierarch...
Definition: TClass.h:466
View implementing the TList interface and giving access all the TFunction describing public methods i...
Short_t SetClassVersion(RootClass *)
const Bool_t kFALSE
Definition: RtypesCore.h:88
ROOT::DesFunc_t fDestructor
Definition: TClass.h:213
std::atomic_flag fSpinLock
Definition: TClass.h:145
Int_t fSizeof
Definition: TClass.h:217
std::unordered_set< std::string > fClassNamesSet
Definition: TClass.h:144
long Long_t
Definition: RtypesCore.h:50
std::atomic< TListOfFunctions * > fMethod
Definition: TClass.h:181
ROOT::DelArrFunc_t fDeleteArray
Definition: TClass.h:212
Version_t GetClassVersion() const
Definition: TClass.h:391
UInt_t GetListOfMethods(TList &methods, TDirectory *dir=0)
Definition: tmvaglob.cxx:583
TObjArray * fStreamerInfo
Definition: TClass.h:173
std::atomic< TClass ** > fPersistentRef
Definition: TClass.h:169
Long_t fOffsetStreamer
Properties that can only be evaluated at run-time.
Definition: TClass.h:240
EState fState
cached of the streaming method to use
Definition: TClass.h:242
TText * text
ROOT::DelFunc_t fDelete
Definition: TClass.h:211
EStatusBits
Definition: TObject.h:57
TList * GetListOfRealData() const
Definition: TClass.h:418
Bool_t HasDataMemberInfo() const
Definition: TClass.h:378
virtual void Dump() const
Dump contents of object on stdout.
Definition: TObject.cxx:266
const std::type_info * fTypeInfo
Definition: TClass.h:198
static TDeclNameRegistry fNoInfoOrEmuOrFwdDeclNameRegistry
Definition: TClass.h:294
TClass *(* IsAGlobalFunc_t)(const TClass *, const void *obj)
Definition: Rtypes.h:93
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition: TClass.cxx:2887
TVirtualIsAProxy * fIsA
Definition: TClass.h:203
std::atomic< Long_t > fProperty
Indicates whether this class can be split or not.
Definition: TClass.h:220
IsAGlobalFunc_t fGlobalIsA
pointer to the class&#39;s IsA proxy.
Definition: TClass.h:204
ROOT::TMapDeclIdToTClass DeclIdMap_t
Definition: TClass.h:73
Binding & operator=(OUT(*fun)(void))
Long_t fClassProperty
Property.
Definition: TClass.h:221
Int_t GetClassSize() const
Definition: TClass.h:392
Mother of all ROOT objects.
Definition: TObject.h:37
Short_t fDeclFileLine
Definition: TClass.h:189
void(* DelFunc_t)(void *)
Definition: Rtypes.h:107
Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects)...
Definition: TClass.h:480
static std::atomic< Int_t > fgClassCount
Definition: TClass.h:292
typedef void((*Func_t)())
Version_t fClassVersion
Definition: TClass.h:195
TString fSharedLibs
Definition: TClass.h:201
std::atomic< UInt_t > fCheckSum
Definition: TClass.h:193
TListOfDataMembers * fData
Definition: TClass.h:177
A collection of TEnum objects designed for fast access given a DeclId_t and for keep track of TEnum t...
Definition: TListOfEnums.h:32
ClassInfo_t * fClassInfo
Definition: TClass.h:196
auto * l
Definition: textangle.C:4
void(* DirAutoAdd_t)(void *, TDirectory *)
Definition: Rtypes.h:110
Bool_t IsVersioned() const
Definition: TClass.h:484
Each ROOT class (see TClass) has a linked list of methods.
Definition: TMethod.h:38
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
ClassConvStreamerFunc_t fConvStreamerFunc
Definition: TClass.h:216
const char * proto
Definition: civetweb.c:15049
const char * fDeclFileName
Definition: TClass.h:187
TClassStreamer * fStreamer
Definition: TClass.h:200
std::atomic< Bool_t > fCanLoadClassInfo
Whether info was loaded from a root pcm.
Definition: TClass.h:225
unsigned char UChar_t
Definition: RtypesCore.h:34
A collection of TFunction objects designed for fast access given a DeclId_t and for keep track of TFu...
Abstract Interface class describing Streamer information for one class.
const Bool_t kTRUE
Definition: RtypesCore.h:87
char name[80]
Definition: TGX11.cxx:109
ERuntimeProperties
Indicates whether GetClassVersion has been called.
Definition: TClass.h:229
ROOT::MergeFunc_t fMerge
saved info to call a IsA member function
Definition: TClass.h:207
EState
Definition: TClass.h:115
void(* DesFunc_t)(void *)
Definition: Rtypes.h:109