wrap
pybind11
tests
test_python_multiple_inheritance.cpp
Go to the documentation of this file.
1
#include "
pybind11_tests.h
"
2
3
namespace
test_python_multiple_inheritance
{
4
5
// Copied from:
6
// https://github.com/google/clif/blob/5718e4d0807fd3b6a8187dde140069120b81ecef/clif/testing/python_multiple_inheritance.h
7
8
struct
CppBase
{
9
explicit
CppBase
(
int
value
) :
base_value
(
value
) {}
10
int
get_base_value
()
const
{
return
base_value
; }
11
void
reset_base_value
(
int
new_value) {
base_value
= new_value; }
12
13
private
:
14
int
base_value
;
15
};
16
17
struct
CppDrvd
:
CppBase
{
18
explicit
CppDrvd
(
int
value
) :
CppBase
(
value
),
drvd_value
(
value
* 3) {}
19
int
get_drvd_value
()
const
{
return
drvd_value
; }
20
void
reset_drvd_value
(
int
new_value) {
drvd_value
= new_value; }
21
22
int
get_base_value_from_drvd
()
const
{
return
get_base_value
(); }
23
void
reset_base_value_from_drvd
(
int
new_value) {
reset_base_value
(new_value); }
24
25
private
:
26
int
drvd_value
;
27
};
28
29
}
// namespace test_python_multiple_inheritance
30
31
TEST_SUBMODULE
(python_multiple_inheritance,
m
) {
32
using namespace
test_python_multiple_inheritance
;
33
34
py::class_<CppBase>(
m
,
"CppBase"
)
35
.def(py::init<int>())
36
.def(
"get_base_value"
, &
CppBase::get_base_value
)
37
.def(
"reset_base_value"
, &
CppBase::reset_base_value
);
38
39
py::class_<CppDrvd, CppBase>(
m
,
"CppDrvd"
)
40
.def(py::init<int>())
41
.def(
"get_drvd_value"
, &
CppDrvd::get_drvd_value
)
42
.def(
"reset_drvd_value"
, &
CppDrvd::reset_drvd_value
)
43
.def(
"get_base_value_from_drvd"
, &
CppDrvd::get_base_value_from_drvd
)
44
.def(
"reset_base_value_from_drvd"
, &
CppDrvd::reset_base_value_from_drvd
);
45
}
TEST_SUBMODULE
TEST_SUBMODULE(python_multiple_inheritance, m)
Definition:
test_python_multiple_inheritance.cpp:31
test_python_multiple_inheritance::CppBase::base_value
int base_value
Definition:
test_python_multiple_inheritance.cpp:14
test_python_multiple_inheritance::CppBase::get_base_value
int get_base_value() const
Definition:
test_python_multiple_inheritance.cpp:10
test_python_multiple_inheritance::CppBase::reset_base_value
void reset_base_value(int new_value)
Definition:
test_python_multiple_inheritance.cpp:11
test_python_multiple_inheritance
Definition:
test_python_multiple_inheritance.cpp:3
m
Matrix3f m
Definition:
AngleAxis_mimic_euler.cpp:1
test_python_multiple_inheritance::CppDrvd::reset_drvd_value
void reset_drvd_value(int new_value)
Definition:
test_python_multiple_inheritance.cpp:20
test_python_multiple_inheritance::CppDrvd::get_base_value_from_drvd
int get_base_value_from_drvd() const
Definition:
test_python_multiple_inheritance.cpp:22
test_python_multiple_inheritance::CppDrvd
Definition:
test_python_multiple_inheritance.cpp:17
test_python_multiple_inheritance::CppDrvd::CppDrvd
CppDrvd(int value)
Definition:
test_python_multiple_inheritance.cpp:18
test_python_multiple_inheritance::CppBase
Definition:
test_python_multiple_inheritance.cpp:8
test_python_multiple_inheritance::CppDrvd::drvd_value
int drvd_value
Definition:
test_python_multiple_inheritance.cpp:26
test_python_multiple_inheritance::CppDrvd::reset_base_value_from_drvd
void reset_base_value_from_drvd(int new_value)
Definition:
test_python_multiple_inheritance.cpp:23
pybind11_tests.h
test_python_multiple_inheritance::CppDrvd::get_drvd_value
int get_drvd_value() const
Definition:
test_python_multiple_inheritance.cpp:19
test_python_multiple_inheritance::CppBase::CppBase
CppBase(int value)
Definition:
test_python_multiple_inheritance.cpp:9
test_callbacks.value
value
Definition:
test_callbacks.py:160
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:07:05