Logo ROOT   6.07/09
Reference Guide
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;
47 
48 typedef std::map< Cppyy::TCppMethod_t, CallFunc_t* > Method2CallFunc_t;
50 
51 typedef std::vector< TFunction > GlobalFuncs_t;
53 
54 typedef std::vector< TGlobal* > GlobalVars_t;
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 );
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  size_t s = gInterpreter->ClassInfo_Size(cr->GetClassInfo());
477  void* obj = malloc( s );
478  if ( FastCall( method, args, self, obj ) )
479  return (TCppObject_t)obj;
480  return (TCppObject_t)0;
481 }
482 
484  TCppScope_t /* scope */, TCppIndex_t /* imeth */ )
485 {
486  return (TCppMethPtrGetter_t)0;
487 }
488 
489 
490 // handling of function argument buffer --------------------------------------
491 void* Cppyy::AllocateFunctionArgs( size_t nargs )
492 {
493  return new TParameter[nargs];
494 }
495 
497 {
498  delete [] (TParameter*)args;
499 }
500 
502 {
503  return sizeof( TParameter );
504 }
505 
507 {
508  return offsetof( TParameter, fTypeCode );
509 }
510 
511 
512 // scope reflection information ----------------------------------------------
514 // Test if this scope represents a namespace.
515  TClassRef& cr = type_from_handle( scope );
516  if ( cr.GetClass() )
517  return cr->Property() & kIsNamespace;
518  return kFALSE;
519 }
520 
522 // Test if this type may not be instantiated.
523  TClassRef& cr = type_from_handle( klass );
524  if ( cr.GetClass() )
525  return cr->Property() & kIsAbstract;
526  return kFALSE;
527 }
528 
529 Bool_t Cppyy::IsEnum( const std::string& type_name ) {
530  return gInterpreter->ClassInfo_IsEnum( type_name.c_str() );
531 }
532 
533 
534 // class reflection information ----------------------------------------------
535 std::string Cppyy::GetFinalName( TCppType_t klass )
536 {
537  if ( klass == GLOBAL_HANDLE ) // due to CLING WORKAROUND in InitConverters_
538  return "";
539  // TODO: either this or GetScopedFinalName is wrong
540  TClassRef& cr = type_from_handle( klass );
541  return cr->GetName();
542 }
543 
545 {
546  // TODO: either this or GetFinalName is wrong
547  TClassRef& cr = type_from_handle( klass );
548  return cr->GetName();
549 }
550 
552 {
553 // Always TRUE for now (pre-empts certain optimizations).
554  return kTRUE;
555 }
556 
558 {
559 // Get the total number of base classes that this class has.
560  TClassRef& cr = type_from_handle( klass );
561  if ( cr.GetClass() && cr->GetListOfBases() != 0 )
562  return cr->GetListOfBases()->GetSize();
563  return 0;
564 }
565 
566 std::string Cppyy::GetBaseName( TCppType_t klass, TCppIndex_t ibase )
567 {
568  TClassRef& cr = type_from_handle( klass );
569  return ((TBaseClass*)cr->GetListOfBases()->At( ibase ))->GetName();
570 }
571 
573 {
574  if ( derived == base )
575  return kTRUE;
576  TClassRef& derived_type = type_from_handle( derived );
577  TClassRef& base_type = type_from_handle( base );
578  return derived_type->GetBaseClass( base_type ) != 0;
579 }
580 
581 void Cppyy::AddSmartPtrType( const std::string& type_name ) {
582  gSmartPtrTypes.insert( ResolveName( type_name ) );
583 }
584 
585 Bool_t Cppyy::IsSmartPtr( const std::string& type_name ) {
586 // checks if typename denotes a smart pointer
587 // TODO: perhaps make this stricter?
588  const std::string& real_name = ResolveName( type_name );
589  return gSmartPtrTypes.find(
590  real_name.substr( 0,real_name.find( "<" ) ) ) != gSmartPtrTypes.end();
591 }
592 
593 // type offsets --------------------------------------------------------------
594 ptrdiff_t Cppyy::GetBaseOffset( TCppType_t derived, TCppType_t base,
595  TCppObject_t address, int direction, bool rerror )
596 {
597 // calculate offsets between declared and actual type, up-cast: direction > 0; down-cast: direction < 0
598  if ( derived == base || !(base && derived) )
599  return (ptrdiff_t)0;
600 
601  TClassRef& cd = type_from_handle( derived );
602  TClassRef& cb = type_from_handle( base );
603 
604  if ( !cd.GetClass() || !cb.GetClass() )
605  return (ptrdiff_t)0;
606 
607  Long_t offset = -1;
608  if ( ! (cd->GetClassInfo() && cb->GetClassInfo()) ) { // gInterpreter requirement
609  // would like to warn, but can't quite determine error from intentional
610  // hiding by developers, so only cover the case where we really should have
611  // had a class info, but apparently don't:
612  if ( cd->IsLoaded() ) {
613  // warn to allow diagnostics
614  std::ostringstream msg;
615  msg << "failed offset calculation between " << cb->GetName() << " and " << cd->GetName();
616  PyErr_Warn( PyExc_RuntimeWarning, const_cast<char*>( msg.str().c_str() ) );
617  }
618 
619  // return -1 to signal caller NOT to apply offset
620  return rerror ? (ptrdiff_t)offset : 0;
621  }
622 
623  offset = gInterpreter->ClassInfo_GetBaseOffset(
624  cd->GetClassInfo(), cb->GetClassInfo(), (void*)address, direction > 0 );
625  if ( offset == -1 ) // Cling error, treat silently
626  return rerror ? (ptrdiff_t)offset : 0;
627 
628  return (ptrdiff_t)(direction < 0 ? -offset : offset);
629 }
630 
631 
632 // method/function reflection information ------------------------------------
634 {
635  TClassRef& cr = type_from_handle( scope );
636  if ( cr.GetClass() && cr->GetListOfMethods() ) {
638  if ( nMethods == (TCppIndex_t)0 ) {
639  std::string clName = GetScopedFinalName( scope );
640  if ( clName.find( '<' ) != std::string::npos ) {
641  // chicken-and-egg problem: TClass does not know about methods until instantiation: force it
642  if ( TClass::GetClass( ("std::" + clName).c_str() ) )
643  clName = "std::" + clName;
644  std::ostringstream stmt;
645  stmt << "template class " << clName << ";";
646  gInterpreter->Declare( stmt.str().c_str() );
647  // now reload the methods
648  return (TCppIndex_t)cr->GetListOfMethods( kTRUE )->GetSize();
649  }
650  }
651  return nMethods;
652  } else if ( scope == (TCppScope_t)GLOBAL_HANDLE ) {
653  // enforce lazines by denying the existence of methods
654  return (TCppIndex_t)0;
655  }
656  return (TCppIndex_t)0;
657 }
658 
660 {
661  return (TCppIndex_t)0;
662 }
663 
664 std::vector< Cppyy::TCppMethod_t > Cppyy::GetMethodsFromName(
665  TCppScope_t scope, const std::string& name )
666 {
667 // TODO: this method assumes that the call for this name is made only
668 // once, and thus there is no need to store the results of the search
669 // in g_globalfuncs ... probably true, but needs verification
670  std::vector< TCppMethod_t > methods;
671  if ( scope == GLOBAL_HANDLE ) {
672  TCollection* funcs = gROOT->GetListOfGlobalFunctions( kTRUE );
673  g_globalfuncs.reserve(funcs->GetSize());
674 
675  TIter ifunc(funcs);
676 
677  TFunction* func = 0;
678  while ( (func = (TFunction*)ifunc.Next()) ) {
679  // cover not only direct matches, but also template matches
680  std::string fn = func->GetName();
681  if ( fn.rfind( name, 0 ) == 0 ) {
682  // either match exactly, or match the name as template
683  if ( (name.size() == fn.size()) ||
684  (name.size() < fn.size() && fn[name.size()] == '<') ) {
685  methods.push_back( (TCppMethod_t)func );
686  }
687  }
688  }
689  } else {
690  TClassRef& cr = type_from_handle( scope );
691  if ( cr.GetClass() ) {
692  // todo: handle overloads
693  TMethod* m = cr->GetMethodAny( name.c_str() );
694  if ( m ) methods.push_back( (TCppMethod_t)m );
695  }
696  }
697 
698  return methods;
699 }
700 
702 {
703  TFunction* f = type_get_method( scope, imeth );
704  return (Cppyy::TCppMethod_t)f;
705 }
706 
707 std::string Cppyy::GetMethodName( TCppMethod_t method )
708 {
709  if ( method ) {
710  std::string name = ((TFunction*)method)->GetName();
711  //if ( IsMethodTemplate( method ) )
712  // return name.substr( 0, name.find('<') );
713  return name;
714  }
715  return "<unknown>";
716 }
717 
719 {
720  if ( method ) {
721  TFunction* f = (TFunction*)method;
722  if ( f->ExtraProperty() & kIsConstructor )
723  return "constructor";
724  return f->GetReturnTypeNormalizedName();
725  }
726  return "<unknown>";
727 }
728 
730 {
731  if ( method )
732  return ((TFunction*)method)->GetNargs();
733  return 0;
734 }
735 
737 {
738  if ( method ) {
739  TFunction* f = (TFunction*)method;
740  return (TCppIndex_t)(f->GetNargs() - f->GetNargsOpt());
741  }
742  return (TCppIndex_t)0;
743 }
744 
745 std::string Cppyy::GetMethodArgName( TCppMethod_t method, int iarg )
746 {
747  if ( method ) {
748  TFunction* f = (TFunction*)method;
749  TMethodArg* arg = (TMethodArg*)f->GetListOfMethodArgs()->At( iarg );
750  return arg->GetName();
751  }
752  return "<unknown>";
753 }
754 
755 std::string Cppyy::GetMethodArgType( TCppMethod_t method, int iarg )
756 {
757  if ( method ) {
758  TFunction* f = (TFunction*)method;
759  TMethodArg* arg = (TMethodArg*)f->GetListOfMethodArgs()->At( iarg );
760  return arg->GetTypeNormalizedName();
761  }
762  return "<unknown>";
763 }
764 
765 std::string Cppyy::GetMethodArgDefault( TCppMethod_t method, int iarg )
766 {
767  if ( method ) {
768  TFunction* f = (TFunction*)method;
769  TMethodArg* arg = (TMethodArg*)f->GetListOfMethodArgs()->At( iarg );
770  const char* def = arg->GetDefault();
771  if ( def )
772  return def;
773  }
774 
775  return "";
776 }
777 
778 std::string Cppyy::GetMethodSignature( TCppScope_t /* scope */, TCppIndex_t /* imeth */ )
779 {
780  return "<unknown>";
781 }
782 
784 {
785  if ( method ) {
786  TFunction* f = (TFunction*)method;
787  return f->Property() & kIsConstMethod;
788  }
789  return kFALSE;
790 }
791 
792 
794 {
795  if ( method ) {
796  TFunction* f = (TFunction*)method;
797  std::string name = f->GetName();
798  return (name[name.size()-1] == '>') && (name.find('<') != std::string::npos);
799  }
800  return kFALSE;
801 }
802 
804  TCppScope_t /* scope */, TCppIndex_t /* imeth */ )
805 {
806  return (TCppIndex_t)0;
807 }
808 
810  TCppScope_t /* scope */, TCppIndex_t /* imeth */, TCppIndex_t /* iarg */ )
811 {
812  return "<unknown>";
813 }
814 
816  TCppScope_t /* scope */, TCppType_t /* lc */, TCppType_t /* rc */, const std::string& /* op */ )
817 {
818  return (TCppIndex_t)0;
819 }
820 
821 // method properties ---------------------------------------------------------
823 {
824  if ( method ) {
825  TFunction* f = (TFunction*)method;
826  return f->ExtraProperty() & kIsConstructor;
827  }
828  return kFALSE;
829 }
830 
832 {
833  if ( method ) {
834  TFunction* f = (TFunction*)method;
835  return f->Property() & kIsPublic;
836  }
837  return kFALSE;
838 }
839 
841 {
842  if ( method ) {
843  TFunction* f = (TFunction*)method;
844  return f->Property() & kIsStatic;
845  }
846  return kFALSE;
847 }
848 
849 // data member reflection information ----------------------------------------
851 {
852  TClassRef& cr = type_from_handle( scope );
853  if ( cr.GetClass() && cr->GetListOfDataMembers() )
854  return cr->GetListOfDataMembers()->GetSize();
855  else if ( scope == (TCppScope_t)GLOBAL_HANDLE ) {
856  std::cerr << " global data should be retrieved lazily " << std::endl;
857  TCollection* vars = gROOT->GetListOfGlobals( kTRUE );
858  if ( g_globalvars.size() != (GlobalVars_t::size_type)vars->GetSize() ) {
859  g_globalvars.clear();
860  g_globalvars.reserve(vars->GetSize());
861 
862  TIter ivar(vars);
863 
864  TGlobal* var = 0;
865  while ( (var = (TGlobal*)ivar.Next()) )
866  g_globalvars.push_back( var );
867  }
868  return (TCppIndex_t)g_globalvars.size();
869  }
870  return (TCppIndex_t)0;
871 }
872 
874 {
875  TClassRef& cr = type_from_handle( scope );
876  if (cr.GetClass()) {
877  TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
878  return m->GetName();
879  }
880  assert( scope == (TCppScope_t)GLOBAL_HANDLE );
881  TGlobal* gbl = g_globalvars[ idata ];
882  return gbl->GetName();
883 }
884 
886 {
887  if ( scope == GLOBAL_HANDLE ) {
888  TGlobal* gbl = g_globalvars[ idata ];
889  std::string fullType = gbl->GetFullTypeName();
890  if ( fullType[fullType.size()-1] == '*' && \
891  fullType.find( "char", 0, 4 ) == std::string::npos )
892  fullType.append( "*" );
893  else if ( (int)gbl->GetArrayDim() > 1 )
894  fullType.append( "*" );
895  else if ( (int)gbl->GetArrayDim() == 1 ) {
896  std::ostringstream s;
897  s << '[' << gbl->GetMaxIndex( 0 ) << ']' << std::ends;
898  fullType.append( s.str() );
899  }
900  return fullType;
901  }
902 
903  TClassRef& cr = type_from_handle( scope );
904  if ( cr.GetClass() ) {
905  TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
906  std::string fullType = m->GetTrueTypeName();
907  if ( (int)m->GetArrayDim() > 1 || (!m->IsBasic() && m->IsaPointer()) )
908  fullType.append( "*" );
909  else if ( (int)m->GetArrayDim() == 1 ) {
910  std::ostringstream s;
911  s << '[' << m->GetMaxIndex( 0 ) << ']' << std::ends;
912  fullType.append( s.str() );
913  }
914  return fullType;
915  }
916 
917  return "<unknown>";
918 }
919 
921 {
922  if ( scope == GLOBAL_HANDLE ) {
923  TGlobal* gbl = g_globalvars[ idata ];
924  return (ptrdiff_t)gbl->GetAddress();
925  }
926 
927  TClassRef& cr = type_from_handle( scope );
928  if ( cr.GetClass() ) {
929  TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
930  return (ptrdiff_t)m->GetOffsetCint(); // yes, CINT ...
931  }
932 
933  return (ptrdiff_t)0;
934 }
935 
937 {
938  if ( scope == GLOBAL_HANDLE ) {
939  TGlobal* gb = (TGlobal*)gROOT->GetListOfGlobals( kTRUE )->FindObject( name.c_str() );
940  if ( gb && gb->GetAddress() && gb->GetAddress() != (void*)-1 ) {
941  g_globalvars.push_back( gb );
942  return g_globalvars.size() - 1;
943  }
944 
945  } else {
946  TClassRef& cr = type_from_handle( scope );
947  if ( cr.GetClass() ) {
948  TDataMember* dm =
949  (TDataMember*)cr->GetListOfDataMembers()->FindObject( name.c_str() );
950  // TODO: turning this into an index is silly ...
951  if ( dm ) return (TCppIndex_t)cr->GetListOfDataMembers()->IndexOf( dm );
952  }
953  }
954 
955  return (TCppIndex_t)-1;
956 }
957 
958 
959 // data member properties ----------------------------------------------------
961 {
962  if ( scope == GLOBAL_HANDLE )
963  return kTRUE;
964  TClassRef& cr = type_from_handle( scope );
965  if ( cr->Property() & kIsNamespace )
966  return kTRUE;
967  TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
968  return m->Property() & kIsPublic;
969 }
970 
972 {
973  if ( scope == GLOBAL_HANDLE )
974  return kTRUE;
975  TClassRef& cr = type_from_handle( scope );
976  if ( cr->Property() & kIsNamespace )
977  return kTRUE;
978  TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
979  return m->Property() & kIsStatic;
980 }
981 
983 {
984  if ( scope == GLOBAL_HANDLE ) {
985  TGlobal* gbl = g_globalvars[ idata ];
986  return gbl->Property() & kIsConstant;
987  }
988  TClassRef& cr = type_from_handle( scope );
989  if ( cr.GetClass() ) {
990  TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
991  return m->Property() & kIsConstant;
992  }
993  return kFALSE;
994 }
995 
997 {
998  if ( scope == GLOBAL_HANDLE ) {
999  TGlobal* gbl = g_globalvars[ idata ];
1000  return gbl->Property() & kIsEnum;
1001  }
1002  TClassRef& cr = type_from_handle( scope );
1003  if ( cr.GetClass() ) {
1004  TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
1005  return m->Property() & kIsEnum;
1006  }
1007  return kFALSE;
1008 }
1009 
1011 {
1012  if ( scope == GLOBAL_HANDLE ) {
1013  TGlobal* gbl = g_globalvars[ idata ];
1014  return gbl->GetMaxIndex( dimension );
1015  }
1016  TClassRef& cr = type_from_handle( scope );
1017  if ( cr.GetClass() ) {
1018  TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
1019  return m->GetMaxIndex( dimension );
1020  }
1021  return (Int_t)-1;
1022 }
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:501
static double B[]
TList * GetListOfBases()
Return list containing the TBaseClass(es) of a class.
Definition: TClass.cxx:3449
#define CPPYY_IMP_CALL(typecode, rtype)
Definition: Cppyy.cxx:420
virtual CallFuncIFacePtr_t CallFunc_IFacePtr(CallFunc_t *) const
Definition: TInterpreter.h:288
std::string GetScopedFinalName(TCppType_t type)
Definition: Cppyy.cxx:544
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:513
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:815
All ROOT classes may have RTTI (run time type identification) support added.
Definition: TDataMember.h:33
double T(double x)
Definition: ChebyshevPol.h:34
Bool_t IsMethodTemplate(TCppMethod_t)
Definition: Cppyy.cxx:793
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:594
Bool_t IsPublicMethod(TCppMethod_t method)
Definition: Cppyy.cxx:831
static void copy_args(void *args_, void **vargs)
Definition: Cppyy.cxx:332
TCppIndex_t GetNumBases(TCppType_t type)
Definition: Cppyy.cxx:557
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:5671
TCppIndex_t GetMethodReqArgs(TCppMethod_t)
Definition: Cppyy.cxx:736
std::vector< TCppMethod_t > GetMethodsFromName(TCppScope_t scope, const std::string &name)
Definition: Cppyy.cxx:664
#define gROOT
Definition: TROOT.h:364
#define H(x, y, z)
TList * GetListOfDataMembers(Bool_t load=kTRUE)
Return list containing the TDataMembers of a class.
Definition: TClass.cxx:3559
Bool_t IsAbstract(TCppType_t type)
Definition: Cppyy.cxx:521
std::string GetFinalName(TCppType_t type)
Definition: Cppyy.cxx:535
std::string GetMethodSignature(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:778
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:920
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:515
Bool_t IsEnumData(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:996
std::string GetDatamemberType(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:885
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
#define malloc
Definition: civetweb.c:818
Int_t GetDimensionSize(TCppScope_t scope, TCppIndex_t idata, int dimension)
Definition: Cppyy.cxx:1010
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
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:566
Char_t * CallS(TCppMethod_t method, TCppObject_t self, void *args)
Definition: Cppyy.cxx:450
TCppIndex_t GetMethodIndexAt(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:659
static TFunction * type_get_method(Cppyy::TCppType_t klass, Cppyy::TCppIndex_t idx)
Definition: Cppyy.cxx:101
Definition: Cppyy.h:10
TCppIndex_t GetMethodNumTemplateArgs(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:803
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:551
void * New(ENewType defConstructor=kClassNew, Bool_t quiet=kFALSE) const
Return a pointer to a newly allocated object of this class.
Definition: TClass.cxx:4702
TClass * GetActualClass(const void *object) const
Return a pointer the the real class of the object.
Definition: TClass.cxx:2525
TCppMethPtrGetter_t GetMethPtrGetter(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:483
std::string ResolveTypedef(const char *tname, bool resolveAll=false)
TCppIndex_t GetNumDatamembers(TCppScope_t scope)
Definition: Cppyy.cxx:850
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:982
static Method2CallFunc_t g_method2callfunc
Definition: Cppyy.cxx:49
void CallDestructor(TCppType_t type, TCppObject_t self)
Definition: Cppyy.cxx:466
static std::set< std::string > gSmartPtrTypes
Definition: Cppyy.cxx:61
Bool_t IsComplete(const std::string &type_name)
Definition: Cppyy.cxx:206
TCppMethod_t GetMethod(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:701
size_t GetFunctionArgTypeoffset()
Definition: Cppyy.cxx:506
std::string GetMethodTemplateArgName(TCppScope_t scope, TCppIndex_t imeth, TCppIndex_t iarg)
Definition: Cppyy.cxx:809
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:2572
Bool_t IsConstructor(TCppMethod_t method)
Definition: Cppyy.cxx:822
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
Named parameter, streamable and storable.
Definition: TParameter.h:49
#define F(x, y, z)
void AddSmartPtrType(const std::string &)
Definition: Cppyy.cxx:581
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:960
std::string GetMethodName(TCppMethod_t)
Definition: Cppyy.cxx:707
TRandom2 r(17)
Basic data type descriptor (datatype information is obtained from CINT).
Definition: TDataType.h:46
PyObject * fValue
ClassInfo_t * GetClassInfo() const
Definition: TClass.h:391
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:5059
void * AllocateFunctionArgs(size_t nargs)
Definition: Cppyy.cxx:491
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:936
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
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&#39;s memory.
Definition: TClass.cxx:5545
TClass * GetClass() const
Definition: TMethod.h:57
Bool_t IsSubtype(TCppType_t derived, TCppType_t base)
Definition: Cppyy.cxx:572
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
double f(double x)
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:718
virtual Int_t IndexOf(const TObject *obj) const
Return index of object in collection.
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
#define free
Definition: civetweb.c:821
double func(double *x, double *p)
Definition: stressTF1.cxx:213
TCppIndex_t GetMethodNumArgs(TCppMethod_t)
Definition: Cppyy.cxx:729
std::string GetMethodArgName(TCppMethod_t, int iarg)
Definition: Cppyy.cxx:745
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:2882
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:755
Bool_t IsSmartPtr(const std::string &)
Definition: Cppyy.cxx:585
Bool_t IsStaticMethod(TCppMethod_t method)
Definition: Cppyy.cxx:840
std::string GetDatamemberName(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:873
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
typedef void((*Func_t)())
Bool_t IsStaticData(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:971
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:783
TCppIndex_t GetNumMethods(TCppScope_t scope)
Definition: Cppyy.cxx:633
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
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
#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:4127
void *(* TCppMethPtrGetter_t)(TCppObject_t)
Definition: Cppyy.h:18
Long_t ExtraProperty() const
Get property description word. For meaning of bits see EProperty.
Definition: TFunction.cxx:191
R__EXTERN TInterpreter * gCling
Definition: TInterpreter.h:517
#define I(x, y, z)
const Bool_t kTRUE
Definition: Rtypes.h:91
TList * GetListOfMethods(Bool_t load=kTRUE)
Return list containing the TMethods of a class.
Definition: TClass.cxx:3608
std::string GetMethodArgDefault(TCppMethod_t, int iarg)
Definition: Cppyy.cxx:765
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:496
Bool_t IsEnum(const std::string &type_name)
Definition: Cppyy.cxx:529
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
char name[80]
Definition: TGX11.cxx:109
Int_t Size() const
Return size of object of this class.
Definition: TClass.cxx:5344
std::vector< TFunction > GlobalFuncs_t
Definition: Cppyy.cxx:51
const int SMALL_ARGS_N
Definition: Cppyy.cxx:37