Skip to content

Commit

Permalink
interface
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobdenobel committed Nov 8, 2023
1 parent 683c845 commit 63d94e8
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ioh/src/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,21 @@ void define_writers(py::module &mod) {
py::module m = mod.def_submodule("writer");

py::class_<Writer, std::shared_ptr<Writer>>(m, "Writer")
.def("open", py::arg("path"), &Writer::open)
.def("open", &Writer::open, py::arg("path"))
.def("close", &Writer::close)
.def("is_open", &Writer::is_open)
.def("write", &Writer::write, py::arg("data"))
;

py::class_<OFStream, Writer, std::shared_ptr<OFStream>>(m, "OFStream").def(py::init<>());
py::class_<FWriter, Writer, std::shared_ptr<OFStream>>(m, "FWriter").def(
py::class_<FWriter, Writer, std::shared_ptr<FWriter>>(m, "FWriter").def(
py::init<size_t, int>(),
py::arg("buffer_size") = 0,
py:arg("buffer_mode") = _IOFBF
py::arg("buffer_mode") = _IOFBF
);
py::class_<CachedFWriter, FWriter, std::shared_ptr<CachedFWriter>>(m, "CachedFWriter").def(py::init<>());
py::class_<CachedFWriter, FWriter, std::shared_ptr<CachedFWriter>>(m, "CachedFWriter")
.def(py::init<>())
;

}

Expand Down Expand Up @@ -607,6 +609,7 @@ void define_logger(py::module &m)
{
py::class_<fs::path>(m, "Path").def(py::init<std::string>());
py::implicitly_convertible<std::string, fs::path>();

define_writers(m);
define_triggers(m);
define_properties(m);
Expand Down

0 comments on commit 63d94e8

Please sign in to comment.