ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Cppyy.h
Go to the documentation of this file.
1 #ifndef PYROOT_CPPYY_H
2 #define PYROOT_CPPYY_H
3 
4 // Standard
5 #include <string>
6 #include <vector>
7 #include <stddef.h>
8 
9 
10 namespace Cppyy {
11 
12  typedef ptrdiff_t TCppScope_t;
14  typedef void* TCppObject_t;
15  typedef ptrdiff_t TCppMethod_t;
16 
18  typedef void* (*TCppMethPtrGetter_t)( TCppObject_t );
19 
20 // name to opaque C++ scope representation -----------------------------------
22  std::string GetScopeName( TCppScope_t parent, TCppIndex_t iscope );
23  std::string ResolveName( const std::string& cppitem_name );
24  TCppScope_t GetScope( const std::string& scope_name );
25  TCppType_t GetTemplate( const std::string& template_name );
27  size_t SizeOf( TCppType_t klass );
28 
29  Bool_t IsBuiltin( const std::string& type_name );
30  Bool_t IsComplete( const std::string& type_name );
31 
32  extern TCppScope_t gGlobalScope; // for fast access
33 
34 // memory management ---------------------------------------------------------
36  void Deallocate( TCppType_t type, TCppObject_t instance );
38  void Destruct( TCppType_t type, TCppObject_t instance );
39 
40 // method/function dispatching -----------------------------------------------
41  void CallV( TCppMethod_t method, TCppObject_t self, void* args );
42  UChar_t CallB( TCppMethod_t method, TCppObject_t self, void* args );
43  Char_t CallC( TCppMethod_t method, TCppObject_t self, void* args );
44  Short_t CallH( TCppMethod_t method, TCppObject_t self, void* args );
45  Int_t CallI( TCppMethod_t method, TCppObject_t self, void* args );
46  Long_t CallL( TCppMethod_t method, TCppObject_t self, void* args );
47  Long64_t CallLL( TCppMethod_t method, TCppObject_t self, void* args );
48  Float_t CallF( TCppMethod_t method, TCppObject_t self, void* args );
49  Double_t CallD( TCppMethod_t method, TCppObject_t self, void* args );
50  LongDouble_t CallLD( TCppMethod_t method, TCppObject_t self, void* args );
51  void* CallR( TCppMethod_t method, TCppObject_t self, void* args );
52  Char_t* CallS( TCppMethod_t method, TCppObject_t self, void* args );
55  TCppObject_t CallO( TCppMethod_t method, TCppObject_t self, void* args, TCppType_t result_type );
56 
58 
59 // handling of function argument buffer --------------------------------------
60  void* AllocateFunctionArgs( size_t nargs );
61  void DeallocateFunctionArgs( void* args );
62  size_t GetFunctionArgSizeof();
63  size_t GetFunctionArgTypeoffset();
64 
65 // scope reflection information ----------------------------------------------
68  Bool_t IsEnum( const std::string& type_name );
69 
70 // class reflection information ----------------------------------------------
71  std::string GetFinalName( TCppType_t type );
72  std::string GetScopedFinalName( TCppType_t type );
75  std::string GetBaseName( TCppType_t type, TCppIndex_t ibase );
76  Bool_t IsSubtype( TCppType_t derived, TCppType_t base );
77  void AddSmartPtrType( const std::string& );
78  Bool_t IsSmartPtr( const std::string& );
79 
80 // calculate offsets between declared and actual type, up-cast: direction > 0; down-cast: direction < 0
81  ptrdiff_t GetBaseOffset(
82  TCppType_t derived, TCppType_t base, TCppObject_t address, int direction, bool rerror = false );
83 
84 // method/function reflection information ------------------------------------
87  std::vector< TCppMethod_t > GetMethodsFromName( TCppScope_t scope, const std::string& name );
88 
90 
91  std::string GetMethodName( TCppMethod_t );
92  std::string GetMethodResultType( TCppMethod_t );
95  std::string GetMethodArgName( TCppMethod_t, int iarg );
96  std::string GetMethodArgType( TCppMethod_t, int iarg );
97  std::string GetMethodArgDefault( TCppMethod_t, int iarg );
98  std::string GetMethodSignature( TCppScope_t scope, TCppIndex_t imeth );
100 
103  std::string GetMethodTemplateArgName( TCppScope_t scope, TCppIndex_t imeth, TCppIndex_t iarg );
104 
106  TCppType_t scope, TCppType_t lc, TCppScope_t rc, const std::string& op );
107 
108 // method properties ---------------------------------------------------------
112 
113 // data member reflection information ----------------------------------------
115  std::string GetDatamemberName( TCppScope_t scope, TCppIndex_t idata );
116  std::string GetDatamemberType( TCppScope_t scope, TCppIndex_t idata );
117  ptrdiff_t GetDatamemberOffset( TCppScope_t scope, TCppIndex_t idata );
118  TCppIndex_t GetDatamemberIndex( TCppScope_t scope, const std::string& name );
119 
120 // data member properties ----------------------------------------------------
121  Bool_t IsPublicData( TCppScope_t scope, TCppIndex_t idata );
122  Bool_t IsStaticData( TCppScope_t scope, TCppIndex_t idata );
123  Bool_t IsConstData( TCppScope_t scope, TCppIndex_t idata );
124  Bool_t IsEnumData( TCppScope_t scope, TCppIndex_t idata );
125  Int_t GetDimensionSize( TCppScope_t scope, TCppIndex_t idata, int dimension );
126 
127 } // namespace Cppyy
128 
129 #endif // ifndef PYROOT_CPPYY_H
Double_t CallD(TCppMethod_t method, TCppObject_t self, void *args)
TCppScope_t TCppType_t
Definition: Cppyy.h:13
size_t GetFunctionArgSizeof()
Definition: Cppyy.cxx:500
std::string GetScopedFinalName(TCppType_t type)
Definition: Cppyy.cxx:543
long long Long64_t
Definition: RtypesCore.h:69
Bool_t IsNamespace(TCppScope_t scope)
Definition: Cppyy.cxx:512
float Float_t
Definition: RtypesCore.h:53
Bool_t IsBuiltin(const std::string &type_name)
Definition: Cppyy.cxx:199
TCppIndex_t GetGlobalOperator(TCppType_t scope, TCppType_t lc, TCppScope_t rc, const std::string &op)
Definition: Cppyy.cxx:814
Bool_t IsMethodTemplate(TCppMethod_t)
Definition: Cppyy.cxx:792
ptrdiff_t GetBaseOffset(TCppType_t derived, TCppType_t base, TCppObject_t address, int direction, bool rerror=false)
Definition: Cppyy.cxx:593
Bool_t IsPublicMethod(TCppMethod_t method)
Definition: Cppyy.cxx:830
LongDouble_t CallLD(TCppMethod_t method, TCppObject_t self, void *args)
TCppIndex_t GetNumBases(TCppType_t type)
Definition: Cppyy.cxx:556
Int_t CallI(TCppMethod_t method, TCppObject_t self, void *args)
TCppIndex_t GetMethodReqArgs(TCppMethod_t)
Definition: Cppyy.cxx:735
std::vector< TCppMethod_t > GetMethodsFromName(TCppScope_t scope, const std::string &name)
Definition: Cppyy.cxx:663
Bool_t IsAbstract(TCppType_t type)
Definition: Cppyy.cxx:520
std::string GetFinalName(TCppType_t type)
Definition: Cppyy.cxx:534
std::string GetMethodSignature(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:777
Float_t CallF(TCppMethod_t method, TCppObject_t self, void *args)
ptrdiff_t GetDatamemberOffset(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:919
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:995
std::string GetDatamemberType(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:884
TCppIndex_t GetNumScopes(TCppScope_t parent)
Definition: Cppyy.cxx:120
TCppObject_t CallO(TCppMethod_t method, TCppObject_t self, void *args, TCppType_t result_type)
Definition: Cppyy.cxx:472
Int_t GetDimensionSize(TCppScope_t scope, TCppIndex_t idata, int dimension)
Definition: Cppyy.cxx:1009
TCppObject_t CallConstructor(TCppMethod_t method, TCppType_t type, void *args)
Definition: Cppyy.cxx:458
std::string GetBaseName(TCppType_t type, TCppIndex_t ibase)
Definition: Cppyy.cxx:565
Char_t * CallS(TCppMethod_t method, TCppObject_t self, void *args)
Definition: Cppyy.cxx:450
TCppIndex_t GetMethodIndexAt(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:658
TCppIndex_t GetMethodNumTemplateArgs(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:802
TCppType_t GetTemplate(const std::string &template_name)
Definition: Cppyy.cxx:176
std::string ResolveName(const std::string &cppitem_name)
Definition: Cppyy.cxx:140
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:550
TCppMethPtrGetter_t GetMethPtrGetter(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:482
TCppIndex_t GetNumDatamembers(TCppScope_t scope)
Definition: Cppyy.cxx:849
Bool_t IsConstData(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:981
void CallDestructor(TCppType_t type, TCppObject_t self)
Definition: Cppyy.cxx:466
Bool_t IsComplete(const std::string &type_name)
Definition: Cppyy.cxx:206
TCppMethod_t GetMethod(TCppScope_t scope, TCppIndex_t imeth)
Definition: Cppyy.cxx:700
size_t GetFunctionArgTypeoffset()
Definition: Cppyy.cxx:505
std::string GetMethodTemplateArgName(TCppScope_t scope, TCppIndex_t imeth, TCppIndex_t iarg)
Definition: Cppyy.cxx:808
Bool_t IsConstructor(TCppMethod_t method)
Definition: Cppyy.cxx:821
TCppType_t GetActualClass(TCppType_t klass, TCppObject_t obj)
Definition: Cppyy.cxx:181
void AddSmartPtrType(const std::string &)
Definition: Cppyy.cxx:580
ptrdiff_t TCppMethod_t
Definition: Cppyy.h:15
TCppScope_t gGlobalScope
Definition: Cppyy.cxx:58
Bool_t IsPublicData(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:959
std::string GetMethodName(TCppMethod_t)
Definition: Cppyy.cxx:706
void * AllocateFunctionArgs(size_t nargs)
Definition: Cppyy.cxx:490
short Short_t
Definition: RtypesCore.h:35
TCppIndex_t GetDatamemberIndex(TCppScope_t scope, const std::string &name)
Definition: Cppyy.cxx:935
long double LongDouble_t
Definition: RtypesCore.h:57
Short_t CallH(TCppMethod_t method, TCppObject_t self, void *args)
void * TCppObject_t
Definition: Cppyy.h:14
void * CallR(TCppMethod_t method, TCppObject_t self, void *args)
Definition: Cppyy.cxx:442
long Long_t
Definition: RtypesCore.h:50
Bool_t IsSubtype(TCppType_t derived, TCppType_t base)
Definition: Cppyy.cxx:571
TCppScope_t GetScope(const std::string &scope_name)
Definition: Cppyy.cxx:150
double Double_t
Definition: RtypesCore.h:55
std::string GetMethodResultType(TCppMethod_t)
Definition: Cppyy.cxx:717
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:728
std::string GetMethodArgName(TCppMethod_t, int iarg)
Definition: Cppyy.cxx:744
void Deallocate(TCppType_t type, TCppObject_t instance)
Definition: Cppyy.cxx:234
TCppObject_t Allocate(TCppType_t type)
Definition: Cppyy.cxx:228
std::string GetMethodArgType(TCppMethod_t, int iarg)
Definition: Cppyy.cxx:754
Bool_t IsSmartPtr(const std::string &)
Definition: Cppyy.cxx:584
#define name(a, b)
Definition: linkTestLib0.cpp:5
Bool_t IsStaticMethod(TCppMethod_t method)
Definition: Cppyy.cxx:839
std::string GetDatamemberName(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:872
void *(* TCppMethPtrGetter_t)(TCppObject_t)
Definition: Cppyy.h:18
char Char_t
Definition: RtypesCore.h:29
Bool_t IsStaticData(TCppScope_t scope, TCppIndex_t idata)
Definition: Cppyy.cxx:970
size_t SizeOf(TCppType_t klass)
Definition: Cppyy.cxx:192
Long_t TCppIndex_t
Definition: Cppyy.h:17
Bool_t IsConstMethod(TCppMethod_t)
Definition: Cppyy.cxx:782
TCppIndex_t GetNumMethods(TCppScope_t scope)
Definition: Cppyy.cxx:632
void CallV(TCppMethod_t method, TCppObject_t self, void *args)
Definition: Cppyy.cxx:426
unsigned char UChar_t
Definition: RtypesCore.h:34
TCppObject_t Construct(TCppType_t type)
Definition: Cppyy.cxx:239
void Destruct(TCppType_t type, TCppObject_t instance)
Definition: Cppyy.cxx:245
TObject * obj
std::string GetMethodArgDefault(TCppMethod_t, int iarg)
Definition: Cppyy.cxx:764
ptrdiff_t TCppScope_t
Definition: Cppyy.h:12
void DeallocateFunctionArgs(void *args)
Definition: Cppyy.cxx:495
Bool_t IsEnum(const std::string &type_name)
Definition: Cppyy.cxx:528
std::string GetScopeName(TCppScope_t parent, TCppIndex_t iscope)
Definition: Cppyy.cxx:128