7 #include "folder/path/to/Test.h"
17 m_.doc() =
"pybind11 wrapper of class_py";
20 py::class_<FunRange, std::shared_ptr<FunRange>>(m_,
"FunRange")
22 .def(
"range",[](FunRange*
self,
double d){
return self->range(
d);},
py::arg(
"d"))
25 py::class_<Fun<double>, std::shared_ptr<Fun<double>>>(m_,
"FunDouble")
26 .def(
"templatedMethodString",[](Fun<double>*
self,
double d,
string t){
return self->templatedMethod<
string>(
d,
t);},
py::arg(
"d"),
py::arg(
"t"))
27 .def(
"multiTemplatedMethodStringSize_t",[](Fun<double>*
self,
double d,
string t,
size_t u){
return self->multiTemplatedMethod<string,
size_t>(
d,
t, u);},
py::arg(
"d"),
py::arg(
"t"),
py::arg(
"u"))
28 .def(
"sets",[](Fun<double>*
self){
return self->sets();})
29 .def_static(
"staticMethodWithThis",[](){
return Fun<double>::staticMethodWithThis();})
30 .def_static(
"templatedStaticMethodInt",[](
const int&
m){
return Fun<double>::templatedStaticMethod<int>(
m);},
py::arg(
"m"));
32 py::class_<Test, std::shared_ptr<Test>>(m_,
"Test")
34 .def(py::init<double, const gtsam::Matrix&>(),
py::arg(
"a"),
py::arg(
"b"))
37 .def(
"return_bool",[](Test*
self,
bool value){
return self->return_bool(
value);},
py::arg(
"value"))
38 .def(
"return_size_t",[](Test*
self,
size_t value){
return self->return_size_t(
value);},
py::arg(
"value"))
39 .def(
"return_int",[](Test*
self,
int value){
return self->return_int(
value);},
py::arg(
"value"))
40 .def(
"return_double",[](Test*
self,
double value){
return self->return_double(
value);},
py::arg(
"value"))
41 .def(
"return_string",[](Test*
self,
string value){
return self->return_string(
value);},
py::arg(
"value"))
47 .def(
"return_field",[](Test*
self,
const Test&
t){
return self->return_field(
t);},
py::arg(
"t"))
48 .def(
"return_TestPtr",[](Test*
self,
const std::shared_ptr<Test>
value){
return self->return_TestPtr(
value);},
py::arg(
"value"))
49 .def(
"return_Test",[](Test*
self, std::shared_ptr<Test>
value){
return self->return_Test(
value);},
py::arg(
"value"))
50 .def(
"return_Point2Ptr",[](Test*
self,
bool value){
return self->return_Point2Ptr(
value);},
py::arg(
"value"))
51 .def(
"create_ptrs",[](Test*
self){
return self->create_ptrs();})
52 .def(
"create_MixedPtrs",[](Test*
self){
return self->create_MixedPtrs();})
53 .def(
"return_ptrs",[](Test*
self, std::shared_ptr<Test>
p1, std::shared_ptr<Test>
p2){
return self->return_ptrs(
p1,
p2);},
py::arg(
"p1"),
py::arg(
"p2"))
54 .def(
"print",[](Test*
self){ py::scoped_ostream_redirect output;
self->print();})
59 return redirect.
str();
61 .def(
"lambda_",[](Test*
self){
self->lambda();})
62 .def(
"set_container",[](Test*
self, std::vector<testing::Test> container){
self->set_container(container);},
py::arg(
"container"))
63 .def(
"set_container",[](Test*
self, std::vector<std::shared_ptr<testing::Test>> container){
self->set_container(container);},
py::arg(
"container"))
64 .def(
"set_container",[](Test*
self, std::vector<testing::Test&> container){
self->set_container(container);},
py::arg(
"container"))
65 .def(
"get_container",[](Test*
self){
return self->get_container();})
67 .def_readwrite(
"model_ptr", &Test::model_ptr)
71 py::class_<PrimitiveRef<double>, std::shared_ptr<PrimitiveRef<double>>>(m_,
"PrimitiveRefDouble")
73 .def_static(
"Brutal",[](
const double&
t){
return PrimitiveRef<double>::Brutal(
t);},
py::arg(
"t"));
75 py::class_<MyVector<3>, std::shared_ptr<MyVector<3>>>(m_,
"MyVector3")
78 py::class_<MyVector<12>, std::shared_ptr<MyVector<12>>>(m_,
"MyVector12")
81 py::class_<MultipleTemplates<int, double>, std::shared_ptr<MultipleTemplates<int, double>>>(m_,
"MultipleTemplatesIntDouble");
83 py::class_<MultipleTemplates<int, float>, std::shared_ptr<MultipleTemplates<int, float>>>(m_,
"MultipleTemplatesIntFloat");
85 py::class_<ForwardKinematics, std::shared_ptr<ForwardKinematics>>(m_,
"ForwardKinematics")
86 .def(py::init<const gtdynamics::Robot&, const string&, const string&, const gtsam::Values&, const gtsam::Pose3&>(),
py::arg(
"robot"),
py::arg(
"start_link_name"),
py::arg(
"end_link_name"),
py::arg(
"joint_angles"),
py::arg(
"l2Tp") =
gtsam::Pose3());
88 py::class_<TemplatedConstructor, std::shared_ptr<TemplatedConstructor>>(m_,
"TemplatedConstructor")
90 .def(py::init<const string&>(),
py::arg(
"arg"))
91 .def(py::init<const int&>(),
py::arg(
"arg"))
92 .def(py::init<const double&>(),
py::arg(
"arg"));
94 py::class_<FastSet, std::shared_ptr<FastSet>>(m_,
"FastSet")
97 .def(
"__contains__",[](FastSet*
self,
size_t key){
return std::find(
self->begin(),
self->end(),
key) !=
self->end();},
py::arg(
"key"))
100 py::class_<HessianFactor, gtsam::GaussianFactor, std::shared_ptr<HessianFactor>>(m_,
"HessianFactor")
103 py::class_<MyFactor<gtsam::Pose2, gtsam::Matrix>, std::shared_ptr<MyFactor<gtsam::Pose2, gtsam::Matrix>>>(m_,
"MyFactorPosePoint2")
109 self.print(
s, keyFormatter);
110 return redirect.
str();
113 py::class_<SuperCoolFactor<gtsam::Pose3>, std::shared_ptr<SuperCoolFactor<gtsam::Pose3>>>(m_,
"SuperCoolFactorPose3");
115 #include "python/specializations.h"