Logo ROOT   6.19/01
Reference Guide
Go to the documentation of this file.
1 #ifndef PYROOT_CPPYY_H
2 #define PYROOT_CPPYY_H
4 // ROOT
5 #include "TEnum.h"
7 // Standard
8 #include <string>
9 #include <vector>
10 #include <stddef.h>
13 namespace Cppyy {
15  typedef ptrdiff_t TCppScope_t;
17  typedef void* TCppObject_t;
18  typedef ptrdiff_t TCppMethod_t;
19  typedef void* TCppEnum_t;
22  typedef void* (*TCppMethPtrGetter_t)( TCppObject_t );
24 // name to opaque C++ scope representation -----------------------------------
26  std::string GetScopeName( TCppScope_t parent, TCppIndex_t iscope );
27  std::string ResolveName( const std::string& cppitem_name );
28  std::string ResolveEnum(const TEnum* en);
29  std::string ResolveEnum(const std::string& enum_type);
30  TCppScope_t GetScope( const std::string& scope_name );
31  std::string GetName( const std::string& scope_name );
32  TCppType_t GetTemplate( const std::string& template_name );
34  size_t SizeOf( TCppType_t klass );
36  Bool_t IsBuiltin( const std::string& type_name );
37  Bool_t IsComplete( const std::string& type_name );
39  extern TCppScope_t gGlobalScope; // for fast access
41 // memory management ---------------------------------------------------------
47 // method/function dispatching -----------------------------------------------
48  void CallV( TCppMethod_t method, TCppObject_t self, void* args );
49  UChar_t CallB( TCppMethod_t method, TCppObject_t self, void* args );
50  Char_t CallC( TCppMethod_t method, TCppObject_t self, void* args );
51  Short_t CallH( TCppMethod_t method, TCppObject_t self, void* args );
52  Int_t CallI( TCppMethod_t method, TCppObject_t self, void* args );
53  Long_t CallL( TCppMethod_t method, TCppObject_t self, void* args );
54  Long64_t CallLL( TCppMethod_t method, TCppObject_t self, void* args );
55  Float_t CallF( TCppMethod_t method, TCppObject_t self, void* args );
56  Double_t CallD( TCppMethod_t method, TCppObject_t self, void* args );
57  LongDouble_t CallLD( TCppMethod_t method, TCppObject_t self, void* args );
58  void* CallR( TCppMethod_t method, TCppObject_t self, void* args );
59  Char_t* CallS( TCppMethod_t method, TCppObject_t self, void* args );
62  TCppObject_t CallO( TCppMethod_t method, TCppObject_t self, void* args, TCppType_t result_type );
66 // handling of function argument buffer --------------------------------------
67  void* AllocateFunctionArgs( size_t nargs );
68  void DeallocateFunctionArgs( void* args );
69  size_t GetFunctionArgSizeof();
70  size_t GetFunctionArgTypeoffset();
72 // scope reflection information ----------------------------------------------
75  Bool_t IsEnum( const std::string& type_name );
77 // class reflection information ----------------------------------------------
78  std::string GetFinalName( TCppType_t type );
79  std::string GetScopedFinalName( TCppType_t type );
82  std::string GetBaseName( TCppType_t type, TCppIndex_t ibase );
83  Bool_t IsSubtype( TCppType_t derived, TCppType_t base );
84  void AddSmartPtrType( const std::string& );
85  Bool_t IsSmartPtr( const std::string& );
87 // calculate offsets between declared and actual type, up-cast: direction > 0; down-cast: direction < 0
88  ptrdiff_t GetBaseOffset(
89  TCppType_t derived, TCppType_t base, TCppObject_t address, int direction, bool rerror = false );
91 // method/function reflection information ------------------------------------
94  std::vector< TCppMethod_t > GetMethodsFromName( TCppScope_t scope, const std::string& name, bool alsoInBases = false);
98  std::string GetMethodName( TCppMethod_t );
99  std::string GetMethodResultType( TCppMethod_t );
102  std::string GetMethodArgName( TCppMethod_t, int iarg );
103  std::string GetMethodArgType( TCppMethod_t, int iarg );
104  std::string GetMethodArgDefault( TCppMethod_t, int iarg );
105  std::string GetMethodSignature( TCppScope_t scope, TCppIndex_t imeth );
108  bool ExistsMethodTemplate(TCppScope_t scope, const std::string& name);
109  TCppMethod_t GetMethodTemplate(TCppScope_t scope, const std::string& name, const std::string& proto);
112  std::string GetMethodTemplateArgName( TCppScope_t scope, TCppIndex_t imeth, TCppIndex_t iarg );
115  TCppType_t scope, TCppType_t lc, TCppScope_t rc, const std::string& op );
117 // method properties ---------------------------------------------------------
122 // data member reflection information ----------------------------------------
124  std::string GetDatamemberName( TCppScope_t scope, TCppIndex_t idata );
125  std::string GetDatamemberType( TCppScope_t scope, TCppIndex_t idata );
126  ptrdiff_t GetDatamemberOffset( TCppScope_t scope, TCppIndex_t idata );
127  TCppIndex_t GetDatamemberIndex( TCppScope_t scope, const std::string& name );
129 // data member properties ----------------------------------------------------
130  Bool_t IsPublicData( TCppScope_t scope, TCppIndex_t idata );
131  Bool_t IsStaticData( TCppScope_t scope, TCppIndex_t idata );
132  Bool_t IsConstData( TCppScope_t scope, TCppIndex_t idata );
133  Bool_t IsEnumData( TCppScope_t scope, TCppIndex_t idata );
134  Int_t GetDimensionSize( TCppScope_t scope, TCppIndex_t idata, int dimension );
136 // enum properties -----------------------------------------------------------
137  TCppEnum_t GetEnum(TCppScope_t scope, const std::string& enum_name);
139  std::string GetEnumDataName(TCppEnum_t, TCppIndex_t idata);
140  long long GetEnumDataValue(TCppEnum_t, TCppIndex_t idata);
142 } // namespace Cppyy
144 #endif // ifndef PYROOT_CPPYY_H
Double_t CallD(TCppMethod_t method, TCppObject_t self, void *args)
std::string GetName(const std::string &scope_name)
Definition: Cppyy.cxx:150
TCppScope_t TCppType_t
Definition: Cppyy.h:16
size_t GetFunctionArgSizeof()
Definition: Cppyy.cxx:548
TCppEnum_t GetEnum(TCppScope_t scope, const std::string &enum_name)
Definition: Cppyy.cxx:1102
The TEnum class implements the enum type.
Definition: TEnum.h:33
std::string GetScopedFinalName(TCppType_t type)
Definition: Cppyy.cxx:594
long long Long64_t
Definition: RtypesCore.h:69
Bool_t IsNamespace(TCppScope_t scope)
Definition: Cppyy.cxx:560
float Float_t
Definition: RtypesCore.h:53
Bool_t IsBuiltin(const std::string &type_name)
Definition: Cppyy.cxx:246
TCppIndex_t GetGlobalOperator(TCppType_t scope, TCppType_t lc, TCppScope_t rc, const std::string &op)
Definition: Cppyy.cxx:892
std::string ResolveEnum(const TEnum *en)
Definition: Cppyy.cxx:181
Bool_t IsMethodTemplate(TCppMethod_t)
Definition: Cppyy.cxx:870
long long GetEnumDataValue(TCppEnum_t, TCppIndex_t idata)
Definition: Cppyy.cxx:1124
ptrdiff_t GetBaseOffset(TCppType_t derived, TCppType_t base, TCppObject_t address, int direction, bool rerror=false)
Definition: Cppyy.cxx:644
Bool_t IsPublicMethod(TCppMethod_t method)
Definition: Cppyy.cxx:908
LongDouble_t CallLD(TCppMethod_t method, TCppObject_t self, void *args)
TCppIndex_t GetNumBases(TCppType_t type)
Definition: Cppyy.cxx:607
Int_t CallI(TCppMethod_t method, TCppObject_t self, void *args)
TCppIndex_t GetMethodReqArgs(TCppMethod_t)
Definition: Cppyy.cxx:786
Bool_t IsAbstract(TCppType_t type)
Definition: Cppyy.cxx:571
std::string GetFinalName(TCppType_t type)
Definition: Cppyy.cxx:585
std::string GetMethodSignature(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:828
Float_t CallF(TCppMethod_t method, TCppObject_t self, void *args)
ptrdiff_t GetDatamemberOffset(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:997
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
Bool_t IsEnumData(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:1073
std::string GetDatamemberType(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:962
TCppIndex_t GetNumScopes(TCppScope_t parent)
Definition: Cppyy.cxx:130
std::vector< TCppMethod_t > GetMethodsFromName(TCppScope_t scope, const std::string &name, bool alsoInBases=false)
Definition: Cppyy.cxx:714
TCppObject_t CallO(TCppMethod_t method, TCppObject_t self, void *args, TCppType_t result_type)
Definition: Cppyy.cxx:519
Int_t GetDimensionSize(TCppScope_t scope, TCppIndex_t idata, int dimension)
Definition: Cppyy.cxx:1087
TCppObject_t CallConstructor(TCppMethod_t method, TCppType_t type, void *args)
Definition: Cppyy.cxx:505
std::string GetBaseName(TCppType_t type, TCppIndex_t ibase)
Definition: Cppyy.cxx:616
Char_t * CallS(TCppMethod_t method, TCppObject_t self, void *args)
Definition: Cppyy.cxx:497
TCppIndex_t GetMethodIndexAt(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:709
Definition: Cppyy.h:13
TCppIndex_t GetMethodNumTemplateArgs(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:880
TCppType_t GetTemplate(const std::string &template_name)
Definition: Cppyy.cxx:223
std::string ResolveName(const std::string &cppitem_name)
Definition: Cppyy.cxx:171
Long64_t CallLL(TCppMethod_t method, TCppObject_t self, void *args)
Char_t CallC(TCppMethod_t method, TCppObject_t self, void *args)
UChar_t CallB(TCppMethod_t method, TCppObject_t self, void *args)
Bool_t HasComplexHierarchy(TCppType_t type)
Definition: Cppyy.cxx:601
TCppIndex_t GetNumEnumData(TCppEnum_t)
Definition: Cppyy.cxx:1114
TCppMethPtrGetter_t GetMethPtrGetter(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:530
TCppIndex_t GetNumDatamembers(TCppScope_t scope)
Definition: Cppyy.cxx:927
Bool_t IsConstData(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:1059
void CallDestructor(TCppType_t type, TCppObject_t self)
Definition: Cppyy.cxx:513
Bool_t IsComplete(const std::string &type_name)
Definition: Cppyy.cxx:253
void * TCppEnum_t
Definition: Cppyy.h:19
TCppMethod_t GetMethod(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:751
size_t GetFunctionArgTypeoffset()
Definition: Cppyy.cxx:553
std::string GetMethodTemplateArgName(TCppScope_t scope, TCppIndex_t imeth, TCppIndex_t iarg)
Definition: Cppyy.cxx:886
Bool_t IsConstructor(TCppMethod_t method)
Definition: Cppyy.cxx:899
TCppType_t GetActualClass(TCppType_t klass, TCppObject_t obj)
Definition: Cppyy.cxx:228
void AddSmartPtrType(const std::string &)
Definition: Cppyy.cxx:631
ptrdiff_t TCppMethod_t
Definition: Cppyy.h:18
TCppScope_t gGlobalScope
Definition: Cppyy.cxx:64
Bool_t IsPublicData(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:1037
std::string GetMethodName(TCppMethod_t)
Definition: Cppyy.cxx:757
void * AllocateFunctionArgs(size_t nargs)
Definition: Cppyy.cxx:538
static Roo_reg_AGKInteg1D instance
short Short_t
Definition: RtypesCore.h:35
TCppIndex_t GetDatamemberIndex(TCppScope_t scope, const std::string &name)
Definition: Cppyy.cxx:1013
long double LongDouble_t
Definition: RtypesCore.h:57
bool ExistsMethodTemplate(TCppScope_t scope, const std::string &name)
Definition: Cppyy.cxx:843
Short_t CallH(TCppMethod_t method, TCppObject_t self, void *args)
void * TCppObject_t
Definition: Cppyy.h:17
void * CallR(TCppMethod_t method, TCppObject_t self, void *args)
Definition: Cppyy.cxx:489
long Long_t
Definition: RtypesCore.h:50
Bool_t IsSubtype(TCppType_t derived, TCppType_t base)
Definition: Cppyy.cxx:622
TCppScope_t GetScope(const std::string &scope_name)
Definition: Cppyy.cxx:197
double Double_t
Definition: RtypesCore.h:55
std::string GetMethodResultType(TCppMethod_t)
Definition: Cppyy.cxx:768
int type
Definition: TGX11.cxx:120
Long_t CallL(TCppMethod_t method, TCppObject_t self, void *args)
TCppIndex_t GetMethodNumArgs(TCppMethod_t)
Definition: Cppyy.cxx:779
std::string GetMethodArgName(TCppMethod_t, int iarg)
Definition: Cppyy.cxx:795
void Deallocate(TCppType_t type, TCppObject_t instance)
Definition: Cppyy.cxx:281
TCppObject_t Allocate(TCppType_t type)
Definition: Cppyy.cxx:275
std::string GetMethodArgType(TCppMethod_t, int iarg)
Definition: Cppyy.cxx:805
Bool_t IsSmartPtr(const std::string &)
Definition: Cppyy.cxx:635
Bool_t IsStaticMethod(TCppMethod_t method)
Definition: Cppyy.cxx:917
std::string GetDatamemberName(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:950
char Char_t
Definition: RtypesCore.h:29
Bool_t IsStaticData(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:1048
size_t SizeOf(TCppType_t klass)
Definition: Cppyy.cxx:239
Long_t TCppIndex_t
Definition: Cppyy.h:21
Bool_t IsConstMethod(TCppMethod_t)
Definition: Cppyy.cxx:833
TCppIndex_t GetNumMethods(TCppScope_t scope)
Definition: Cppyy.cxx:683
void CallV(TCppMethod_t method, TCppObject_t self, void *args)
Definition: Cppyy.cxx:473
std::string GetEnumDataName(TCppEnum_t, TCppIndex_t idata)
Definition: Cppyy.cxx:1119
const char * proto
Definition: civetweb.c:16604
unsigned char UChar_t
Definition: RtypesCore.h:34
TCppObject_t Construct(TCppType_t type)
Definition: Cppyy.cxx:286
void Destruct(TCppType_t type, TCppObject_t instance)
Definition: Cppyy.cxx:292
void *(* TCppMethPtrGetter_t)(TCppObject_t)
Definition: Cppyy.h:22
std::string GetMethodArgDefault(TCppMethod_t, int iarg)
Definition: Cppyy.cxx:815
ptrdiff_t TCppScope_t
Definition: Cppyy.h:15
void DeallocateFunctionArgs(void *args)
Definition: Cppyy.cxx:543
TCppMethod_t GetMethodTemplate(TCppScope_t scope, const std::string &name, const std::string &proto)
Definition: Cppyy.cxx:856
Bool_t IsEnum(const std::string &type_name)
Definition: Cppyy.cxx:579
std::string GetScopeName(TCppScope_t parent, TCppIndex_t iscope)
Definition: Cppyy.cxx:138
char name[80]
Definition: TGX11.cxx:109