Logo ROOT  
Reference Guide
Cppyy.h
Go to the documentation of this file.
1#ifndef PYROOT_CPPYY_H
2#define PYROOT_CPPYY_H
3
4// ROOT
5#include "TEnum.h"
6
7// Standard
8#include <string>
9#include <vector>
10#include <stddef.h>
11
12
13namespace Cppyy {
14
15 typedef ptrdiff_t TCppScope_t;
17 typedef void* TCppObject_t;
18 typedef ptrdiff_t TCppMethod_t;
19 typedef void* TCppEnum_t;
20
22 typedef void* (*TCppMethPtrGetter_t)( TCppObject_t );
23
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 );
35
36 Bool_t IsBuiltin( const std::string& type_name );
37 Bool_t IsComplete( const std::string& type_name );
38
39 extern TCppScope_t gGlobalScope; // for fast access
40
41// memory management ---------------------------------------------------------
46
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 );
63
65
66// handling of function argument buffer --------------------------------------
67 void* AllocateFunctionArgs( size_t nargs );
68 void DeallocateFunctionArgs( void* args );
69 size_t GetFunctionArgSizeof();
71
72// scope reflection information ----------------------------------------------
75 Bool_t IsEnum( const std::string& type_name );
76
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& );
86
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 );
90
91// method/function reflection information ------------------------------------
94 std::vector< TCppMethod_t > GetMethodsFromName( TCppScope_t scope, const std::string& name, bool alsoInBases = false);
95
97
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 );
107
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 );
113
115 TCppType_t scope, TCppType_t lc, TCppScope_t rc, const std::string& op );
116
117// method properties ---------------------------------------------------------
121
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 );
128
129// data member properties ----------------------------------------------------
134 Int_t GetDimensionSize( TCppScope_t scope, TCppIndex_t idata, int dimension );
135
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);
141
142} // namespace Cppyy
143
144#endif // ifndef PYROOT_CPPYY_H
int Int_t
Definition: RtypesCore.h:41
unsigned char UChar_t
Definition: RtypesCore.h:34
char Char_t
Definition: RtypesCore.h:29
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
char name[80]
Definition: TGX11.cxx:109
int type
Definition: TGX11.cxx:120
const char * proto
Definition: civetweb.c:16604
The TEnum class implements the enum type.
Definition: TEnum.h:33
Definition: Cppyy.h:13
LongDouble_t CallLD(TCppMethod_t method, TCppObject_t self, void *args)
TCppObject_t CallConstructor(TCppMethod_t method, TCppType_t type, void *args)
Definition: Cppyy.cxx:505
Long64_t CallLL(TCppMethod_t method, TCppObject_t self, void *args)
Char_t CallC(TCppMethod_t method, TCppObject_t self, void *args)
ptrdiff_t GetBaseOffset(TCppType_t derived, TCppType_t base, TCppObject_t address, int direction, bool rerror=false)
Definition: Cppyy.cxx:644
void DeallocateFunctionArgs(void *args)
Definition: Cppyy.cxx:543
Bool_t IsConstructor(TCppMethod_t method)
Definition: Cppyy.cxx:899
UChar_t CallB(TCppMethod_t method, TCppObject_t self, void *args)
TCppMethod_t GetMethodTemplate(TCppScope_t scope, const std::string &name, const std::string &proto)
Definition: Cppyy.cxx:856
Bool_t IsPublicMethod(TCppMethod_t method)
Definition: Cppyy.cxx:908
size_t SizeOf(TCppType_t klass)
Definition: Cppyy.cxx:239
TCppMethPtrGetter_t GetMethPtrGetter(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:530
Float_t CallF(TCppMethod_t method, TCppObject_t self, void *args)
Double_t CallD(TCppMethod_t method, TCppObject_t self, void *args)
void * AllocateFunctionArgs(size_t nargs)
Definition: Cppyy.cxx:538
ptrdiff_t TCppScope_t
Definition: Cppyy.h:15
std::string GetMethodArgType(TCppMethod_t, int iarg)
Definition: Cppyy.cxx:805
Bool_t IsNamespace(TCppScope_t scope)
Definition: Cppyy.cxx:560
void *(* TCppMethPtrGetter_t)(TCppObject_t)
Definition: Cppyy.h:22
bool ExistsMethodTemplate(TCppScope_t scope, const std::string &name)
Definition: Cppyy.cxx:843
std::string GetMethodName(TCppMethod_t)
Definition: Cppyy.cxx:757
TCppIndex_t GetNumMethods(TCppScope_t scope)
Definition: Cppyy.cxx:683
void AddSmartPtrType(const std::string &)
Definition: Cppyy.cxx:631
TCppObject_t CallO(TCppMethod_t method, TCppObject_t self, void *args, TCppType_t result_type)
Definition: Cppyy.cxx:519
TCppIndex_t GetNumScopes(TCppScope_t parent)
Definition: Cppyy.cxx:130
TCppIndex_t GetNumDatamembers(TCppScope_t scope)
Definition: Cppyy.cxx:927
Char_t * CallS(TCppMethod_t method, TCppObject_t self, void *args)
Definition: Cppyy.cxx:497
void CallDestructor(TCppType_t type, TCppObject_t self)
Definition: Cppyy.cxx:513
TCppObject_t Allocate(TCppType_t type)
Definition: Cppyy.cxx:275
void * CallR(TCppMethod_t method, TCppObject_t self, void *args)
Definition: Cppyy.cxx:489
TCppIndex_t GetMethodReqArgs(TCppMethod_t)
Definition: Cppyy.cxx:786
Bool_t IsPublicData(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:1037
std::string GetName(const std::string &scope_name)
Definition: Cppyy.cxx:150
TCppScope_t gGlobalScope
Definition: Cppyy.cxx:64
Int_t CallI(TCppMethod_t method, TCppObject_t self, void *args)
size_t GetFunctionArgTypeoffset()
Definition: Cppyy.cxx:553
void Destruct(TCppType_t type, TCppObject_t instance)
Definition: Cppyy.cxx:292
std::string ResolveName(const std::string &cppitem_name)
Definition: Cppyy.cxx:171
Int_t GetDimensionSize(TCppScope_t scope, TCppIndex_t idata, int dimension)
Definition: Cppyy.cxx:1087
TCppType_t GetTemplate(const std::string &template_name)
Definition: Cppyy.cxx:223
TCppType_t GetActualClass(TCppType_t klass, TCppObject_t obj)
Definition: Cppyy.cxx:228
std::string GetMethodSignature(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:828
TCppScope_t TCppType_t
Definition: Cppyy.h:16
long long GetEnumDataValue(TCppEnum_t, TCppIndex_t idata)
Definition: Cppyy.cxx:1124
TCppIndex_t GetMethodIndexAt(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:709
Bool_t IsComplete(const std::string &type_name)
Definition: Cppyy.cxx:253
std::string GetBaseName(TCppType_t type, TCppIndex_t ibase)
Definition: Cppyy.cxx:616
TCppIndex_t GetMethodNumTemplateArgs(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:880
std::string GetScopedFinalName(TCppType_t type)
Definition: Cppyy.cxx:594
void Deallocate(TCppType_t type, TCppObject_t instance)
Definition: Cppyy.cxx:281
Bool_t IsEnumData(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:1073
Bool_t IsEnum(const std::string &type_name)
Definition: Cppyy.cxx:579
Bool_t IsStaticData(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:1048
std::string GetEnumDataName(TCppEnum_t, TCppIndex_t idata)
Definition: Cppyy.cxx:1119
Bool_t HasComplexHierarchy(TCppType_t type)
Definition: Cppyy.cxx:601
Bool_t IsConstMethod(TCppMethod_t)
Definition: Cppyy.cxx:833
void * TCppEnum_t
Definition: Cppyy.h:19
std::string GetMethodArgDefault(TCppMethod_t, int iarg)
Definition: Cppyy.cxx:815
TCppIndex_t GetMethodNumArgs(TCppMethod_t)
Definition: Cppyy.cxx:779
TCppIndex_t GetDatamemberIndex(TCppScope_t scope, const std::string &name)
Definition: Cppyy.cxx:1013
Long_t TCppIndex_t
Definition: Cppyy.h:21
Long_t CallL(TCppMethod_t method, TCppObject_t self, void *args)
std::string GetMethodTemplateArgName(TCppScope_t scope, TCppIndex_t imeth, TCppIndex_t iarg)
Definition: Cppyy.cxx:886
std::string GetDatamemberType(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:962
TCppScope_t GetScope(const std::string &scope_name)
Definition: Cppyy.cxx:197
size_t GetFunctionArgSizeof()
Definition: Cppyy.cxx:548
Bool_t IsAbstract(TCppType_t type)
Definition: Cppyy.cxx:571
Bool_t IsStaticMethod(TCppMethod_t method)
Definition: Cppyy.cxx:917
TCppEnum_t GetEnum(TCppScope_t scope, const std::string &enum_name)
Definition: Cppyy.cxx:1102
std::vector< TCppMethod_t > GetMethodsFromName(TCppScope_t scope, const std::string &name, bool alsoInBases=false)
Definition: Cppyy.cxx:714
std::string GetMethodArgName(TCppMethod_t, int iarg)
Definition: Cppyy.cxx:795
Bool_t IsMethodTemplate(TCppMethod_t)
Definition: Cppyy.cxx:870
ptrdiff_t GetDatamemberOffset(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:997
TCppIndex_t GetGlobalOperator(TCppType_t scope, TCppType_t lc, TCppScope_t rc, const std::string &op)
Definition: Cppyy.cxx:892
ptrdiff_t TCppMethod_t
Definition: Cppyy.h:18
Bool_t IsBuiltin(const std::string &type_name)
Definition: Cppyy.cxx:246
std::string GetMethodResultType(TCppMethod_t)
Definition: Cppyy.cxx:768
std::string GetFinalName(TCppType_t type)
Definition: Cppyy.cxx:585
TCppIndex_t GetNumBases(TCppType_t type)
Definition: Cppyy.cxx:607
TCppMethod_t GetMethod(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:751
Bool_t IsSmartPtr(const std::string &)
Definition: Cppyy.cxx:635
std::string GetDatamemberName(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:950
TCppIndex_t GetNumEnumData(TCppEnum_t)
Definition: Cppyy.cxx:1114
std::string ResolveEnum(const TEnum *en)
Definition: Cppyy.cxx:181
Bool_t IsConstData(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:1059
void * TCppObject_t
Definition: Cppyy.h:17
TCppObject_t Construct(TCppType_t type)
Definition: Cppyy.cxx:286
void CallV(TCppMethod_t method, TCppObject_t self, void *args)
Definition: Cppyy.cxx:473
std::string GetScopeName(TCppScope_t parent, TCppIndex_t iscope)
Definition: Cppyy.cxx:138
Short_t CallH(TCppMethod_t method, TCppObject_t self, void *args)
Bool_t IsSubtype(TCppType_t derived, TCppType_t base)
Definition: Cppyy.cxx:622
static Roo_reg_AGKInteg1D instance