FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cppjit/test/cpp/pythonizables.h at main · compiler-research/cppjit · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
compiler-research
/
cppjit
Public
Notifications
You must be signed in to change notification settings
Fork
8
Star
12
Code
Issues
6
Pull requests
5
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
cppjit
/
test
/
cpp
/
pythonizables.h
Copy path
More file actions
More file actions
Latest commit
History
History
History
164 lines (129 loc) · 3.43 KB
Breadcrumbs
cppjit
/
test
/
cpp
/
pythonizables.h
Copy path
File metadata and controls
164 lines (129 loc) · 3.43 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
#
include
<
memory
>
#
include
<
string
>
#
include
<
vector
>
//
Python
struct
_object
;
typedef
_object PyObject;
namespace
pyzables
{
//
===========================================================================
class
SomeDummy1
{};
class
SomeDummy2
{};
//
===========================================================================
class
NakedBuffers
{
public:
NakedBuffers
(
int
size,
double
valx,
double
valy);
NakedBuffers
(
const
NakedBuffers&) =
delete
;
NakedBuffers&
operator
=(
const
NakedBuffers&) =
delete
;
~NakedBuffers
();
public:
int
GetN
();
double
*
GetX
();
double
*
GetY
();
private:
double
* m_Xbuf;
double
* m_Ybuf;
int
m_size;
};
template
<
typename
C>
class
NakedBuffers2
{
public:
NakedBuffers2
(
int
size,
double
valx,
double
valy)
: m_Xbuf(size), m_Ybuf(size) {
for
(
int
i =
0
; i < size; ++i) {
m_Xbuf[i] = valx * i;
m_Ybuf[i] = valy * i;
}
}
public:
int
GetN
() {
return
m_Xbuf.
size
(); }
double
*
GetX
() {
return
m_Xbuf.
data
(); }
double
*
GetY
() {
return
m_Ybuf.
data
(); }
private:
C m_Xbuf;
C m_Ybuf;
int
m_size;
};
class
Vector
:
public
std
::vector<
double
> {
public:
Vector
(
int
size) : std::vector<
double
>(size) {}
};
//
===========================================================================
class
MyBase
{
public:
virtual
~MyBase
();
};
class
MyDerived
:
public
MyBase
{
public:
virtual
~MyDerived
();
};
MyBase*
GimeDerived
();
//
===========================================================================
class
Countable
{
public:
Countable
() { ++
sInstances
; }
Countable
(
const
Countable&) { ++
sInstances
; }
Countable&
operator
=(
const
Countable&) {
return
*
this
; }
~Countable
() { --
sInstances
; }
public:
virtual
const
char
*
say_hi
() {
return
"
Hi!
"
; }
public:
unsigned
int
m_check =
0xcdcdcdcd
;
public:
static
int
sInstances
;
};
typedef
std::shared_ptr<Countable> SharedCountable_t;
extern
SharedCountable_t mine;
void
renew_mine
();
SharedCountable_t
gime_mine
();
SharedCountable_t*
gime_mine_ptr
();
SharedCountable_t&
gime_mine_ref
();
unsigned
int
pass_mine_sp
(SharedCountable_t p);
unsigned
int
pass_mine_sp_ref
(SharedCountable_t& p);
unsigned
int
pass_mine_sp_ptr
(SharedCountable_t* p);
unsigned
int
pass_mine_rp
(Countable);
unsigned
int
pass_mine_rp_ref
(
const
Countable&);
unsigned
int
pass_mine_rp_ptr
(
const
Countable*);
Countable*
gime_naked_countable
();
//
===========================================================================
class
unknown_iterator
;
class
IndexableBase
{
public:
unknown_iterator*
begin
() {
return
nullptr
; }
unknown_iterator*
end
() {
return
(unknown_iterator*)
1
; }
int
operator
[](
int
) {
return
42
; }
int
size
() {
return
1
; }
};
class
IndexableDerived
:
public
IndexableBase
{};
//
===========================================================================
class
WithCallback1
{
public:
WithCallback1
(
int
i);
public:
int
get_int
();
void
set_int
(
int
i);
private:
int
m_int;
public:
static
void
__cppjit_explicit_pythonize__
(PyObject* klass,
const
std::string&);
static
std::string klass_name;
};
class
WithCallback2
{
public:
WithCallback2
(
int
i);
public:
int
get_int
();
void
set_int
(
int
i);
protected:
int
m_int;
public:
static
void
__cppjit_pythonize__
(PyObject* klass,
const
std::string&);
static
std::string klass_name;
};
class
WithCallback3
:
public
WithCallback2
{
public:
using
WithCallback2::WithCallback2;
public:
int
get_int
();
void
set_int
(
int
i);
};
}
//
namespace pyzables
Back
|
FazBrowse Home
|
New Git URL