Logo ROOT   6.18/05
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 ---------------------------------------------------------
43 void Deallocate( TCppType_t type, TCppObject_t instance );
45 void Destruct( TCppType_t type, TCppObject_t instance );
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:501
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:640
void DeallocateFunctionArgs(void *args)
Definition: Cppyy.cxx:539
Bool_t IsConstructor(TCppMethod_t method)
Definition: Cppyy.cxx:895
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: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
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: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
Int_t CallI(TCppMethod_t method, TCppObject_t self, void *args)
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
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: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
Short_t CallH(TCppMethod_t method, TCppObject_t self, void *args)
Bool_t IsSubtype(TCppType_t derived, TCppType_t base)
Definition: Cppyy.cxx:618