ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Cppyy.cxx
Go to the documentation of this file.
1 // Bindings
2 #include "PyROOT.h"
3 #include "Cppyy.h"
4 #include "TCallContext.h"
5 
6 // ROOT
7 #include "TBaseClass.h"
8 #include "TClass.h"
9 #include "TClassRef.h"
10 #include "TClassTable.h"
11 #include "TClassEdit.h"
12 #include "TCollection.h"
13 #include "TDataMember.h"
14 #include "TDataType.h"
15 #include "TError.h"
16 #include "TFunction.h"
17 #include "TGlobal.h"
18 #include "TInterpreter.h"
19 #include "TList.h"
20 #include "TMethod.h"
21 #include "TMethodArg.h"
22 #include "TROOT.h"
23 
24 // Standard
25 #include <assert.h>
26 #include <map>
27 #include <set>
28 #include <sstream>
29 
30 // temp
31 #include <iostream>
33 // --temp
34 
35 
36 // small number that allows use of stack for argument passing
37 const int SMALL_ARGS_N = 8;
38 
39 
40 // data for life time management ---------------------------------------------
41 typedef std::vector< TClassRef > ClassRefs_t;
42 static ClassRefs_t g_classrefs( 1 );
43 static const ClassRefs_t::size_type GLOBAL_HANDLE = 1;
44 
45 typedef std::map< std::string, ClassRefs_t::size_type > Name2ClassRefIndex_t;
46 static Name2ClassRefIndex_t g_name2classrefidx;
47 
48 typedef std::map< Cppyy::TCppMethod_t, CallFunc_t* > Method2CallFunc_t;
49 static Method2CallFunc_t g_method2callfunc;
50 
51 typedef std::vector< TFunction > GlobalFuncs_t;
52 static GlobalFuncs_t g_globalfuncs;
53 
54 typedef std::vector< TGlobal* > GlobalVars_t;
55 static GlobalVars_t g_globalvars;
56 
57 // data ----------------------------------------------------------------------
59 
60 // smart pointer types
61 static std::set< std::string > gSmartPtrTypes =
62  { "auto_ptr", "shared_ptr", "weak_ptr", "unique_ptr" };
63 
64 
65 // global initialization -----------------------------------------------------
66 namespace {
67 
68 class ApplicationStarter {
69 public:
70  ApplicationStarter() {
71  // setup dummy holders for global and std namespaces
72  assert( g_classrefs.size() == GLOBAL_HANDLE );
73  g_name2classrefidx[ "" ] = GLOBAL_HANDLE;
74  g_classrefs.push_back(TClassRef(""));
75  // ROOT ignores std/::std, so point them to the global namespace
76  g_name2classrefidx[ "std" ] = GLOBAL_HANDLE;
77  g_name2classrefidx[ "::std" ] = GLOBAL_HANDLE;
78  // add a dummy global to refer to as null at index 0
79  g_globalvars.push_back( nullptr );
80  }
81 
82  ~ApplicationStarter() {
83  for ( auto ifunc : g_method2callfunc )
84  gInterpreter->CallFunc_Delete( ifunc.second );
85  }
86 } _applicationStarter;
87 
88 } // unnamed namespace
89 
90 
91 // local helpers -------------------------------------------------------------
92 static inline
94 {
95  assert( (ClassRefs_t::size_type) scope < g_classrefs.size() );
96  return g_classrefs[ (ClassRefs_t::size_type)scope ];
97 }
98 
99 // type_from_handle to go here
100 static inline
102 {
103  TClassRef& cr = type_from_handle( klass );
104  if ( cr.GetClass() )
105  return (TFunction*)cr->GetListOfMethods()->At( idx );
106  assert( klass == (Cppyy::TCppType_t)GLOBAL_HANDLE );
107  return (TFunction*)idx;
108 }
109 
110 static inline
112 {
113  TMethod* m = dynamic_cast<TMethod*>( (TFunction*)method );
114  if ( m ) return Cppyy::GetScope( m->GetClass()->GetName() );
116 }
117 
118 
119 // name to opaque C++ scope representation -----------------------------------
121 {
122  TClassRef& cr = type_from_handle( scope );
123  if ( cr.GetClass() ) return 0; // not supported if not at global scope
124  assert( scope == (TCppScope_t)GLOBAL_HANDLE );
125  return gClassTable->Classes();
126 }
127 
128 std::string Cppyy::GetScopeName( TCppScope_t parent, TCppIndex_t iscope )
129 {
130 // Retrieve the scope name of the scope indexed with iscope in parent.
131  TClassRef& cr = type_from_handle( parent );
132  if ( cr.GetClass() ) return 0; // not supported if not at global scope
133  assert( parent == (TCppScope_t)GLOBAL_HANDLE );
134  std::string name = gClassTable->At( iscope );
135  if ( name.find("::") == std::string::npos )
136  return name;
137  return "";
138 }
139 
140 std::string Cppyy::ResolveName( const std::string& cppitem_name )
141 {
142 // Fully resolve the given name to the final type name.
143  std::string tclean = TClassEdit::CleanType( cppitem_name.c_str() );
144 
145  TDataType* dt = gROOT->GetType( tclean.c_str() );
146  if ( dt ) return dt->GetFullTypeName();
147  return TClassEdit::ResolveTypedef( tclean.c_str(), true );
148 }
149 
151 {
152  std::string scope_name;
153  if ( sname.find( "std::", 0, 5 ) == 0 )
154  scope_name = sname.substr( 5, std::string::npos );
155  else
156  scope_name = sname;
157 
158  scope_name = ResolveName( scope_name );
159  auto icr = g_name2classrefidx.find( scope_name );
160  if ( icr != g_name2classrefidx.end() )
161  return (TCppType_t)icr->second;
162 
163  // use TClass directly, to enable auto-loading
164  TClassRef cr( TClass::GetClass( scope_name.c_str(), kTRUE, kTRUE ) );
165  if ( !cr.GetClass() )
166  return (TCppScope_t)NULL;
167 
168  // no check for ClassInfo as forward declared classes are okay (fragile)
169 
170  ClassRefs_t::size_type sz = g_classrefs.size();
171  g_name2classrefidx[ scope_name ] = sz;
172  g_classrefs.push_back( TClassRef( scope_name.c_str() ) );
173  return (TCppScope_t)sz;
174 }
175 
176 Cppyy::TCppType_t Cppyy::GetTemplate( const std::string& /* template_name */ )
177 {
178  return (TCppType_t)0;
179 }
180 
182 {
183  TClassRef& cr = type_from_handle( klass );
184  TClass* clActual = cr->GetActualClass( (void*)obj );
185  if ( clActual && clActual != cr.GetClass() ) {
186  // TODO: lookup through name should not be needed
187  return (TCppType_t)GetScope( clActual->GetName() );
188  }
189  return klass;
190 }
191 
192 size_t Cppyy::SizeOf( TCppType_t klass )
193 {
194  TClassRef& cr = type_from_handle( klass );
195  if ( cr.GetClass() ) return (size_t)cr->Size();
196  return (size_t)0;
197 }
198 
199 Bool_t Cppyy::IsBuiltin( const std::string& type_name )
200 {
201  TDataType* dt = gROOT->GetType( TClassEdit::CleanType( type_name.c_str(), 1 ).c_str() );
202  if ( dt ) return dt->GetType() != kOther_t;
203  return kFALSE;
204 }
205 
206 Bool_t Cppyy::IsComplete( const std::string& type_name )
207 {
208 // verify whether the dictionary of this class is fully available
209  Bool_t b = kFALSE;
210 
211  Int_t oldEIL = gErrorIgnoreLevel;
212  gErrorIgnoreLevel = 3000;
213  TClass* klass = TClass::GetClass( TClassEdit::ShortType( type_name.c_str(), 1 ).c_str() );
214  if ( klass && klass->GetClassInfo() ) // works for normal case w/ dict
215  b = gInterpreter->ClassInfo_IsLoaded( klass->GetClassInfo() );
216  else { // special case for forward declared classes
217  ClassInfo_t* ci = gInterpreter->ClassInfo_Factory( type_name.c_str() );
218  if ( ci ) {
219  b = gInterpreter->ClassInfo_IsLoaded( ci );
220  gInterpreter->ClassInfo_Delete( ci ); // we own the fresh class info
221  }
222  }
223  gErrorIgnoreLevel = oldEIL;
224  return b;
225 }
226 
227 // memory management ---------------------------------------------------------
229 {
230  TClassRef& cr = type_from_handle( type );
231  return (TCppObject_t)malloc( cr->Size() );
232 }
233 
234 void Cppyy::Deallocate( TCppType_t /* type */, TCppObject_t instance )
235 {
236  free( instance );
237 }
238 
240 {
241  TClassRef& cr = type_from_handle( type );
242  return (TCppObject_t)cr->New();
243 }
244 
246 {
247  TClassRef& cr = type_from_handle( type );
248  cr->Destructor( (void*)instance );
249 }
250 
251 
252 // method/function dispatching -----------------------------------------------
253 static inline ClassInfo_t* GetGlobalNamespaceInfo()
254 {
255  static ClassInfo_t* gcl = gInterpreter->ClassInfo_Factory();
256  return gcl;
257 }
258 
259 static CallFunc_t* GetCallFunc( Cppyy::TCppMethod_t method )
260 {
261  auto icf = g_method2callfunc.find( method );
262  if ( icf != g_method2callfunc.end() )
263  return icf->second;
264 
265  CallFunc_t* callf = nullptr;
266  TFunction* func = (TFunction*)method;
267  std::string callString = "";
268 
269 // create, if not cached
270  Cppyy::TCppScope_t scope = declaring_scope( method );
271  const TClassRef& klass = type_from_handle( scope );
272  if ( klass.GetClass() || (func && scope == GLOBAL_HANDLE) ) {
273  ClassInfo_t* gcl = klass.GetClass() ? klass->GetClassInfo() : nullptr;
274  if ( ! gcl )
275  gcl = GetGlobalNamespaceInfo();
276 
277  TCollection* method_args = func->GetListOfMethodArgs();
278  TIter iarg( method_args );
279 
280  TMethodArg* method_arg = 0;
281  while ((method_arg = (TMethodArg*)iarg.Next())) {
282  std::string fullType = method_arg->GetTypeNormalizedName();
283  if ( callString.empty() )
284  callString = fullType;
285  else
286  callString += ", " + fullType;
287  }
288 
289  Long_t offset = 0;
290  callf = gInterpreter->CallFunc_Factory();
291 
292  gInterpreter->CallFunc_SetFuncProto(
293  callf,
294  gcl,
295  func ? func->GetName() : klass->GetName(),
296  callString.c_str(),
297  func ? (func->Property() & kIsConstMethod) : kFALSE,
298  &offset,
300 
301 // CLING WORKAROUND -- The number of arguments is not always correct (e.g. when there
302 // are default parameters, causing the callString to be wrong and
303 // the exact match to fail); or the method may have been inline or
304 // be compiler generated. In all those cases the exact match fails,
305 // whereas the conversion match sometimes works.
306  if ( ! gInterpreter->CallFunc_IsValid( callf ) ) {
307  gInterpreter->CallFunc_SetFuncProto(
308  callf,
309  gcl,
310  func ? func->GetName() : klass->GetName(),
311  callString.c_str(),
312  func ? (func->Property() & kIsConstMethod) : kFALSE,
313  &offset ); // <- no kExactMatch as that will fail
314  }
315 // -- CLING WORKAROUND
316 
317  }
318 
319  if ( !( callf && gInterpreter->CallFunc_IsValid( callf ) ) ) {
320  PyErr_Format( PyExc_RuntimeError, "could not resolve %s::%s(%s)",
321  const_cast<TClassRef&>(klass).GetClassName(),
322  func ? func->GetName() : const_cast<TClassRef&>(klass).GetClassName(),
323  callString.c_str() );
324  if ( callf ) gInterpreter->CallFunc_Delete( callf );
325  return nullptr;
326  }
327 
328  g_method2callfunc[ method ] = callf;
329  return callf;
330 }
331 
332 static inline void copy_args( void* args_, void** vargs ) {
333  std::vector<TParameter>& args = *(std::vector<TParameter>*)args_;
334  for ( std::vector<TParameter>::size_type i = 0; i < args.size(); ++i ) {
335  switch ( args[i].fTypeCode ) {
336  case 'l': /* long */
337  vargs[i] = (void*)&args[i].fValue.fLong;
338  break;
339  case 'f': /* double */
340  vargs[i] = (void*)&args[i].fValue.fFloat;
341  break;
342  case 'd': /* double */
343  vargs[i] = (void*)&args[i].fValue.fDouble;
344  break;
345  case 'D': /* long double */
346  vargs[i] = (void*)&args[i].fValue.fLongDouble;
347  break;
348  case 'k': /* long long */
349  case 'K': /* unsigned long long */
350  case 'U': /* unsigned long */
351  case 'p': /* void* */
352  vargs[i] = (void*)&args[i].fValue.fVoidp;
353  break;
354  case 'V': /* (void*)type& */
355  vargs[i] = args[i].fValue.fVoidp;
356  break;
357  case 'r': /* const type& */
358  vargs[i] = args[i].fRef;
359  break;
360  default:
361  std::cerr << "unknown type code: " << args[i].fTypeCode << std::endl;
362  break;
363  }
364  }
365 }
366 
368  Cppyy::TCppMethod_t method, void* args_, void* self, void* result )
369 {
370  const std::vector<TParameter>& args = *(std::vector<TParameter>*)args_;
371 
372  CallFunc_t* callf = GetCallFunc( method );
373  if ( ! callf )
374  return kFALSE;
375 
378  if ( args.size() <= SMALL_ARGS_N ) {
379  void* smallbuf[SMALL_ARGS_N];
380  copy_args( args_, smallbuf );
381  faceptr.fGeneric( self, args.size(), smallbuf, result );
382  } else {
383  std::vector<void*> buf( args.size() );
384  copy_args( args_, buf.data() );
385  faceptr.fGeneric( self, args.size(), buf.data(), result );
386  }
387  return kTRUE;
388  }
389 
391  if ( args.size() <= SMALL_ARGS_N ) {
392  void* smallbuf[SMALL_ARGS_N];
393  copy_args( args_, (void**)smallbuf );
394  faceptr.fCtor( (void**)smallbuf, result, args.size() );
395  } else {
396  std::vector<void*> buf( args.size() );
397  copy_args( args_, buf.data() );
398  faceptr.fCtor( buf.data(), result, args.size() );
399  }
400  return kTRUE;
401  }
402 
404  std::cerr << " DESTRUCTOR NOT IMPLEMENTED YET! " << std::endl;
405  return kFALSE;
406  }
407 
408  return kFALSE;
409 }
410 
411 template< typename T >
412 static inline T CallT( Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, void* args )
413 {
414  T t{};
415  if ( FastCall( method, args, (void*)self, &t ) )
416  return t;
417  return (T)-1;
418 }
419 
420 #define CPPYY_IMP_CALL( typecode, rtype ) \
421 rtype Cppyy::Call##typecode( TCppMethod_t method, TCppObject_t self, void* args )\
422 { \
423  return CallT< rtype >( method, self, args ); \
424 }
425 
426 void Cppyy::CallV( TCppMethod_t method, TCppObject_t self, void* args )
427 {
428  if ( ! FastCall( method, args, (void*)self, nullptr ) )
429  return /* TODO ... report error */;
430 }
431 
441 
442 void* Cppyy::CallR( TCppMethod_t method, TCppObject_t self, void* args )
443 {
444  void* r = nullptr;
445  if ( FastCall( method, args, (void*)self, &r ) )
446  return r;
447  return nullptr;
448 }
449 
450 Char_t* Cppyy::CallS( TCppMethod_t method, TCppObject_t self, void* args )
451 {
452  Char_t* s = nullptr;
453  if ( FastCall( method, args, (void*)self, &s ) )
454  return s;
455  return nullptr;
456 }
457 
459  TCppMethod_t method, TCppType_t /* klass */, void* args ) {
460  void* obj = nullptr;
461  if ( FastCall( method, args, nullptr, &obj ) )
462  return (TCppObject_t)obj;
463  return (TCppObject_t)0;
464 }
465 
467 {
468  TClassRef& cr = type_from_handle( type );
469  cr->Destructor( (void*)self, kTRUE );
470 }
471 
473  TCppObject_t self, void* args, TCppType_t result_type )
474 {
475  TClassRef& cr = type_from_handle( result_type );
476  void* obj = malloc( cr->Size() );
477  if ( FastCall( method, args, self, obj ) )
478  return (TCppObject_t)obj;
479  return (TCppObject_t)0;
480 }
481 
483  TCppScope_t /* scope */, TCppIndex_t /* imeth */ )
484 {
485  return (TCppMethPtrGetter_t)0;
486 }
487 
488 
489 // handling of function argument buffer --------------------------------------
490 void* Cppyy::AllocateFunctionArgs( size_t nargs )
491 {
492  return new TParameter[nargs];
493 }
494 
496 {
497  delete [] (TParameter*)args;
498 }
499 
501 {
502  return sizeof( TParameter );
503 }
504 
506 {
507  return offsetof( TParameter, fTypeCode );
508 }
509 
510 
511 // scope reflection information ----------------------------------------------
513 // Test if this scope represents a namespace.
514  TClassRef& cr = type_from_handle( scope );
515  if ( cr.GetClass() )
516  return cr->Property() & kIsNamespace;
517  return kFALSE;
518 }
519 
521 // Test if this type may not be instantiated.
522  TClassRef& cr = type_from_handle( klass );
523  if ( cr.GetClass() )
524  return cr->Property() & kIsAbstract;
525  return kFALSE;
526 }
527 
528 Bool_t Cppyy::IsEnum( const std::string& type_name ) {
529  return gInterpreter->ClassInfo_IsEnum( type_name.c_str() );
530 }
531 
532 
533 // class reflection information ----------------------------------------------
534 std::string Cppyy::GetFinalName( TCppType_t klass )
535 {
536  if ( klass == GLOBAL_HANDLE ) // due to CLING WORKAROUND in InitConverters_
537  return "";
538  // TODO: either this or GetScopedFinalName is wrong
539  TClassRef& cr = type_from_handle( klass );
540  return cr->GetName();
541 }
542 
544 {
545  // TODO: either this or GetFinalName is wrong
546  TClassRef& cr = type_from_handle( klass );
547  return cr->GetName();
548 }
549 
551 {
552 // Always TRUE for now (pre-empts certain optimizations).
553  return kTRUE;
554 }
555 
557 {
558 // Get the total number of base classes that this class has.
559  TClassRef& cr = type_from_handle( klass );
560  if ( cr.GetClass() && cr->GetListOfBases() != 0 )
561  return cr->GetListOfBases()->GetSize();
562  return 0;
563 }
564 
565 std::string Cppyy::GetBaseName( TCppType_t klass, TCppIndex_t ibase )
566 {
567  TClassRef& cr = type_from_handle( klass );
568  return ((TBaseClass*)cr->GetListOfBases()->At( ibase ))->GetName();
569 }
570 
572 {
573  if ( derived == base )
574  return kTRUE;
575  TClassRef& derived_type = type_from_handle( derived );
576  TClassRef& base_type = type_from_handle( base );
577  return derived_type->GetBaseClass( base_type ) != 0;
578 }
579 
580 void Cppyy::AddSmartPtrType( const std::string& type_name ) {
581  gSmartPtrTypes.insert( ResolveName( type_name ) );
582 }
583 
584 Bool_t Cppyy::IsSmartPtr( const std::string& type_name ) {
585 // checks if typename denotes a smart pointer
586 // TODO: perhaps make this stricter?
587  const std::string& real_name = ResolveName( type_name );
588  return gSmartPtrTypes.find(
589  real_name.substr( 0,real_name.find( "<" ) ) ) != gSmartPtrTypes.end();
590 }
591 
592 // type offsets --------------------------------------------------------------
593 ptrdiff_t Cppyy::GetBaseOffset( TCppType_t derived, TCppType_t base,
594  TCppObject_t address, int direction, bool rerror )
595 {
596 // calculate offsets between declared and actual type, up-cast: direction > 0; down-cast: direction < 0
597  if ( derived == base || !(base && derived) )
598  return (ptrdiff_t)0;
599 
600  TClassRef& cd = type_from_handle( derived );
601  TClassRef& cb = type_from_handle( base );
602 
603  if ( !cd.GetClass() || !cb.GetClass() )
604  return (ptrdiff_t)0;
605 
606  Long_t offset = -1;
607  if ( ! (cd->GetClassInfo() && cb->GetClassInfo()) ) { // gInterpreter requirement
608  // would like to warn, but can't quite determine error from intentional
609  // hiding by developers, so only cover the case where we really should have
610  // had a class info, but apparently don't:
611  if ( cd->IsLoaded() ) {
612  // warn to allow diagnostics
613  std::ostringstream msg;
614  msg << "failed offset calculation between " << cb->GetName() << " and " << cd->GetName();
615  PyErr_Warn( PyExc_RuntimeWarning, const_cast<char*>( msg.str().c_str() ) );
616  }
617 
618  // return -1 to signal caller NOT to apply offset
619  return rerror ? (ptrdiff_t)offset : 0;
620  }
621 
622  offset = gInterpreter->ClassInfo_GetBaseOffset(
623  cd->GetClassInfo(), cb->GetClassInfo(), (void*)address, direction > 0 );
624  if ( offset == -1 ) // Cling error, treat silently
625  return rerror ? (ptrdiff_t)offset : 0;
626 
627  return (ptrdiff_t)(direction < 0 ? -offset : offset);
628 }
629 
630 
631 // method/function reflection information ------------------------------------
633 {
634  TClassRef& cr = type_from_handle( scope );
635  if ( cr.GetClass() && cr->GetListOfMethods() ) {
637  if ( nMethods == (TCppIndex_t)0 ) {
638  std::string clName = GetScopedFinalName( scope );
639  if ( clName.find( '<' ) != std::string::npos ) {
640  // chicken-and-egg problem: TClass does not know about methods until instantiation: force it
641  if ( TClass::GetClass( ("std::" + clName).c_str() ) )
642  clName = "std::" + clName;
643  std::ostringstream stmt;
644  stmt << "template class " << clName << ";";
645  gInterpreter->Declare( stmt.str().c_str() );
646  // now reload the methods
647  return (TCppIndex_t)cr->GetListOfMethods( kTRUE )->GetSize();
648  }
649  }
650  return nMethods;
651  } else if ( scope == (TCppScope_t)GLOBAL_HANDLE ) {
652  // enforce lazines by denying the existence of methods
653  return (TCppIndex_t)0;
654  }
655  return (TCppIndex_t)0;
656 }
657 
659 {
660  return (TCppIndex_t)0;
661 }
662 
663 std::vector< Cppyy::TCppMethod_t > Cppyy::GetMethodsFromName(
664  TCppScope_t scope, const std::string& name )
665 {
666 // TODO: this method assumes that the call for this name is made only
667 // once, and thus there is no need to store the results of the search
668 // in g_globalfuncs ... probably true, but needs verification
669  std::vector< TCppMethod_t > methods;
670  if ( scope == GLOBAL_HANDLE ) {
671  TCollection* funcs = gROOT->GetListOfGlobalFunctions( kTRUE );
672  g_globalfuncs.reserve(funcs->GetSize());
673 
674  TIter ifunc(funcs);
675 
676  TFunction* func = 0;
677  while ( (func = (TFunction*)ifunc.Next()) ) {
678  // cover not only direct matches, but also template matches
679  std::string fn = func->GetName();
680  if ( fn.rfind( name, 0 ) == 0 ) {
681  // either match exactly, or match the name as template
682  if ( (name.size() == fn.size()) ||
683  (name.size() < fn.size() && fn[name.size()] == '<') ) {
684  methods.push_back( (TCppMethod_t)func );
685  }
686  }
687  }
688  } else {
689  TClassRef& cr = type_from_handle( scope );
690  if ( cr.GetClass() ) {
691  // todo: handle overloads
692  TMethod* m = cr->GetMethodAny( name.c_str() );
693  if ( m ) methods.push_back( (TCppMethod_t)m );
694  }
695  }
696 
697  return methods;
698 }
699 
701 {
702  TFunction* f = type_get_method( scope, imeth );
703  return (Cppyy::TCppMethod_t)f;
704 }
705 
706 std::string Cppyy::GetMethodName( TCppMethod_t method )
707 {
708  if ( method ) {
709  std::string name = ((TFunction*)method)->GetName();
710  //if ( IsMethodTemplate( method ) )
711  // return name.substr( 0, name.find('<') );
712  return name;
713  }
714  return "<unknown>";
715 }
716 
718 {
719  if ( method ) {
720  TFunction* f = (TFunction*)method;
721  if ( f->ExtraProperty() & kIsConstructor )
722  return "constructor";
723  return f->GetReturnTypeNormalizedName();
724  }
725  return "<unknown>";
726 }
727 
729 {
730  if ( method )
731  return ((TFunction*)method)->GetNargs();
732  return 0;
733 }
734 
736 {
737  if ( method ) {
738  TFunction* f = (TFunction*)method;
739  return (TCppIndex_t)(f->GetNargs() - f->GetNargsOpt());
740  }
741  return (TCppIndex_t)0;
742 }
743 
744 std::string Cppyy::GetMethodArgName( TCppMethod_t method, int iarg )
745 {
746  if ( method ) {
747  TFunction* f = (TFunction*)method;
748  TMethodArg* arg = (TMethodArg*)f->GetListOfMethodArgs()->At( iarg );
749  return arg->GetName();
750  }
751  return "<unknown>";
752 }
753 
754 std::string Cppyy::GetMethodArgType( TCppMethod_t method, int iarg )
755 {
756  if ( method ) {
757  TFunction* f = (TFunction*)method;
758  TMethodArg* arg = (TMethodArg*)f->GetListOfMethodArgs()->At( iarg );
759  return arg->GetTypeNormalizedName();
760  }
761  return "<unknown>";
762 }
763 
764 std::string Cppyy::GetMethodArgDefault( TCppMethod_t method, int iarg )
765 {
766  if ( method ) {
767  TFunction* f = (TFunction*)method;
768  TMethodArg* arg = (TMethodArg*)f->GetListOfMethodArgs()->At( iarg );
769  const char* def = arg->GetDefault();
770  if ( def )
771  return def;
772  }
773 
774  return "";
775 }
776 
777 std::string Cppyy::GetMethodSignature( TCppScope_t /* scope */, TCppIndex_t /* imeth */ )
778 {
779  return "<unknown>";
780 }
781 
783 {
784  if ( method ) {
785  TFunction* f = (TFunction*)method;
786  return f->Property() & kIsConstMethod;
787  }
788  return kFALSE;
789 }
790 
791 
793 {
794  if ( method ) {
795  TFunction* f = (TFunction*)method;
796  std::string name = f->GetName();
797  return (name[name.size()-1] == '>') && (name.find('<') != std::string::npos);
798  }
799  return kFALSE;
800 }
801 
803  TCppScope_t /* scope */, TCppIndex_t /* imeth */ )
804 {
805  return (TCppIndex_t)0;
806 }
807 
809  TCppScope_t /* scope */, TCppIndex_t /* imeth */, TCppIndex_t /* iarg */ )
810 {
811  return "<unknown>";
812 }
813 
815  TCppScope_t /* scope */, TCppType_t /* lc */, TCppType_t /* rc */, const std::string& /* op */ )
816 {
817  return (TCppIndex_t)0;
818 }
819 
820 // method properties ---------------------------------------------------------
822 {
823  if ( method ) {
824  TFunction* f = (TFunction*)method;
825  return f->ExtraProperty() & kIsConstructor;
826  }
827  return kFALSE;
828 }
829 
831 {
832  if ( method ) {
833  TFunction* f = (TFunction*)method;
834  return f->Property() & kIsPublic;
835  }
836  return kFALSE;
837 }
838 
840 {
841  if ( method ) {
842  TFunction* f = (TFunction*)method;
843  return f->Property() & kIsStatic;
844  }
845  return kFALSE;
846 }
847 
848 // data member reflection information ----------------------------------------
850 {
851  TClassRef& cr = type_from_handle( scope );
852  if ( cr.GetClass() && cr->GetListOfDataMembers() )
853  return cr->GetListOfDataMembers()->GetSize();
854  else if ( scope == (TCppScope_t)GLOBAL_HANDLE ) {
855  std::cerr << " global data should be retrieved lazily " << std::endl;
856  TCollection* vars = gROOT->GetListOfGlobals( kTRUE );
857  if ( g_globalvars.size() != (GlobalVars_t::size_type)vars->GetSize() ) {
858  g_globalvars.clear();
859  g_globalvars.reserve(vars->GetSize());
860 
861  TIter ivar(vars);
862 
863  TGlobal* var = 0;
864  while ( (var = (TGlobal*)ivar.Next()) )
865  g_globalvars.push_back( var );
866  }
867  return (TCppIndex_t)g_globalvars.size();
868  }
869  return (TCppIndex_t)0;
870 }
871 
873 {
874  TClassRef& cr = type_from_handle( scope );
875  if (cr.GetClass()) {
876  TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
877  return m->GetName();
878  }
879  assert( scope == (TCppScope_t)GLOBAL_HANDLE );
880  TGlobal* gbl = g_globalvars[ idata ];
881  return gbl->GetName();
882 }
883 
885 {
886  if ( scope == GLOBAL_HANDLE ) {
887  TGlobal* gbl = g_globalvars[ idata ];
888  std::string fullType = gbl->GetFullTypeName();
889  if ( fullType[fullType.size()-1] == '*' && \
890  fullType.find( "char", 0, 4 ) == std::string::npos )
891  fullType.append( "*" );
892  else if ( (int)gbl->GetArrayDim() > 1 )
893  fullType.append( "*" );
894  else if ( (int)gbl->GetArrayDim() == 1 ) {
895  std::ostringstream s;
896  s << '[' << gbl->GetMaxIndex( 0 ) << ']' << std::ends;
897  fullType.append( s.str() );
898  }
899  return fullType;
900  }
901 
902  TClassRef& cr = type_from_handle( scope );
903  if ( cr.GetClass() ) {
904  TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
905  std::string fullType = m->GetTrueTypeName();
906  if ( (int)m->GetArrayDim() > 1 || (!m->IsBasic() && m->IsaPointer()) )
907  fullType.append( "*" );
908  else if ( (int)m->GetArrayDim() == 1 ) {
909  std::ostringstream s;
910  s << '[' << m->GetMaxIndex( 0 ) << ']' << std::ends;
911  fullType.append( s.str() );
912  }
913  return fullType;
914  }
915 
916  return "<unknown>";
917 }
918 
920 {
921  if ( scope == GLOBAL_HANDLE ) {
922  TGlobal* gbl = g_globalvars[ idata ];
923  return (ptrdiff_t)gbl->GetAddress();
924  }
925 
926  TClassRef& cr = type_from_handle( scope );
927  if ( cr.GetClass() ) {
928  TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
929  return (ptrdiff_t)m->GetOffsetCint(); // yes, CINT ...
930  }
931 
932  return (ptrdiff_t)0;
933 }
934 
936 {
937  if ( scope == GLOBAL_HANDLE ) {
938  TGlobal* gb = (TGlobal*)gROOT->GetListOfGlobals( kTRUE )->FindObject( name.c_str() );
939  if ( gb && gb->GetAddress() && gb->GetAddress() != (void*)-1 ) {
940  g_globalvars.push_back( gb );
941  return g_globalvars.size() - 1;
942  }
943 
944  } else {
945  TClassRef& cr = type_from_handle( scope );
946  if ( cr.GetClass() ) {
947  TDataMember* dm =
948  (TDataMember*)cr->GetListOfDataMembers()->FindObject( name.c_str() );
949  // TODO: turning this into an index is silly ...
950  if ( dm ) return (TCppIndex_t)cr->GetListOfDataMembers()->IndexOf( dm );
951  }
952  }
953 
954  return (TCppIndex_t)-1;
955 }
956 
957 
958 // data member properties ----------------------------------------------------
960 {
961  if ( scope == GLOBAL_HANDLE )
962  return kTRUE;
963  TClassRef& cr = type_from_handle( scope );
964  if ( cr->Property() & kIsNamespace )
965  return kTRUE;
966  TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
967  return m->Property() & kIsPublic;
968 }
969 
971 {
972  if ( scope == GLOBAL_HANDLE )
973  return kTRUE;
974  TClassRef& cr = type_from_handle( scope );
975  if ( cr->Property() & kIsNamespace )
976  return kTRUE;
977  TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
978  return m->Property() & kIsStatic;
979 }
980 
982 {
983  if ( scope == GLOBAL_HANDLE ) {
984  TGlobal* gbl = g_globalvars[ idata ];
985  return gbl->Property() & kIsConstant;
986  }
987  TClassRef& cr = type_from_handle( scope );
988  if ( cr.GetClass() ) {
989  TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
990  return m->Property() & kIsConstant;
991  }
992  return kFALSE;
993 }
994 
996 {
997  if ( scope == GLOBAL_HANDLE ) {
998  TGlobal* gbl = g_globalvars[ idata ];
999  return gbl->Property() & kIsEnum;
1000  }
1001  TClassRef& cr = type_from_handle( scope );
1002  if ( cr.GetClass() ) {
1003  TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
1004  return m->Property() & kIsEnum;
1005  }
1006  return kFALSE;
1007 }
1008 
1010 {
1011  if ( scope == GLOBAL_HANDLE ) {
1012  TGlobal* gbl = g_globalvars[ idata ];
1013  return gbl->GetMaxIndex( dimension );
1014  }
1015  TClassRef& cr = type_from_handle( scope );
1016  if ( cr.GetClass() ) {
1017  TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
1018  return m->GetMaxIndex( dimension );
1019  }
1020  return (Int_t)-1;
1021 }
std::map< std::string, ClassRefs_t::size_type > Name2ClassRefIndex_t
Definition: Cppyy.cxx:45
TCppScope_t TCppType_t
Definition: Cppyy.h:13
size_t GetFunctionArgSizeof()
Definition: Cppyy.cxx:500
static double B[]
TList * GetListOfBases()
Return list containing the TBaseClass(es) of a class.
Definition: TClass.cxx:3368
virtual CallFuncIFacePtr_t CallFunc_IFacePtr(CallFunc_t *) const
Definition: TInterpreter.h:275
std::string GetScopedFinalName(TCppType_t type)
Definition: Cppyy.cxx:543
std::vector< TClassRef > ClassRefs_t
Definition: Cppyy.cxx:41
long long Long64_t
Definition: RtypesCore.h:69
R__EXTERN Int_t gErrorIgnoreLevel
Definition: TError.h:107
std::vector< TGlobal * > GlobalVars_t
Definition: Cppyy.cxx:54
Int_t GetType() const
Definition: TDataType.h:70
static ClassRefs_t g_classrefs(1)
Bool_t IsNamespace(TCppScope_t scope)
Definition: Cppyy.cxx:512
float Float_t
Definition: RtypesCore.h:53
R__EXTERN TClassTable * gClassTable
Definition: TClassTable.h:97
RooArgList L(const RooAbsArg &v1)
Bool_t IsBuiltin(const std::string &type_name)
Definition: Cppyy.cxx:199
TCppIndex_t GetGlobalOperator(TCppType_t scope, TCppType_t lc, TCppScope_t rc, const std::string &op)
Definition: Cppyy.cxx:814
tuple offset
Definition: tree.py:93
All ROOT classes may have RTTI (run time type identification) support added.
Definition: TDataMember.h:33
#define assert(cond)
Definition: unittest.h:542
Bool_t IsMethodTemplate(TCppMethod_t)
Definition: Cppyy.cxx:792
Int_t GetNargs() const
Number of function arguments.
Definition: TFunction.cxx:164
ptrdiff_t GetBaseOffset(TCppType_t derived, TCppType_t base, TCppObject_t address, int direction, bool rerror=false)
Definition: Cppyy.cxx:593
Bool_t IsPublicMethod(TCppMethod_t method)
Definition: Cppyy.cxx:830
static void copy_args(void *args_, void **vargs)
Definition: Cppyy.cxx:332
TCppIndex_t GetNumBases(TCppType_t type)
Definition: Cppyy.cxx:556
virtual Int_t GetMaxIndex(Int_t dim) const
Return maximum index for array dimension "dim".
Definition: TGlobal.cxx:101
Long_t Property() const
Set TObject::fBits and fStreamerType to cache information about the class.
Definition: TClass.cxx:5560
TCppIndex_t GetMethodReqArgs(TCppMethod_t)
Definition: Cppyy.cxx:735
std::vector< TCppMethod_t > GetMethodsFromName(TCppScope_t scope, const std::string &name)
Definition: Cppyy.cxx:663
#define gROOT
Definition: TROOT.h:344
#define H(x, y, z)
TList * GetListOfDataMembers(Bool_t load=kTRUE)
Return list containing the TDataMembers of a class.
Definition: TClass.cxx:3459
Bool_t IsAbstract(TCppType_t type)
Definition: Cppyy.cxx:520
std::string GetFinalName(TCppType_t type)
Definition: Cppyy.cxx:534
std::string GetMethodSignature(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:777
std::string CleanType(const char *typeDesc, int mode=0, const char **tail=0)
Cleanup type description, redundant blanks removed and redundant tail ignored return *tail = pointer ...
ptrdiff_t GetDatamemberOffset(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:919
struct staticInitHelper gbl
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Bool_t IsaPointer() const
Return true if data member is a pointer.
const Bool_t kFALSE
Definition: Rtypes.h:92
static GlobalFuncs_t g_globalfuncs
Definition: Cppyy.cxx:52
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition: TList.cxx:497
#define gInterpreter
Definition: TInterpreter.h:502
Bool_t IsEnumData(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:995
std::string GetDatamemberType(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:884
Each ROOT method (see TMethod) has a linked list of its arguments.
Definition: TMethodArg.h:33
std::string GetReturnTypeNormalizedName() const
Get the normalized name of the return type.
Definition: TFunction.cxx:154
TCppIndex_t GetNumScopes(TCppScope_t parent)
Definition: Cppyy.cxx:120
Bool_t FastCall(Cppyy::TCppMethod_t method, void *args_, void *self, void *result)
Definition: Cppyy.cxx:367
virtual Int_t GetArrayDim() const
Return number of array dimensions.
Definition: TGlobal.cxx:85
TCppObject_t CallO(TCppMethod_t method, TCppObject_t self, void *args, TCppType_t result_type)
Definition: Cppyy.cxx:472
Int_t GetDimensionSize(TCppScope_t scope, TCppIndex_t idata, int dimension)
Definition: Cppyy.cxx:1009
Int_t GetMaxIndex(Int_t dim) const
Return maximum index for array dimension "dim".
virtual TObject * At(Int_t idx) const
Returns the object at position idx. Returns 0 if idx is out of range.
Definition: TList.cxx:311
TFile * f
#define CPPYY_IMP_CALL(typecode, rtype)
Definition: Cppyy.cxx:420
TCppObject_t CallConstructor(TCppMethod_t method, TCppType_t type, void *args)
Definition: Cppyy.cxx:458
std::string GetBaseName(TCppType_t type, TCppIndex_t ibase)
Definition: Cppyy.cxx:565
Char_t * CallS(TCppMethod_t method, TCppObject_t self, void *args)
Definition: Cppyy.cxx:450
TTree * T
TCppIndex_t GetMethodIndexAt(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:658
static TFunction * type_get_method(Cppyy::TCppType_t klass, Cppyy::TCppIndex_t idx)
Definition: Cppyy.cxx:101
TCppIndex_t GetMethodNumTemplateArgs(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:802
TCppType_t GetTemplate(const std::string &template_name)
Definition: Cppyy.cxx:176
const char * GetTrueTypeName() const
Get full type description of data member, e,g.: "class TDirectory*".
std::string ResolveName(const std::string &cppitem_name)
Definition: Cppyy.cxx:140
Bool_t HasComplexHierarchy(TCppType_t type)
Definition: Cppyy.cxx:550
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
Definition: TClass.cxx:4602
TClass * GetActualClass(const void *object) const
Return a pointer the the real class of the object.
Definition: TClass.cxx:2457
TCppMethPtrGetter_t GetMethPtrGetter(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:482
std::string ResolveTypedef(const char *tname, bool resolveAll=false)
TCppIndex_t GetNumDatamembers(TCppScope_t scope)
Definition: Cppyy.cxx:849
const char * GetDefault() const
Get default value of method argument.
Definition: TMethodArg.cxx:58
Bool_t IsConstData(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:981
static Method2CallFunc_t g_method2callfunc
Definition: Cppyy.cxx:49
void CallDestructor(TCppType_t type, TCppObject_t self)
Definition: Cppyy.cxx:466
Bool_t IsComplete(const std::string &type_name)
Definition: Cppyy.cxx:206
TCppMethod_t GetMethod(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:700
size_t GetFunctionArgTypeoffset()
Definition: Cppyy.cxx:505
std::string GetMethodTemplateArgName(TCppScope_t scope, TCppIndex_t imeth, TCppIndex_t iarg)
Definition: Cppyy.cxx:808
virtual const char * GetFullTypeName() const
Get full type description of global variable, e,g.: "class TDirectory*".
Definition: TGlobal.cxx:120
TClass * GetBaseClass(const char *classname)
Return pointer to the base class "classname".
Definition: TClass.cxx:2504
Bool_t IsConstructor(TCppMethod_t method)
Definition: Cppyy.cxx:821
TCppType_t GetActualClass(TCppType_t klass, TCppObject_t obj)
Definition: Cppyy.cxx:181
PyROOT::TParameter TParameter
Definition: Cppyy.cxx:32
Int_t GetNargsOpt() const
Number of function optional (default) arguments.
Definition: TFunction.cxx:174
#define F(x, y, z)
void AddSmartPtrType(const std::string &)
Definition: Cppyy.cxx:580
TThread * t[5]
Definition: threadsh1.C:13
ptrdiff_t TCppMethod_t
Definition: Cppyy.h:15
TCppScope_t gGlobalScope
Definition: Cppyy.cxx:58
static double C[]
Bool_t IsPublicData(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:959
std::string GetMethodName(TCppMethod_t)
Definition: Cppyy.cxx:706
ROOT::R::TRInterface & r
Definition: Object.C:4
Basic data type descriptor (datatype information is obtained from CINT).
Definition: TDataType.h:46
PyObject * fValue
ClassInfo_t * GetClassInfo() const
Definition: TClass.h:390
TObject * Next()
Definition: TCollection.h:158
Collection abstract base class.
Definition: TCollection.h:48
void Destructor(void *obj, Bool_t dtorOnly=kFALSE)
Explicitly call destructor for object.
Definition: TClass.cxx:4959
void * AllocateFunctionArgs(size_t nargs)
Definition: Cppyy.cxx:490
TMarker * m
Definition: textangle.C:8
static CallFunc_t * GetCallFunc(Cppyy::TCppMethod_t method)
Definition: Cppyy.cxx:259
short Short_t
Definition: RtypesCore.h:35
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
static GlobalVars_t g_globalvars
Definition: Cppyy.cxx:55
TCppIndex_t GetDatamemberIndex(TCppScope_t scope, const std::string &name)
Definition: Cppyy.cxx:935
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
long double LongDouble_t
Definition: RtypesCore.h:57
const std::string sname
Definition: testIO.cxx:45
Long_t Property() const
Get property description word. For meaning of bits see EProperty.
Definition: TFunction.cxx:183
Global variables class (global variables are obtained from CINT).
Definition: TGlobal.h:29
void * TCppObject_t
Definition: Cppyy.h:14
static const ClassRefs_t::size_type GLOBAL_HANDLE
Definition: Cppyy.cxx:43
tuple free
Definition: fildir.py:30
Each class (see TClass) has a linked list of its base class(es).
Definition: TBaseClass.h:35
void * CallR(TCppMethod_t method, TCppObject_t self, void *args)
Definition: Cppyy.cxx:442
long Long_t
Definition: RtypesCore.h:50
Bool_t IsLoaded() const
Return true if the shared library of this class is currently in the a process's memory.
Definition: TClass.cxx:5436
TClass * GetClass() const
Definition: TMethod.h:57
Bool_t IsSubtype(TCppType_t derived, TCppType_t base)
Definition: Cppyy.cxx:571
static TClassRef & type_from_handle(Cppyy::TCppScope_t scope)
Definition: Cppyy.cxx:93
virtual Int_t GetSize() const
Definition: TCollection.h:95
static T CallT(Cppyy::TCppMethod_t method, Cppyy::TCppObject_t self, void *args)
Definition: Cppyy.cxx:412
TCppScope_t GetScope(const std::string &scope_name)
Definition: Cppyy.cxx:150
TList * GetListOfMethodArgs()
Return list containing the TMethodArgs of a TFunction.
Definition: TFunction.cxx:126
double Double_t
Definition: RtypesCore.h:55
std::string GetMethodResultType(TCppMethod_t)
Definition: Cppyy.cxx:717
Long_t GetOffsetCint() const
Get offset from "this" using the information in CINT only.
int type
Definition: TGX11.cxx:120
std::string GetTypeNormalizedName() const
Get the normalized name of the return type.
Definition: TMethodArg.cxx:86
virtual void * GetAddress() const
Return address of global.
Definition: TGlobal.cxx:77
double func(double *x, double *p)
Definition: stressTF1.cxx:213
TCppIndex_t GetMethodNumArgs(TCppMethod_t)
Definition: Cppyy.cxx:728
std::string GetMethodArgName(TCppMethod_t, int iarg)
Definition: Cppyy.cxx:744
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:2801
void Deallocate(TCppType_t type, TCppObject_t instance)
Definition: Cppyy.cxx:234
TCppObject_t Allocate(TCppType_t type)
Definition: Cppyy.cxx:228
std::string GetMethodArgType(TCppMethod_t, int iarg)
Definition: Cppyy.cxx:754
Bool_t IsSmartPtr(const std::string &)
Definition: Cppyy.cxx:584
#define name(a, b)
Definition: linkTestLib0.cpp:5
Bool_t IsStaticMethod(TCppMethod_t method)
Definition: Cppyy.cxx:839
std::string GetDatamemberName(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:872
void *(* TCppMethPtrGetter_t)(TCppObject_t)
Definition: Cppyy.h:18
Global functions class (global functions are obtained from CINT).
Definition: TFunction.h:30
Int_t GetArrayDim() const
Return number of array dimensions.
TClass * GetClass() const
Definition: TClassRef.h:75
TClassRef is used to implement a permanent reference to a TClass object.
Definition: TClassRef.h:33
char Char_t
Definition: RtypesCore.h:29
Bool_t IsStaticData(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:970
static Name2ClassRefIndex_t g_name2classrefidx
Definition: Cppyy.cxx:46
static ClassInfo_t * GetGlobalNamespaceInfo()
Definition: Cppyy.cxx:253
size_t SizeOf(TCppType_t klass)
Definition: Cppyy.cxx:192
Long_t TCppIndex_t
Definition: Cppyy.h:17
Bool_t IsConstMethod(TCppMethod_t)
Definition: Cppyy.cxx:782
TCppIndex_t GetNumMethods(TCppScope_t scope)
Definition: Cppyy.cxx:632
Each ROOT class (see TClass) has a linked list of methods.
Definition: TMethod.h:40
std::string ShortType(const char *typeDesc, int mode)
Return the absolute type of typeDesc.
void CallV(TCppMethod_t method, TCppObject_t self, void *args)
Definition: Cppyy.cxx:426
#define NULL
Definition: Rtypes.h:82
static Cppyy::TCppScope_t declaring_scope(Cppyy::TCppMethod_t method)
Definition: Cppyy.cxx:111
Bool_t IsBasic() const
Return true if data member is a basic type, e.g. char, int, long...
Long_t Property() const
Get property description word. For meaning of bits see EProperty.
std::map< Cppyy::TCppMethod_t, CallFunc_t * > Method2CallFunc_t
Definition: Cppyy.cxx:48
double result[121]
unsigned char UChar_t
Definition: RtypesCore.h:34
TCppObject_t Construct(TCppType_t type)
Definition: Cppyy.cxx:239
void Destruct(TCppType_t type, TCppObject_t instance)
Definition: Cppyy.cxx:245
TMethod * GetMethodAny(const char *method)
Return pointer to method without looking at parameters.
Definition: TClass.cxx:4027
Long_t ExtraProperty() const
Get property description word. For meaning of bits see EProperty.
Definition: TFunction.cxx:191
virtual Int_t IndexOf(const TObject *obj) const
R__EXTERN TInterpreter * gCling
Definition: TInterpreter.h:504
#define I(x, y, z)
const Bool_t kTRUE
Definition: Rtypes.h:91
TObject * obj
TList * GetListOfMethods(Bool_t load=kTRUE)
Return list containing the TMethods of a class.
Definition: TClass.cxx:3508
std::string GetMethodArgDefault(TCppMethod_t, int iarg)
Definition: Cppyy.cxx:764
Vc_ALWAYS_INLINE_L T *Vc_ALWAYS_INLINE_R malloc(size_t n)
Allocates memory on the Heap with alignment and padding suitable for vectorized access.
Definition: memory.h:67
ptrdiff_t TCppScope_t
Definition: Cppyy.h:12
static char * At(UInt_t index)
Returns class at index from sorted class table.
void DeallocateFunctionArgs(void *args)
Definition: Cppyy.cxx:495
const char * cd(char *path=0)
Definition: rootalias.C:45
Bool_t IsEnum(const std::string &type_name)
Definition: Cppyy.cxx:528
std::string GetScopeName(TCppScope_t parent, TCppIndex_t iscope)
Definition: Cppyy.cxx:128
virtual Long_t Property() const
Get property description word. For meaning of bits see EProperty.
Definition: TGlobal.cxx:148
Int_t Size() const
Return size of object of this class.
Definition: TClass.cxx:5243
std::vector< TFunction > GlobalFuncs_t
Definition: Cppyy.cxx:51
const int SMALL_ARGS_N
Definition: Cppyy.cxx:37