Logo ROOT   6.18/05
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 if (scope == GLOBAL_HANDLE)
559 return kTRUE;
560
561 TClassRef& cr = type_from_handle( scope );
562 if ( cr.GetClass() )
563 return cr->Property() & kIsNamespace;
564 return kFALSE;
565}
566
568// Test if this type may not be instantiated.
569 TClassRef& cr = type_from_handle( klass );
570 if ( cr.GetClass() )
571 return cr->Property() & kIsAbstract;
572 return kFALSE;
573}
574
575Bool_t Cppyy::IsEnum( const std::string& type_name ) {
576 return gInterpreter->ClassInfo_IsEnum( type_name.c_str() );
577}
578
579
580// class reflection information ----------------------------------------------
581std::string Cppyy::GetFinalName( TCppType_t klass )
582{
583 if ( klass == GLOBAL_HANDLE ) // due to CLING WORKAROUND in InitConverters_
584 return "";
585 // TODO: either this or GetScopedFinalName is wrong
586 TClassRef& cr = type_from_handle( klass );
587 return cr->GetName();
588}
589
591{
592 // TODO: either this or GetFinalName is wrong
593 TClassRef& cr = type_from_handle( klass );
594 return cr->GetName();
595}
596
598{
599// Always TRUE for now (pre-empts certain optimizations).
600 return kTRUE;
601}
602
604{
605// Get the total number of base classes that this class has.
606 TClassRef& cr = type_from_handle( klass );
607 if ( cr.GetClass() && cr->GetListOfBases() != 0 )
608 return cr->GetListOfBases()->GetSize();
609 return 0;
610}
611
612std::string Cppyy::GetBaseName( TCppType_t klass, TCppIndex_t ibase )
613{
614 TClassRef& cr = type_from_handle( klass );
615 return ((TBaseClass*)cr->GetListOfBases()->At( ibase ))->GetName();
616}
617
619{
620 if ( derived == base )
621 return kTRUE;
622 TClassRef& derived_type = type_from_handle( derived );
623 TClassRef& base_type = type_from_handle( base );
624 return derived_type->GetBaseClass( base_type ) != 0;
625}
626
627void Cppyy::AddSmartPtrType( const std::string& type_name ) {
628 gSmartPtrTypes.insert( ResolveName( type_name ) );
629}
630
631Bool_t Cppyy::IsSmartPtr( const std::string& type_name ) {
632// checks if typename denotes a smart pointer
633// TODO: perhaps make this stricter?
634 const std::string& real_name = ResolveName( type_name );
635 return gSmartPtrTypes.find(
636 real_name.substr( 0,real_name.find( "<" ) ) ) != gSmartPtrTypes.end();
637}
638
639// type offsets --------------------------------------------------------------
641 TCppObject_t address, int direction, bool rerror )
642{
643// calculate offsets between declared and actual type, up-cast: direction > 0; down-cast: direction < 0
644 if ( derived == base || !(base && derived) )
645 return (ptrdiff_t)0;
646
647 TClassRef& cd = type_from_handle( derived );
648 TClassRef& cb = type_from_handle( base );
649
650 if ( !cd.GetClass() || !cb.GetClass() )
651 return (ptrdiff_t)0;
652
653 Long_t offset = -1;
654 if ( ! (cd->GetClassInfo() && cb->GetClassInfo()) ) { // gInterpreter requirement
655 // would like to warn, but can't quite determine error from intentional
656 // hiding by developers, so only cover the case where we really should have
657 // had a class info, but apparently don't:
658 if ( cd->IsLoaded() ) {
659 // warn to allow diagnostics
660 std::ostringstream msg;
661 msg << "failed offset calculation between " << cb->GetName() << " and " << cd->GetName();
662 PyErr_Warn( PyExc_RuntimeWarning, const_cast<char*>( msg.str().c_str() ) );
663 }
664
665 // return -1 to signal caller NOT to apply offset
666 return rerror ? (ptrdiff_t)offset : 0;
667 }
668
669 offset = gInterpreter->ClassInfo_GetBaseOffset(
670 cd->GetClassInfo(), cb->GetClassInfo(), (void*)address, direction > 0 );
671 if ( offset == -1 ) // Cling error, treat silently
672 return rerror ? (ptrdiff_t)offset : 0;
673
674 return (ptrdiff_t)(direction < 0 ? -offset : offset);
675}
676
677
678// method/function reflection information ------------------------------------
680{
681 TClassRef& cr = type_from_handle( scope );
682 if ( cr.GetClass() && cr->GetListOfMethods() ) {
684 if ( nMethods == (TCppIndex_t)0 ) {
685 std::string clName = GetScopedFinalName( scope );
686 if ( clName.find( '<' ) != std::string::npos ) {
687 // chicken-and-egg problem: TClass does not know about methods until instantiation: force it
688 if ( TClass::GetClass( ("std::" + clName).c_str() ) )
689 clName = "std::" + clName;
690 std::ostringstream stmt;
691 stmt << "template class " << clName << ";";
692 gInterpreter->Declare( stmt.str().c_str() );
693 // now reload the methods
694 return (TCppIndex_t)cr->GetListOfMethods( kTRUE )->GetSize();
695 }
696 }
697 return nMethods;
698 } else if ( scope == (TCppScope_t)GLOBAL_HANDLE ) {
699 // enforce lazines by denying the existence of methods
700 return (TCppIndex_t)0;
701 }
702 return (TCppIndex_t)0;
703}
704
706{
707 return (TCppIndex_t)0;
708}
709
710std::vector< Cppyy::TCppMethod_t > Cppyy::GetMethodsFromName(
711 TCppScope_t scope, const std::string& name, bool alsoInBases )
712{
713// TODO: this method assumes that the call for this name is made only
714// once, and thus there is no need to store the results of the search
715// in g_globalfuncs ... probably true, but needs verification
716 std::vector< TCppMethod_t > methods;
717 if ( scope == GLOBAL_HANDLE ) {
718 TCollection* funcs = gROOT->GetListOfGlobalFunctions( kTRUE );
719 g_globalfuncs.reserve(funcs->GetSize());
720
721 TIter ifunc(funcs);
722
723 TFunction* func = 0;
724 while ( (func = (TFunction*)ifunc.Next()) ) {
725 // cover not only direct matches, but also template matches
726 std::string fn = func->GetName();
727 if ( fn.rfind( name, 0 ) == 0 ) {
728 // either match exactly, or match the name as template
729 if ( (name.size() == fn.size()) ||
730 (name.size() < fn.size() && fn[name.size()] == '<') ) {
731 methods.push_back( (TCppMethod_t)func );
732 }
733 }
734 }
735 } else {
736 TClassRef& cr = type_from_handle( scope );
737 if ( cr.GetClass() ) {
738 // todo: handle overloads
739 TMethod* m = alsoInBases ? cr->GetMethodAllAny( name.c_str() ) : cr->GetMethodAny( name.c_str() );
740 if ( m ) methods.push_back( (TCppMethod_t)m );
741 }
742 }
743
744 return methods;
745}
746
748{
749 TFunction* f = type_get_method( scope, imeth );
750 return (Cppyy::TCppMethod_t)f;
751}
752
754{
755 if ( method ) {
756 std::string name = ((TFunction*)method)->GetName();
757 //if ( IsMethodTemplate( method ) )
758 // return name.substr( 0, name.find('<') );
759 return name;
760 }
761 return "<unknown>";
762}
763
765{
766 if ( method ) {
767 TFunction* f = (TFunction*)method;
768 if ( f->ExtraProperty() & kIsConstructor )
769 return "constructor";
770 return f->GetReturnTypeNormalizedName();
771 }
772 return "<unknown>";
773}
774
776{
777 if ( method )
778 return ((TFunction*)method)->GetNargs();
779 return 0;
780}
781
783{
784 if ( method ) {
785 TFunction* f = (TFunction*)method;
786 return (TCppIndex_t)(f->GetNargs() - f->GetNargsOpt());
787 }
788 return (TCppIndex_t)0;
789}
790
791std::string Cppyy::GetMethodArgName( TCppMethod_t method, int iarg )
792{
793 if ( method ) {
794 TFunction* f = (TFunction*)method;
795 TMethodArg* arg = (TMethodArg*)f->GetListOfMethodArgs()->At( iarg );
796 return arg->GetName();
797 }
798 return "<unknown>";
799}
800
801std::string Cppyy::GetMethodArgType( TCppMethod_t method, int iarg )
802{
803 if ( method ) {
804 TFunction* f = (TFunction*)method;
805 TMethodArg* arg = (TMethodArg*)f->GetListOfMethodArgs()->At( iarg );
806 return arg->GetTypeNormalizedName();
807 }
808 return "<unknown>";
809}
810
811std::string Cppyy::GetMethodArgDefault( TCppMethod_t method, int iarg )
812{
813 if ( method ) {
814 TFunction* f = (TFunction*)method;
815 TMethodArg* arg = (TMethodArg*)f->GetListOfMethodArgs()->At( iarg );
816 const char* def = arg->GetDefault();
817 if ( def )
818 return def;
819 }
820
821 return "";
822}
823
824std::string Cppyy::GetMethodSignature( TCppScope_t /* scope */, TCppIndex_t /* imeth */ )
825{
826 return "<unknown>";
827}
828
830{
831 if ( method ) {
832 TFunction* f = (TFunction*)method;
833 return f->Property() & kIsConstMethod;
834 }
835 return kFALSE;
836}
837
838
839bool Cppyy::ExistsMethodTemplate(TCppScope_t scope, const std::string& name)
840{
841 if (scope == (TCppScope_t)GLOBAL_HANDLE) {
842 return (bool)gROOT->GetFunctionTemplate(name.c_str());
843 } else {
844 TClassRef& cr = type_from_handle(scope);
845 if (cr.GetClass())
846 return (bool)cr->GetFunctionTemplate(name.c_str());
847 }
848
849 return false;
850}
851
853 TCppScope_t scope, const std::string& name, const std::string& proto)
854{
855 if (scope == (TCppScope_t)GLOBAL_HANDLE) {
856 return (TCppMethod_t)gROOT->GetGlobalFunctionWithPrototype(name.c_str(), proto.c_str());
857 } else {
858 TClassRef& cr = type_from_handle(scope);
859 if (cr.GetClass())
860 return (TCppMethod_t)cr->GetMethodWithPrototype(name.c_str(), proto.c_str());
861 }
862
863 return (TCppMethod_t)nullptr;
864}
865
867{
868 if ( method ) {
869 TFunction* f = (TFunction*)method;
870 std::string name = f->GetName();
871 return (name[name.size()-1] == '>') && (name.find('<') != std::string::npos);
872 }
873 return kFALSE;
874}
875
877 TCppScope_t /* scope */, TCppIndex_t /* imeth */ )
878{
879 return (TCppIndex_t)0;
880}
881
883 TCppScope_t /* scope */, TCppIndex_t /* imeth */, TCppIndex_t /* iarg */ )
884{
885 return "<unknown>";
886}
887
889 TCppScope_t /* scope */, TCppType_t /* lc */, TCppType_t /* rc */, const std::string& /* op */ )
890{
891 return (TCppIndex_t)0;
892}
893
894// method properties ---------------------------------------------------------
896{
897 if ( method ) {
898 TFunction* f = (TFunction*)method;
899 return f->ExtraProperty() & kIsConstructor;
900 }
901 return kFALSE;
902}
903
905{
906 if ( method ) {
907 TFunction* f = (TFunction*)method;
908 return f->Property() & kIsPublic;
909 }
910 return kFALSE;
911}
912
914{
915 if ( method ) {
916 TFunction* f = (TFunction*)method;
917 return f->Property() & kIsStatic;
918 }
919 return kFALSE;
920}
921
922// data member reflection information ----------------------------------------
924{
925 TClassRef& cr = type_from_handle( scope );
926 if ( cr.GetClass() && cr->GetListOfDataMembers() )
927 return cr->GetListOfDataMembers()->GetSize();
928 else if ( scope == (TCppScope_t)GLOBAL_HANDLE ) {
929 std::cerr << " global data should be retrieved lazily " << std::endl;
930 TCollection* vars = gROOT->GetListOfGlobals( kTRUE );
931 if ( g_globalvars.size() != (GlobalVars_t::size_type)vars->GetSize() ) {
932 g_globalvars.clear();
933 g_globalvars.reserve(vars->GetSize());
934
935 TIter ivar(vars);
936
937 TGlobal* var = 0;
938 while ( (var = (TGlobal*)ivar.Next()) )
939 g_globalvars.push_back( var );
940 }
941 return (TCppIndex_t)g_globalvars.size();
942 }
943 return (TCppIndex_t)0;
944}
945
947{
948 TClassRef& cr = type_from_handle( scope );
949 if (cr.GetClass()) {
950 TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
951 return m->GetName();
952 }
953 assert( scope == (TCppScope_t)GLOBAL_HANDLE );
954 TGlobal* gbl = g_globalvars[ idata ];
955 return gbl->GetName();
956}
957
959{
960 if ( scope == GLOBAL_HANDLE ) {
961 TGlobal* gbl = g_globalvars[ idata ];
962 std::string fullType = gbl->GetFullTypeName();
963 if ( fullType[fullType.size()-1] == '*' && \
964 fullType.find( "char", 0, 4 ) == std::string::npos )
965 fullType.append( "*" );
966 else if ( (int)gbl->GetArrayDim() > 1 )
967 fullType.append( "*" );
968 else if ( (int)gbl->GetArrayDim() == 1 ) {
969 std::ostringstream s;
970 s << '[' << gbl->GetMaxIndex( 0 ) << ']' << std::ends;
971 fullType.append( s.str() );
972 }
973 return fullType;
974 }
975
976 TClassRef& cr = type_from_handle( scope );
977 if ( cr.GetClass() ) {
978 TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
979 std::string fullType = m->GetTrueTypeName();
980 if ( (int)m->GetArrayDim() > 1 || (!m->IsBasic() && m->IsaPointer()) )
981 fullType.append( "*" );
982 else if ( (int)m->GetArrayDim() == 1 ) {
983 std::ostringstream s;
984 s << '[' << m->GetMaxIndex( 0 ) << ']' << std::ends;
985 fullType.append( s.str() );
986 }
987 return fullType;
988 }
989
990 return "<unknown>";
991}
992
994{
995 if ( scope == GLOBAL_HANDLE ) {
996 TGlobal* gbl = g_globalvars[ idata ];
997 return (ptrdiff_t)gbl->GetAddress();
998 }
999
1000 TClassRef& cr = type_from_handle( scope );
1001 if ( cr.GetClass() ) {
1002 TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
1003 return (ptrdiff_t)m->GetOffsetCint(); // yes, CINT ...
1004 }
1005
1006 return (ptrdiff_t)0;
1007}
1008
1010{
1011 if ( scope == GLOBAL_HANDLE ) {
1012 TGlobal* gb = (TGlobal*)gROOT->GetListOfGlobals( kTRUE )->FindObject( name.c_str() );
1013 if ( gb && gb->GetAddress() && gb->GetAddress() != (void*)-1 ) {
1014 g_globalvars.push_back( gb );
1015 return g_globalvars.size() - 1;
1016 }
1017
1018 } else {
1019 TClassRef& cr = type_from_handle( scope );
1020 if ( cr.GetClass() ) {
1021 TDataMember* dm =
1022 (TDataMember*)cr->GetListOfDataMembers()->FindObject( name.c_str() );
1023 // TODO: turning this into an index is silly ...
1024 if ( dm ) return (TCppIndex_t)cr->GetListOfDataMembers()->IndexOf( dm );
1025 }
1026 }
1027
1028 return (TCppIndex_t)-1;
1029}
1030
1031
1032// data member properties ----------------------------------------------------
1034{
1035 if ( scope == GLOBAL_HANDLE )
1036 return kTRUE;
1037 TClassRef& cr = type_from_handle( scope );
1038 if ( cr->Property() & kIsNamespace )
1039 return kTRUE;
1040 TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
1041 return m->Property() & kIsPublic;
1042}
1043
1045{
1046 if ( scope == GLOBAL_HANDLE )
1047 return kTRUE;
1048 TClassRef& cr = type_from_handle( scope );
1049 if ( cr->Property() & kIsNamespace )
1050 return kTRUE;
1051 TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
1052 return m->Property() & kIsStatic;
1053}
1054
1056{
1057 if ( scope == GLOBAL_HANDLE ) {
1058 TGlobal* gbl = g_globalvars[ idata ];
1059 return gbl->Property() & kIsConstant;
1060 }
1061 TClassRef& cr = type_from_handle( scope );
1062 if ( cr.GetClass() ) {
1063 TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
1064 return m->Property() & kIsConstant;
1065 }
1066 return kFALSE;
1067}
1068
1070{
1071 if ( scope == GLOBAL_HANDLE ) {
1072 TGlobal* gbl = g_globalvars[ idata ];
1073 return gbl->Property() & kIsEnum;
1074 }
1075 TClassRef& cr = type_from_handle( scope );
1076 if ( cr.GetClass() ) {
1077 TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
1078 return m->Property() & kIsEnum;
1079 }
1080 return kFALSE;
1081}
1082
1084{
1085 if ( scope == GLOBAL_HANDLE ) {
1086 TGlobal* gbl = g_globalvars[ idata ];
1087 return gbl->GetMaxIndex( dimension );
1088 }
1089 TClassRef& cr = type_from_handle( scope );
1090 if ( cr.GetClass() ) {
1091 TDataMember* m = (TDataMember*)cr->GetListOfDataMembers()->At( idata );
1092 return m->GetMaxIndex( dimension );
1093 }
1094 return (Int_t)-1;
1095}
1096
1097// enum properties -----------------------------------------------------------
1098Cppyy::TCppEnum_t Cppyy::GetEnum(TCppScope_t scope, const std::string& enum_name)
1099{
1100 if (scope == GLOBAL_HANDLE)
1101 return (TCppEnum_t)gROOT->GetListOfEnums(kTRUE)->FindObject(enum_name.c_str());
1102
1103 TClassRef& cr = type_from_handle(scope);
1104 if (cr.GetClass())
1105 return (TCppEnum_t)cr->GetListOfEnums(kTRUE)->FindObject(enum_name.c_str());
1106
1107 return (TCppEnum_t)0;
1108}
1109
1111{
1112 return (TCppIndex_t)((TEnum*)etype)->GetConstants()->GetSize();
1113}
1114
1116{
1117 return ((TEnumConstant*)((TEnum*)etype)->GetConstants()->At(idata))->GetName();
1118}
1119
1121{
1122 TEnumConstant* ecst = (TEnumConstant*)((TEnum*)etype)->GetConstants()->At(idata);
1123 return (long long)ecst->GetValue();
1124}
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
char name[80]
Definition: TGX11.cxx:109
int type
Definition: TGX11.cxx:120
R__EXTERN TInterpreter * gCling
Definition: TInterpreter.h:554
#define gInterpreter
Definition: TInterpreter.h:553
#define gROOT
Definition: TROOT.h:414
typedef void((*Func_t)())
const char * proto
Definition: civetweb.c:16604
#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.
TClass instances represent classes, structs and namespaces in the ROOT type system.
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:4841
TMethod * GetMethodWithPrototype(const char *method, const char *proto, Bool_t objectIsConst=kFALSE, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
Find the method with a given prototype.
Definition: TClass.cxx:4326
void Destructor(void *obj, Bool_t dtorOnly=kFALSE)
Explicitly call destructor for object.
Definition: TClass.cxx:5198
TList * GetListOfEnums(Bool_t load=kTRUE)
Return a list containing the TEnums of a class.
Definition: TClass.cxx:3579
TList * GetListOfMethods(Bool_t load=kTRUE)
Return list containing the TMethods of a class.
Definition: TClass.cxx:3684
TClass * GetBaseClass(const char *classname)
Return pointer to the base class "classname".
Definition: TClass.cxx:2582
TList * GetListOfDataMembers(Bool_t load=kTRUE)
Return list containing the TDataMembers of a class.
Definition: TClass.cxx:3635
Int_t Size() const
Return size of object of this class.
Definition: TClass.cxx:5483
TList * GetListOfBases()
Return list containing the TBaseClass(es) of a class.
Definition: TClass.cxx:3525
Bool_t IsLoaded() const
Return true if the shared library of this class is currently in the a process's memory.
Definition: TClass.cxx:5691
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:5817
TMethod * GetMethodAllAny(const char *method)
Return pointer to method without looking at parameters.
Definition: TClass.cxx:4254
TMethod * GetMethodAny(const char *method)
Return pointer to method without looking at parameters.
Definition: TClass.cxx:4244
TClass * GetActualClass(const void *object) const
Return a pointer the the real class of the object.
Definition: TClass.cxx:2535
TFunctionTemplate * GetFunctionTemplate(const char *name)
Definition: TClass.cxx:3496
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:2895
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:321
TObject * Next()
Definition: TCollection.h:249
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition: TList.cxx:575
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:640
void DeallocateFunctionArgs(void *args)
Definition: Cppyy.cxx:539
Bool_t IsConstructor(TCppMethod_t method)
Definition: Cppyy.cxx:895
TCppMethod_t GetMethodTemplate(TCppScope_t scope, const std::string &name, const std::string &proto)
Definition: Cppyy.cxx:852
Bool_t IsPublicMethod(TCppMethod_t method)
Definition: Cppyy.cxx:904
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:801
Bool_t IsNamespace(TCppScope_t scope)
Definition: Cppyy.cxx:556
void *(* TCppMethPtrGetter_t)(TCppObject_t)
Definition: Cppyy.h:22
bool ExistsMethodTemplate(TCppScope_t scope, const std::string &name)
Definition: Cppyy.cxx:839
std::string GetMethodName(TCppMethod_t)
Definition: Cppyy.cxx:753
TCppIndex_t GetNumMethods(TCppScope_t scope)
Definition: Cppyy.cxx:679
void AddSmartPtrType(const std::string &)
Definition: Cppyy.cxx:627
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:923
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:782
Bool_t IsPublicData(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:1033
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
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:1083
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:824
TCppScope_t TCppType_t
Definition: Cppyy.h:16
long long GetEnumDataValue(TCppEnum_t, TCppIndex_t idata)
Definition: Cppyy.cxx:1120
TCppIndex_t GetMethodIndexAt(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:705
Bool_t IsComplete(const std::string &type_name)
Definition: Cppyy.cxx:249
std::string GetBaseName(TCppType_t type, TCppIndex_t ibase)
Definition: Cppyy.cxx:612
TCppIndex_t GetMethodNumTemplateArgs(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:876
std::string GetScopedFinalName(TCppType_t type)
Definition: Cppyy.cxx:590
void Deallocate(TCppType_t type, TCppObject_t instance)
Definition: Cppyy.cxx:277
Bool_t IsEnumData(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:1069
Bool_t IsEnum(const std::string &type_name)
Definition: Cppyy.cxx:575
Bool_t IsStaticData(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:1044
std::string GetEnumDataName(TCppEnum_t, TCppIndex_t idata)
Definition: Cppyy.cxx:1115
Bool_t HasComplexHierarchy(TCppType_t type)
Definition: Cppyy.cxx:597
Bool_t IsConstMethod(TCppMethod_t)
Definition: Cppyy.cxx:829
void * TCppEnum_t
Definition: Cppyy.h:19
std::string GetMethodArgDefault(TCppMethod_t, int iarg)
Definition: Cppyy.cxx:811
TCppIndex_t GetMethodNumArgs(TCppMethod_t)
Definition: Cppyy.cxx:775
TCppIndex_t GetDatamemberIndex(TCppScope_t scope, const std::string &name)
Definition: Cppyy.cxx:1009
Long_t TCppIndex_t
Definition: Cppyy.h:21
std::string GetMethodTemplateArgName(TCppScope_t scope, TCppIndex_t imeth, TCppIndex_t iarg)
Definition: Cppyy.cxx:882
std::string GetDatamemberType(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:958
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:567
Bool_t IsStaticMethod(TCppMethod_t method)
Definition: Cppyy.cxx:913
TCppEnum_t GetEnum(TCppScope_t scope, const std::string &enum_name)
Definition: Cppyy.cxx:1098
std::vector< TCppMethod_t > GetMethodsFromName(TCppScope_t scope, const std::string &name, bool alsoInBases=false)
Definition: Cppyy.cxx:710
std::string GetMethodArgName(TCppMethod_t, int iarg)
Definition: Cppyy.cxx:791
Bool_t IsMethodTemplate(TCppMethod_t)
Definition: Cppyy.cxx:866
ptrdiff_t GetDatamemberOffset(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:993
TCppIndex_t GetGlobalOperator(TCppType_t scope, TCppType_t lc, TCppScope_t rc, const std::string &op)
Definition: Cppyy.cxx:888
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:764
std::string GetFinalName(TCppType_t type)
Definition: Cppyy.cxx:581
TCppIndex_t GetNumBases(TCppType_t type)
Definition: Cppyy.cxx:603
TCppMethod_t GetMethod(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:747
Bool_t IsSmartPtr(const std::string &)
Definition: Cppyy.cxx:631
std::string GetDatamemberName(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:946
TCppIndex_t GetNumEnumData(TCppEnum_t)
Definition: Cppyy.cxx:1110
std::string ResolveEnum(const TEnum *en)
Definition: Cppyy.cxx:177
Bool_t IsConstData(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:1055
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:618
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