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