9 #include "folder/path/to/Test.h" 11 #include "wrap/serialization.h" 12 #include <boost/serialization/export.hpp> 23 m_.doc() =
"pybind11 wrapper of class_py";
26 py::class_<FunRange, std::shared_ptr<FunRange>>(m_,
"FunRange")
28 .def(
"range",[](FunRange*
self,
double d){
return self->range(d);},
py::arg(
"d"))
31 py::class_<Fun<double>, std::shared_ptr<Fun<double>>>(m_,
"FunDouble")
32 .def(
"templatedMethodString",[](Fun<double>*
self,
double d,
string t){
return self->templatedMethod<
string>(
d,
t);},
py::arg(
"d"),
py::arg(
"t"))
33 .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"))
34 .def_static(
"staticMethodWithThis",[](){
return Fun<double>::staticMethodWithThis();});
36 py::class_<Test, std::shared_ptr<Test>>(m_,
"Test")
38 .def(py::init<double, const gtsam::Matrix&>(),
py::arg(
"a"),
py::arg(
"b"))
40 .def(
"return_pair",[](Test*
self,
const gtsam::Vector& v){
return self->return_pair(v);},
py::arg(
"v"))
41 .def(
"return_bool",[](Test*
self,
bool value){
return self->return_bool(value);},
py::arg(
"value"))
42 .def(
"return_size_t",[](Test*
self,
size_t value){
return self->return_size_t(value);},
py::arg(
"value"))
43 .def(
"return_int",[](Test*
self,
int value){
return self->return_int(value);},
py::arg(
"value"))
44 .def(
"return_double",[](Test*
self,
double value){
return self->return_double(value);},
py::arg(
"value"))
45 .def(
"return_string",[](Test*
self,
string value){
return self->return_string(value);},
py::arg(
"value"))
46 .def(
"return_vector1",[](Test*
self,
const gtsam::Vector& value){
return self->return_vector1(value);},
py::arg(
"value"))
47 .def(
"return_matrix1",[](Test*
self,
const gtsam::Matrix& value){
return self->return_matrix1(value);},
py::arg(
"value"))
48 .def(
"return_vector2",[](Test*
self,
const gtsam::Vector& value){
return self->return_vector2(value);},
py::arg(
"value"))
49 .def(
"return_matrix2",[](Test*
self,
const gtsam::Matrix& value){
return self->return_matrix2(value);},
py::arg(
"value"))
50 .def(
"arg_EigenConstRef",[](Test*
self,
const gtsam::Matrix& value){
self->arg_EigenConstRef(value);},
py::arg(
"value"))
51 .def(
"return_field",[](Test*
self,
const Test& t){
return self->return_field(t);},
py::arg(
"t"))
52 .def(
"return_TestPtr",[](Test*
self,
const std::shared_ptr<Test> value){
return self->return_TestPtr(value);},
py::arg(
"value"))
53 .def(
"return_Test",[](Test*
self, std::shared_ptr<Test> value){
return self->return_Test(value);},
py::arg(
"value"))
54 .def(
"return_Point2Ptr",[](Test*
self,
bool value){
return self->return_Point2Ptr(value);},
py::arg(
"value"))
55 .def(
"create_ptrs",[](Test*
self){
return self->create_ptrs();})
56 .def(
"create_MixedPtrs",[](Test*
self){
return self->create_MixedPtrs();})
57 .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"))
58 .def(
"print_",[](Test*
self){ py::scoped_ostream_redirect output;
self->print();})
63 return redirect.
str();
65 .def(
"set_container",[](Test*
self, std::vector<testing::Test> container){
self->set_container(container);},
py::arg(
"container"))
66 .def(
"set_container",[](Test*
self, std::vector<std::shared_ptr<testing::Test>> container){
self->set_container(container);},
py::arg(
"container"))
67 .def(
"set_container",[](Test*
self, std::vector<testing::Test&> container){
self->set_container(container);},
py::arg(
"container"))
68 .def(
"get_container",[](Test*
self){
return self->get_container();})
69 .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_<MyFactor<gtsam::Pose2, gtsam::Matrix>, std::shared_ptr<MyFactor<gtsam::Pose2, gtsam::Matrix>>>(m_,
"MyFactorPosePoint2")
91 self.print(s, keyFormatter);
92 return redirect.
str();
96 #include "python/specializations.h"
static const KeyFormatter DefaultKeyFormatter
GeneralSFMFactor< SfmCamera, Point3 > MyFactor
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const ArgReturnType arg() const
std::string str() const
return the string
ADT create(const Signature &signature)
detail::initimpl::constructor< Args... > init()
Binds an existing constructor taking arguments Args...
PYBIND11_MODULE(class_py, m_)