ATLAS Offline Software
RootType.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef DATAMODELROOT_ROOT_TYPE_H
6 #define DATAMODELROOT_ROOT_TYPE_H
7 
8 // Standard
9 #include <string>
10 
11 // ROOT
12 #include "TClassRef.h"
13 class TMethod;
14 class TFunction;
15 class TMethodArg;
16 
18 
19 #define ROOT_6
20 
21 namespace Reflex {
22 
25  FINAL = (1<<0),
26  QUALIFIED = (1<<1),
27  SCOPED = (1<<2),
28  };
29 
30 } // namespace Reflex
31 
32 
33 class TScopeAdapter;
35 
36 
38 public:
39  TPropertyListAdapter( TDictAttributeMap* dam ) : fAttributes( dam ) {}
40 
41 public:
42  Bool_t HasProperty( const std::string& key ) const;
43  std::string PropertyAsString(const std::string& key) const;
44 
45 private:
46  TDictAttributeMap* fAttributes;
47 };
48 
50 public:
51  TReturnTypeAdapter( const std::string& name ) : fName( name ) {}
52 
53  std::string Name( unsigned int mod = 0 ) const;
54 
55 private:
56  std::string fName;
57 };
58 
59 
61 public:
62  TMemberAdapter( TMethod* meth );
63  operator TMethod*() const;
64 
65  TMemberAdapter( TFunction* func );
66  operator TFunction*() const;
67 
68  TMemberAdapter( TDataMember* mb );
69  operator TDataMember*() const;
70 
71  TMemberAdapter( TMethodArg* ma );
72  operator TMethodArg*() const;
73 
74  operator Bool_t() const { return fMember != 0; }
75 
76 public:
77  std::string Name( unsigned int mod = 0 ) const;
78 
79  const char* GetSharedLibs() const;
80  size_t Offset() const;
81 
82  Bool_t IsConstant() const;
83  Bool_t IsConstructor() const;
84  Bool_t IsEnum() const;
85  Bool_t IsPublic() const;
86  Bool_t IsStatic() const;
87  Bool_t IsTransient() const;
88 
89  size_t FunctionParameterSize( Bool_t required = false ) const;
90  TMemberAdapter FunctionParameterAt( size_t nth );
91  std::string FunctionParameterNameAt( size_t nth );
92  std::string FunctionParameterDefaultAt( size_t nth );
93 
95  TScopeAdapter DeclaringScope ATLAS_NOT_THREAD_SAFE () const;
96  TTypeAdapter DeclaringType ATLAS_NOT_THREAD_SAFE () const;
97  TTypeAdapter TypeOf() const;
98 
99 private:
100  TDictionary* fMember;
101 };
102 
103 
105 public:
106  TBaseAdapter( TBaseClass* base ) : fBase( base ) {}
107  operator Bool_t() const { return fBase != 0; }
108 
109 public:
110  std::string Name() const;
111 
113 
114 private:
115  TBaseClass* fBase;
116 };
117 
118 
120 public:
121  TScopeAdapter();
122  TScopeAdapter( TClass* klass );
123  TScopeAdapter( const std::string& name, Bool_t load = kTRUE );
124  ATLAS_NOT_THREAD_SAFE TScopeAdapter( const std::string& name, Bool_t load, Bool_t quiet );
125  TScopeAdapter( const TMemberAdapter& );
126  TScopeAdapter( const std::type_info &typeinfo );
127  operator TClass*() const { return fClass.GetClass(); }
128  operator Bool_t() const;
129 
130 public:
132  const std::string& name, Bool_t load = kTRUE, Bool_t quiet = kTRUE );
134  const std::string& name, Bool_t load = kTRUE );
135 
136  static TScopeAdapter TypeAt( size_t nth );
137  static size_t TypeSize ();
138 
139 public:
140  std::string Name( unsigned int mod = Reflex::SCOPED ) const;
142 
143  void *Construct() const ;
144  void *Construct(void *place) const;
145  void Destruct(void *place) const;
146 
147  const std::type_info& TypeInfo() const;
149 
150  Bool_t IsPointer() const;
151  Bool_t IsTemplateInstance() const;
152  Bool_t IsTopScope() const;
153  Bool_t IsFundamental() const;
154  Bool_t IsEnum() const;
155  Bool_t IsTypedef() const;
156  Bool_t IsArray() const;
157 
158  TBaseAdapter BaseAt( size_t nth ) const;
159  size_t BaseSize() const;
160 
161  size_t SizeOf() const;
162 
163  TMemberAdapter FunctionMemberAt( size_t nth ) const;
164  size_t FunctionMemberSize() const;
165 
166  TMemberAdapter DataMemberAt( size_t nth ) const;
167  size_t DataMemberSize() const;
168 
169  TScopeAdapter TemplateArgumentAt( size_t nth ) const;
170  size_t TemplateArgumentSize() const;
171 
172 public:
173  Bool_t IsComplete() const;
174 
175  Bool_t IsClass() const;
176  Bool_t IsStruct() const;
177  Bool_t IsNamespace() const;
178 
179  // note: in Reflex, part of Type, not Scope
180  Bool_t IsAbstract() const;
181 
182  void* Id() const { return fClass.GetClass(); }
183  TClass* Class() const { return fClass.GetClass(); }
184 
185  TTypeAdapter ToType() const { return *this; }
186  TScopeAdapter TypeOf() const { return *this; }
187 
188  // for STL containers
189  bool operator==( const TScopeAdapter& rh ) const;
190  bool operator!=( const TScopeAdapter& rh ) const {
191  return ! (*this == rh);
192  }
193  bool operator<( const TScopeAdapter& rh ) const;
194 
195  // Noop in ROOT6
196  static void EnableCintex() {}
197 
198 private:
199  void Init ( const std::string& name, Bool_t load, Bool_t quiet );
200 
201  std::string fName;
202  TClassRef fClass;
203  bool fIsFundamental = false;
204 };
205 
206 
212 
213 
214 #endif // !DATAMODELROOT_ROOT_TYPE_H
TScopeAdapter::TemplateArgumentAt
TScopeAdapter TemplateArgumentAt(size_t nth) const
Definition: RootType.cxx:814
base
std::string base
Definition: hcg.cxx:78
TScopeAdapter::DataMemberSize
size_t DataMemberSize() const
Definition: RootType.cxx:797
TScopeAdapter::IsStruct
Bool_t IsStruct() const
Definition: RootType.cxx:926
TScopeAdapter::TScopeAdapter
TScopeAdapter()
Definition: RootType.cxx:372
TScopeAdapter::IsTemplateInstance
Bool_t IsTemplateInstance() const
Definition: RootType.cxx:705
TMemberAdapter::TMemberAdapter
TMemberAdapter(TMethod *meth)
Definition: RootType.cxx:108
TScopeAdapter::ByNameNoQuiet
static TScopeAdapter ByNameNoQuiet(const std::string &name, Bool_t load=kTRUE)
Definition: RootType.cxx:581
Reflex::ENTITY_HANDLING
ENTITY_HANDLING
enum for printing names
Definition: RootType.h:24
TScopeAdapter::IsTopScope
Bool_t IsTopScope() const
Definition: RootType.cxx:720
TPropertyListAdapter::HasProperty
Bool_t HasProperty(const std::string &key) const
Definition: RootType.cxx:74
Reflex
Definition: RootType.h:21
TMemberAdapter::FunctionParameterNameAt
std::string FunctionParameterNameAt(size_t nth)
Definition: RootType.cxx:292
quiet
bool quiet
Definition: TrigGlobEffCorrValidation.cxx:190
TScopeAdapter::Properties
TPropertyListAdapter Properties() const
Definition: RootType.cxx:689
TPropertyListAdapter::TPropertyListAdapter
TPropertyListAdapter(TDictAttributeMap *dam)
Definition: RootType.h:39
RootPropertyList
TPropertyListAdapter RootPropertyList
Definition: RootType.h:209
TScopeAdapter::fIsFundamental
bool fIsFundamental
Definition: RootType.h:203
TMemberAdapter::IsConstructor
Bool_t IsConstructor() const
Definition: RootType.cxx:234
TScopeAdapter::fName
std::string fName
Definition: RootType.h:201
TBaseAdapter
Definition: RootType.h:104
TMemberAdapter::IsStatic
Bool_t IsStatic() const
Definition: RootType.cxx:255
TMemberAdapter::ATLAS_NOT_THREAD_SAFE
TTypeAdapter DeclaringType ATLAS_NOT_THREAD_SAFE() const
TScopeAdapter::DeclaringScope
TScopeAdapter DeclaringScope() const
Definition: RootType.cxx:650
TScopeAdapter::ToType
TTypeAdapter ToType() const
Definition: RootType.h:185
TScopeAdapter::EnableCintex
static void EnableCintex()
Definition: RootType.h:196
TMemberAdapter::FunctionParameterDefaultAt
std::string FunctionParameterDefaultAt(size_t nth)
Definition: RootType.cxx:304
TScopeAdapter::IsClass
Bool_t IsClass() const
Definition: RootType.cxx:911
RootType
TTypeAdapter RootType
Definition: RootType.h:211
klass
This class describe the base functionalities of a HypoTool used by the ComboAlg.
TScopeAdapter::TypeInfo
const std::type_info & TypeInfo() const
Definition: RootType.cxx:679
TMemberAdapter::IsConstant
Bool_t IsConstant() const
Definition: RootType.cxx:227
TScopeAdapter::operator==
bool operator==(const TScopeAdapter &rh) const
Definition: RootType.cxx:959
TMemberAdapter::TypeOf
TTypeAdapter TypeOf() const
Definition: RootType.cxx:160
TMemberAdapter
Definition: RootType.h:60
TMemberAdapter::ReturnType
TReturnTypeAdapter ReturnType() const
Definition: RootType.cxx:325
maskDeadModules.mod
mod
Definition: maskDeadModules.py:36
TScopeAdapter::TypeSize
static size_t TypeSize()
Definition: RootType.cxx:597
TReturnTypeAdapter::fName
std::string fName
Definition: RootType.h:56
TReturnTypeAdapter
Definition: RootType.h:49
RootDataMember
TMemberAdapter RootDataMember
Definition: RootType.h:208
TMemberAdapter::IsPublic
Bool_t IsPublic() const
Definition: RootType.cxx:248
Reflex::SCOPED
@ SCOPED
Definition: RootType.h:27
TScopeAdapter::TypeAt
static TScopeAdapter TypeAt(size_t nth)
Definition: RootType.cxx:588
TScopeAdapter::operator!=
bool operator!=(const TScopeAdapter &rh) const
Definition: RootType.h:190
TMemberAdapter::IsEnum
Bool_t IsEnum() const
Definition: RootType.cxx:241
TScopeAdapter::IsPointer
Bool_t IsPointer() const
Definition: RootType.cxx:697
TScopeAdapter::operator<
bool operator<(const TScopeAdapter &rh) const
Definition: RootType.cxx:966
TScopeAdapter::Construct
void * Construct() const
Definition: RootType.cxx:661
TScopeAdapter::Name
std::string Name(unsigned int mod=Reflex::SCOPED) const
Definition: RootType.cxx:607
perfmonmt-printer.required
required
Definition: perfmonmt-printer.py:184
TScopeAdapter::Id
void * Id() const
Definition: RootType.h:182
TScopeAdapter::FunctionMemberAt
TMemberAdapter FunctionMemberAt(size_t nth) const
Definition: RootType.cxx:790
RootBase
TBaseAdapter RootBase
Definition: RootType.h:207
TScopeAdapter::ATLAS_NOT_THREAD_SAFE
static TScopeAdapter ByName ATLAS_NOT_THREAD_SAFE(const std::string &name, Bool_t load=kTRUE, Bool_t quiet=kTRUE)
Reflex::FINAL
@ FINAL
Definition: RootType.h:25
TBaseAdapter::fBase
TBaseClass * fBase
Definition: RootType.h:115
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
TPropertyListAdapter
Definition: RootType.h:37
TPropertyListAdapter::fAttributes
TDictAttributeMap * fAttributes
Definition: RootType.h:46
TScopeAdapter::FunctionMemberSize
size_t FunctionMemberSize() const
Definition: RootType.cxx:780
RootScope
TScopeAdapter RootScope
Definition: RootType.h:210
TMemberAdapter::fMember
TDictionary * fMember
Definition: RootType.h:100
TMemberAdapter::Name
std::string Name(unsigned int mod=0) const
Definition: RootType.cxx:187
TScopeAdapter::IsFundamental
Bool_t IsFundamental() const
Definition: RootType.cxx:726
TMemberAdapter::IsTransient
Bool_t IsTransient() const
Definition: RootType.cxx:262
TPropertyListAdapter::PropertyAsString
std::string PropertyAsString(const std::string &key) const
Definition: RootType.cxx:83
TBaseAdapter::TBaseAdapter
TBaseAdapter(TBaseClass *base)
Definition: RootType.h:106
TScopeAdapter::Init
void Init(const std::string &name, Bool_t load, Bool_t quiet)
Definition: RootType.cxx:514
PowhegPythia8EvtGen_H2a4X_ctauY.ma
int ma
Definition: PowhegPythia8EvtGen_H2a4X_ctauY.py:26
TBaseAdapter::Name
std::string Name() const
Definition: RootType.cxx:356
TMemberAdapter::FunctionParameterSize
size_t FunctionParameterSize(Bool_t required=false) const
Definition: RootType.cxx:271
TRT_PAI_physicsConstants::mb
const double mb
1mb to cm2
Definition: TRT_PAI_physicsConstants.h:15
TTypeAdapter
TScopeAdapter TTypeAdapter
Definition: RootType.h:33
TScopeAdapter::Destruct
void Destruct(void *place) const
Definition: RootType.cxx:672
TMemberAdapter::FunctionParameterAt
TMemberAdapter FunctionParameterAt(size_t nth)
Definition: RootType.cxx:285
Reflex::QUALIFIED
@ QUALIFIED
Definition: RootType.h:26
TScopeAdapter::IsAbstract
Bool_t IsAbstract() const
Definition: RootType.cxx:949
TScopeAdapter::TypeOf
TScopeAdapter TypeOf() const
Definition: RootType.h:186
TScopeAdapter::IsEnum
Bool_t IsEnum() const
Definition: RootType.cxx:733
TScopeAdapter::TemplateArgumentSize
size_t TemplateArgumentSize() const
Definition: RootType.cxx:852
TScopeAdapter::BaseSize
size_t BaseSize() const
Definition: RootType.cxx:749
TScopeAdapter::IsArray
Bool_t IsArray() const
Definition: RootType.cxx:743
python.root_pickle.load
def load(f, use_proxy=1, key=None)
Definition: root_pickle.py:476
TBaseAdapter::ATLAS_NOT_THREAD_SAFE
TScopeAdapter ToType ATLAS_NOT_THREAD_SAFE() const
TScopeAdapter::DataMemberAt
TMemberAdapter DataMemberAt(size_t nth) const
Definition: RootType.cxx:807
checker_macros.h
Define macros for attributes used to control the static checker.
TScopeAdapter::IsComplete
Bool_t IsComplete() const
Definition: RootType.cxx:890
TScopeAdapter::SizeOf
size_t SizeOf() const
Definition: RootType.cxx:760
TScopeAdapter::fClass
TClassRef fClass
Definition: RootType.h:202
TMemberAdapter::Offset
size_t Offset() const
Definition: RootType.cxx:219
TScopeAdapter::Class
TClass * Class() const
Definition: RootType.h:183
TScopeAdapter::IsTypedef
Bool_t IsTypedef() const
Definition: RootType.cxx:738
TMemberAdapter::GetSharedLibs
const char * GetSharedLibs() const
Definition: RootType.cxx:212
TReturnTypeAdapter::Name
std::string Name(unsigned int mod=0) const
Definition: RootType.cxx:92
TReturnTypeAdapter::TReturnTypeAdapter
TReturnTypeAdapter(const std::string &name)
Definition: RootType.h:51
TScopeAdapter::IsNamespace
Bool_t IsNamespace() const
Definition: RootType.cxx:939
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
TScopeAdapter
Definition: RootType.h:119
TScopeAdapter::BaseAt
TBaseAdapter BaseAt(size_t nth) const
Definition: RootType.cxx:773
TMemberAdapter::ATLAS_NOT_THREAD_SAFE
TScopeAdapter DeclaringScope ATLAS_NOT_THREAD_SAFE() const