xo-pyunit: initial commit
This commit is contained in:
commit
7c51ccb7f3
6 changed files with 136 additions and 0 deletions
27
src/pyunit/pyunit.cpp
Normal file
27
src/pyunit/pyunit.cpp
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/* @file pyunit.cpp */
|
||||
|
||||
// note: need pyreflect/ here bc pyreflect.hpp is generated, located in build directory
|
||||
#include "pyunit.hpp"
|
||||
#include "xo/unit/xquantity.hpp"
|
||||
#include "xo/pyutil/pyutil.hpp"
|
||||
//#include <pybind11/pybind11.h>
|
||||
//#include <pybind11/stl.h>
|
||||
//#include <pybind11/chrono.h>
|
||||
//#include <pybind11/operators.h>
|
||||
|
||||
namespace xo {
|
||||
namespace py = pybind11;
|
||||
|
||||
namespace qty {
|
||||
PYBIND11_MODULE(PYUNIT_MODULE_NAME(), m) {
|
||||
|
||||
py::class_<Quantity>(m, "Quantity")
|
||||
.def("__repr__",
|
||||
[](Quantity & x)
|
||||
{
|
||||
return tostr(x);
|
||||
})
|
||||
py::arg("qty"));
|
||||
}
|
||||
}
|
||||
} /*namespace xo*/
|
||||
Loading…
Add table
Add a link
Reference in a new issue