9 #include "path/to/ns1.h" 10 #include "path/to/ns1/ClassB.h" 11 #include "path/to/ns2.h" 12 #include "path/to/ns2/ClassA.h" 13 #include "path/to/ns3.h" 15 #include "wrap/serialization.h" 16 #include <boost/serialization/export.hpp> 27 m_.doc() =
"pybind11 wrapper of namespaces_py";
31 py::class_<ns1::ClassA, std::shared_ptr<ns1::ClassA>>(m_ns1,
"ClassA")
34 py::class_<ns1::ClassB, std::shared_ptr<ns1::ClassB>>(m_ns1,
"ClassB")
39 py::class_<ns2::ClassA, std::shared_ptr<ns2::ClassA>>(m_ns2,
"ClassA")
41 .def(
"memberFunction",[](ns2::ClassA*
self){
return self->memberFunction();})
42 .def(
"nsArg",[](ns2::ClassA*
self,
const ns1::ClassB&
arg){
return self->nsArg(arg);},
py::arg(
"arg"))
43 .def(
"nsReturn",[](ns2::ClassA*
self,
double q){
return self->nsReturn(q);},
py::arg(
"q"))
44 .def_static(
"afunction",[](){
return ns2::ClassA::afunction();});
47 py::class_<ns2::ns3::ClassB, std::shared_ptr<ns2::ns3::ClassB>>(m_ns2_ns3,
"ClassB")
50 py::class_<ns2::ClassC, std::shared_ptr<ns2::ClassC>>(m_ns2,
"ClassC")
53 m_ns2.attr(
"aNs2Var") = ns2::aNs2Var;
54 m_ns2.
def(
"aGlobalFunction",[](){
return ns2::aGlobalFunction();});
55 m_ns2.
def(
"overloadedGlobalFunction",[](
const ns1::ClassA&
a){
return ns2::overloadedGlobalFunction(a);},
py::arg(
"a"));
56 m_ns2.
def(
"overloadedGlobalFunction",[](
const ns1::ClassA& a,
double b){
return ns2::overloadedGlobalFunction(a, b);},
py::arg(
"a"),
py::arg(
"b"));
57 py::class_<ClassD, std::shared_ptr<ClassD>>(m_,
"ClassD")
60 m_.attr(
"aGlobalVar") = aGlobalVar;
62 #include "python/specializations.h"
module_ def_submodule(const char *name, const char *doc=nullptr)
module_ & def(const char *name_, Func &&f, const Extra &...extra)
EIGEN_DEVICE_FUNC const Scalar & q
PYBIND11_MODULE(namespaces_py, m_)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const ArgReturnType arg() const