Logo ROOT   6.16/01
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 );
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
110 std::string GetMethodTemplateArgName( TCppScope_t scope, TCppIndex_t imeth, TCppIndex_t iarg );
111
113 TCppType_t scope, TCppType_t lc, TCppScope_t rc, const std::string& op );
114
115// method properties ---------------------------------------------------------
119
120// data member reflection information ----------------------------------------
122 std::string GetDatamemberName( TCppScope_t scope, TCppIndex_t idata );
123 std::string GetDatamemberType( TCppScope_t scope, TCppIndex_t idata );
124 ptrdiff_t GetDatamemberOffset( TCppScope_t scope, TCppIndex_t idata );
125 TCppIndex_t GetDatamemberIndex( TCppScope_t scope, const std::string& name );
126
127// data member properties ----------------------------------------------------
132 Int_t GetDimensionSize( TCppScope_t scope, TCppIndex_t idata, int dimension );
133
134// enum properties -----------------------------------------------------------
135 TCppEnum_t GetEnum(TCppScope_t scope, const std::string& enum_name);
137 std::string GetEnumDataName(TCppEnum_t, TCppIndex_t idata);
138 long long GetEnumDataValue(TCppEnum_t, TCppIndex_t idata);
139
140} // namespace Cppyy
141
142#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
int type
Definition: TGX11.cxx:120
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:637
void DeallocateFunctionArgs(void *args)
Definition: Cppyy.cxx:539
Bool_t IsConstructor(TCppMethod_t method)
Definition: Cppyy.cxx:865
UChar_t CallB(TCppMethod_t method, TCppObject_t self, void *args)
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
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: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
Int_t CallI(TCppMethod_t method, TCppObject_t self, void *args)
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
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: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
Short_t CallH(TCppMethod_t method, TCppObject_t self, void *args)
Bool_t IsSubtype(TCppType_t derived, TCppType_t base)
Definition: Cppyy.cxx:615