ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
TMemberAdapter Class Reference

#include <RootType.h>

Collaboration diagram for TMemberAdapter:

Public Member Functions

 TMemberAdapter (TMethod *meth)
 
 operator TMethod * () const
 
 TMemberAdapter (TFunction *func)
 
 operator TFunction * () const
 
 TMemberAdapter (TDataMember *mb)
 
 operator TDataMember * () const
 
 TMemberAdapter (TMethodArg *ma)
 
 operator TMethodArg * () const
 
 operator Bool_t () const
 
std::string Name (unsigned int mod=0) const
 
const char * GetSharedLibs () const
 
size_t Offset () const
 
Bool_t IsConstant () const
 
Bool_t IsConstructor () const
 
Bool_t IsEnum () const
 
Bool_t IsPublic () const
 
Bool_t IsStatic () const
 
Bool_t IsTransient () const
 
size_t FunctionParameterSize (Bool_t required=false) const
 
TMemberAdapter FunctionParameterAt (size_t nth)
 
std::string FunctionParameterNameAt (size_t nth)
 
std::string FunctionParameterDefaultAt (size_t nth)
 
TReturnTypeAdapter ReturnType () const
 
TScopeAdapter DeclaringScope ATLAS_NOT_THREAD_SAFE () const
 
TTypeAdapter DeclaringType ATLAS_NOT_THREAD_SAFE () const
 
TTypeAdapter TypeOf () const
 

Private Attributes

TDictionary * fMember
 

Detailed Description

Definition at line 60 of file RootType.h.

Constructor & Destructor Documentation

◆ TMemberAdapter() [1/4]

TMemberAdapter::TMemberAdapter ( TMethod *  meth)

Definition at line 108 of file RootType.cxx.

108  : fMember( meth )
109 {
110  /* empty */
111 }

◆ TMemberAdapter() [2/4]

TMemberAdapter::TMemberAdapter ( TFunction *  func)

Definition at line 121 of file RootType.cxx.

121  : fMember( func )
122 {
123  /* empty */
124 }

◆ TMemberAdapter() [3/4]

TMemberAdapter::TMemberAdapter ( TDataMember *  mb)

Definition at line 134 of file RootType.cxx.

134  : fMember( mb )
135 {
136  /* empty */
137 }

◆ TMemberAdapter() [4/4]

TMemberAdapter::TMemberAdapter ( TMethodArg *  ma)

Definition at line 147 of file RootType.cxx.

147  : fMember( ma )
148 {
149  /* empty */
150 }

Member Function Documentation

◆ ATLAS_NOT_THREAD_SAFE() [1/2]

TScopeAdapter DeclaringScope TMemberAdapter::ATLAS_NOT_THREAD_SAFE ( ) const

◆ ATLAS_NOT_THREAD_SAFE() [2/2]

TTypeAdapter DeclaringType TMemberAdapter::ATLAS_NOT_THREAD_SAFE ( ) const

◆ FunctionParameterAt()

TMemberAdapter TMemberAdapter::FunctionParameterAt ( size_t  nth)

Definition at line 285 of file RootType.cxx.

286 {
287 // get the type info of the function parameter at position nth
288  return (TMethodArg*)((TFunction*)fMember)->GetListOfMethodArgs()->At( nth );
289 }

◆ FunctionParameterDefaultAt()

std::string TMemberAdapter::FunctionParameterDefaultAt ( size_t  nth)

Definition at line 304 of file RootType.cxx.

305 {
306 // get the default value, if available, of the function parameter at position nth
307  TMethodArg* arg = (TMethodArg*)((TFunction*)fMember)->GetListOfMethodArgs()->At( nth );
308  const char* def = arg->GetDefault();
309 
310  if ( ! def )
311  return "";
312 
313 // special case for strings: "some value" -> ""some value"
314  if ( strstr( ResolveTypedef( arg->GetTypeNormalizedName() ).c_str(), "char*" ) ) {
315  std::string sdef = "\"";
316  sdef += def;
317  sdef += "\"";
318  return sdef;
319  }
320 
321  return def;
322 }

◆ FunctionParameterNameAt()

std::string TMemberAdapter::FunctionParameterNameAt ( size_t  nth)

Definition at line 292 of file RootType.cxx.

293 {
294 // get the formal name, if available, of the function parameter at position nth
295  const char* name =
296  ((TMethodArg*)((TFunction*)fMember)->GetListOfMethodArgs()->At( nth ))->GetName();
297 
298  if ( name )
299  return name;
300  return "";
301 }

◆ FunctionParameterSize()

size_t TMemberAdapter::FunctionParameterSize ( Bool_t  required = false) const

Definition at line 271 of file RootType.cxx.

272 {
273 // get the total number of parameters that the adapted function/method takes
274  TFunction* func = (TFunction*)fMember;
275  if ( ! func )
276  return 0;
277 
278  if ( required == true )
279  return func->GetNargs() - func->GetNargsOpt();
280 
281  return func->GetNargs();
282 }

◆ GetSharedLibs()

const char * TMemberAdapter::GetSharedLibs ( ) const

Definition at line 212 of file RootType.cxx.

213 {
214 // return the shared libs corresponding to this classes (should be 'lib'?)
215  return gInterpreter->GetClassSharedLibs( Name().c_str() );
216 }

◆ IsConstant()

Bool_t TMemberAdapter::IsConstant ( ) const

Definition at line 227 of file RootType.cxx.

228 {
229 // test if the adapted member is a const method
230  return fMember->Property() & kIsConstMethod;
231 }

◆ IsConstructor()

Bool_t TMemberAdapter::IsConstructor ( ) const

Definition at line 234 of file RootType.cxx.

235 {
236 // test if the adapted member is a const method
237  return ((TFunction*)fMember) ? (((TFunction*)fMember)->ExtraProperty() & kIsConstructor) : kFALSE;
238 }

◆ IsEnum()

Bool_t TMemberAdapter::IsEnum ( ) const

Definition at line 241 of file RootType.cxx.

242 {
243 // test if the adapted member is of an enum type
244  return fMember->Property() & kIsEnum;
245 }

◆ IsPublic()

Bool_t TMemberAdapter::IsPublic ( ) const

Definition at line 248 of file RootType.cxx.

249 {
250 // test if the adapted member represents an public (data) member
251  return fMember->Property() & kIsPublic;
252 }

◆ IsStatic()

Bool_t TMemberAdapter::IsStatic ( ) const

Definition at line 255 of file RootType.cxx.

256 {
257 // test if the adapted member represents a class (data) member
258  return fMember->Property() & kIsStatic;
259 }

◆ IsTransient()

Bool_t TMemberAdapter::IsTransient ( ) const

Definition at line 262 of file RootType.cxx.

263 {
264 // test if the adapted member represents transient data
265  TDataMember* dm = (TDataMember*)*this;
266  return dm ? ! dm->IsPersistent() : kTRUE;
267 }

◆ Name()

std::string TMemberAdapter::Name ( unsigned int  mod = 0) const

Definition at line 187 of file RootType.cxx.

188 {
189 // return name of the type described by fMember
190  TMethodArg* arg = (TMethodArg*)*this;
191 
192  if ( arg ) {
193 
194  std::string name = arg->GetTypeNormalizedName();
195  if ( mod & Reflex::FINAL )
196  name = ResolveTypedef( name );
197 
198  if ( ! ( mod & Reflex::QUALIFIED ) )
199  name = UnqualifiedTypeName( name );
200 
201  return name;
202 
203  } else if ( mod & Reflex::FINAL )
204  return ResolveTypedef( fMember->GetName() );
205 
206  if ( fMember )
207  return fMember->GetName();
208  return "<unknown>"; // happens for classes w/o dictionary
209 }

◆ Offset()

size_t TMemberAdapter::Offset ( ) const

Definition at line 219 of file RootType.cxx.

220 {
221 // relative offset (instance data) or global pointer (static/global data
222  TDataMember* dm = (TDataMember*)*this;
223  return dm ? dm->GetOffsetCint() : 0;
224 }

◆ operator Bool_t()

TMemberAdapter::operator Bool_t ( ) const
inline

Definition at line 74 of file RootType.h.

74 { return fMember != 0; }

◆ operator TDataMember *()

TMemberAdapter::operator TDataMember * ( ) const

Definition at line 140 of file RootType.cxx.

141 {
142 // cast the adapter to a TDataMember* being adapted, returns 0 on failure
143  return dynamic_cast< TDataMember* >( const_cast< TDictionary* >( fMember ) );
144 }

◆ operator TFunction *()

TMemberAdapter::operator TFunction * ( ) const

Definition at line 127 of file RootType.cxx.

128 {
129 // cast the adapter to a TFunction* being adapted, returns 0 on failure
130  return dynamic_cast< TFunction* >( const_cast< TDictionary* >( fMember ) );
131 }

◆ operator TMethod *()

TMemberAdapter::operator TMethod * ( ) const

Definition at line 114 of file RootType.cxx.

115 {
116 // cast the adapter to a TMethod* being adapted, returns 0 on failure
117  return dynamic_cast< TMethod* >( const_cast< TDictionary* >( fMember ) );
118 }

◆ operator TMethodArg *()

TMemberAdapter::operator TMethodArg * ( ) const

Definition at line 153 of file RootType.cxx.

154 {
155 // cast the adapter to a TMethodArg* being adapted, returns 0 on failure
156  return dynamic_cast< TMethodArg* >( const_cast< TDictionary* >( fMember ) );
157 }

◆ ReturnType()

TReturnTypeAdapter TMemberAdapter::ReturnType ( ) const

Definition at line 325 of file RootType.cxx.

326 {
327 // get the return type of the wrapped function/method
328  return TReturnTypeAdapter( ((TFunction*)fMember)->GetReturnTypeNormalizedName() );
329 }

◆ TypeOf()

TTypeAdapter TMemberAdapter::TypeOf ( ) const

Definition at line 160 of file RootType.cxx.

161 {
162  // get the type of the data member
163  TDataMember* dataMember = (TDataMember*)*this;
164  if ( dataMember ) {
165  // MN: the only way to get the type is through the type name
166  TClass *tc = TClass::GetClass( dataMember->GetTypeName() );
167  //cout << "--- TMemberAdapter name=" << Name() << endl;
168  if( tc ) {
169  //cout << " type = " << tc->GetName() << endl;
170  return TTypeAdapter(tc);
171  } else {
172  //cout << " typename = " << dataMember->GetTypeName() << endl;
173  return TTypeAdapter(dataMember->GetTypeName());
174  }
175  }
176 
177  // get type of the function/method
178  TMethod* method = (TMethod*)*this;
179  if ( method )
180  return method->GetClass();
181 
182  return TTypeAdapter();
183 }

Member Data Documentation

◆ fMember

TDictionary* TMemberAdapter::fMember
private

Definition at line 100 of file RootType.h.


The documentation for this class was generated from the following files:
RunTileTBRec.method
method
Definition: RunTileTBRec.py:73
maskDeadModules.mod
mod
Definition: maskDeadModules.py:36
TReturnTypeAdapter
Definition: RootType.h:49
ReadCellNoiseFromCool.dm
dm
Definition: ReadCellNoiseFromCool.py:235
perfmonmt-printer.required
required
Definition: perfmonmt-printer.py:184
create_dcsc_inputs_sqlite.arg
list arg
Definition: create_dcsc_inputs_sqlite.py:48
Reflex::FINAL
@ FINAL
Definition: RootType.h:25
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
TMemberAdapter::fMember
TDictionary * fMember
Definition: RootType.h:100
TMemberAdapter::Name
std::string Name(unsigned int mod=0) const
Definition: RootType.cxx:187
PowhegPythia8EvtGen_H2a4X_ctauY.ma
int ma
Definition: PowhegPythia8EvtGen_H2a4X_ctauY.py:26
TRT_PAI_physicsConstants::mb
const double mb
1mb to cm2
Definition: TRT_PAI_physicsConstants.h:15
TTypeAdapter
TScopeAdapter TTypeAdapter
Definition: RootType.h:33
Reflex::QUALIFIED
@ QUALIFIED
Definition: RootType.h:26