diff --git a/libsrc/core/python_ngcore.hpp b/libsrc/core/python_ngcore.hpp index 634094ad..d94ed122 100644 --- a/libsrc/core/python_ngcore.hpp +++ b/libsrc/core/python_ngcore.hpp @@ -8,6 +8,7 @@ #include #include "array.hpp" +#include "table.hpp" #include "archive.hpp" #include "flags.hpp" #include "ngcore_api.hpp" @@ -60,6 +61,23 @@ template struct type_caster> : ngcore_list_caster, Type> { }; + /* + template struct type_caster>> + { + template + static handle cast(T &&src, return_value_policy policy, handle parent) + { + std::cout << "handle called with type src = " << typeid(src).name() << std::endl; + + return handle(); // what so ever + } + + PYBIND11_TYPE_CASTER(Type, _("Table[") + make_caster::name + _("]")); + }; + */ + + + } // namespace detail } // namespace pybind11 //////////////////////////////////////////////////////////////////////////////// @@ -240,6 +258,14 @@ namespace ngcore ; } + template + void ExportTable (py::module &m) + { + py::class_, std::shared_ptr>> (m, ("Table+"+GetPyName()).c_str()) + ; + } + + void NGCORE_API SetFlag(Flags &flags, std::string s, py::object value); // Parse python kwargs to flags Flags NGCORE_API CreateFlagsFromKwArgs(const py::kwargs& kwargs, py::object pyclass = py::none(), diff --git a/libsrc/core/python_ngcore_export.cpp b/libsrc/core/python_ngcore_export.cpp index abdceb0e..044671f6 100644 --- a/libsrc/core/python_ngcore_export.cpp +++ b/libsrc/core/python_ngcore_export.cpp @@ -19,6 +19,8 @@ PYBIND11_MODULE(pyngcore, m) // NOLINT ExportArray(m); ExportArray(m); + ExportTable(m); + py::class_> (m, "BitArray") .def(py::init([] (size_t n) { return make_shared(n); }),py::arg("n")) .def(py::init([] (const BitArray& a) { return make_shared(a); } ), py::arg("ba"))