Go to the documentation of this file.
18 m_sub.def(
"submodule_func", []() {
return "submodule_func()"; });
26 A &operator=(
const A &
copy) {
31 std::string toString()
const {
return "A[" + std::to_string(
v) +
"]"; }
36 py::class_<A>(m_sub,
"A").def(py::init<int>()).def(
"__repr__", &A::toString);
43 B &operator=(
const B &
copy) {
49 A &get_a1() {
return a1; }
50 A &get_a2() {
return a2; }
55 py::class_<B>(m_sub,
"B")
59 "Return the internal A 1",
60 py::return_value_policy::reference_internal)
63 "Return the internal A 2",
64 py::return_value_policy::reference_internal)
65 .def_readwrite(
"a1", &
B::a1)
67 .def_readwrite(
"a2", &
B::a2);
70 m.attr(
"OD") = py::module::import(
"collections").attr(
"OrderedDict");
74 m.def(
"duplicate_registration", []() {
78 class DupeException {};
82 = py::module_::create_extension_module(
"dummy",
nullptr,
new py::module_::module_def);
83 auto failures = py::list();
85 py::class_<Dupe1>(dm,
"Dupe1");
86 py::class_<Dupe2>(dm,
"Dupe2");
87 dm.def(
"dupe1_factory", []() {
return Dupe1(); });
88 py::exception<DupeException>(dm,
"DupeException");
91 py::class_<Dupe1>(dm,
"Dupe1");
92 failures.append(
"Dupe1 class");
93 }
catch (std::runtime_error &) {
96 dm.def(
"Dupe1", []() {
return Dupe1(); });
97 failures.append(
"Dupe1 function");
98 }
catch (std::runtime_error &) {
101 py::class_<Dupe3>(dm,
"dupe1_factory");
102 failures.append(
"dupe1_factory");
103 }
catch (std::runtime_error &) {
106 py::exception<Dupe3>(dm,
"Dupe2");
107 failures.append(
"Dupe2");
108 }
catch (std::runtime_error &) {
111 dm.def(
"DupeException", []() {
return 30; });
112 failures.append(
"DupeException1");
113 }
catch (std::runtime_error &) {
116 py::class_<DupeException>(dm,
"DupeException");
117 failures.append(
"DupeException2");
118 }
catch (std::runtime_error &) {
124 m.def(
"def_submodule", [](py::module_
m,
const char *
name) {
return m.def_submodule(
name); });
Annotation for function names.
Matrix< SCALARB, Dynamic, Dynamic, opt_B > B
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
void print_copy_created(T *inst, Values &&...values)
void print_default_created(T *inst, Values &&...values)
void print_copy_assigned(T *inst, Values &&...values)
void print_destroyed(T *inst, Values &&...values)
Array< int, Dynamic, 1 > v
TEST_SUBMODULE(modules, m)
void print_created(T *inst, Values &&...values)
gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:15:58