From b35edb5db557517df9bcc07036c8ed2bac783fac Mon Sep 17 00:00:00 2001 From: lloyd Date: Wed, 23 Aug 2006 04:23:58 +0000 Subject: Add various useful attributes and functions. Also, remove the variant of Pipe::write taking a byte buffer and length, since it seems the normal thing to do in Python is to store binary data in strings. --- misc/python/src/filter.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'misc/python') diff --git a/misc/python/src/filter.cpp b/misc/python/src/filter.cpp index f028d05cd..099c1d610 100644 --- a/misc/python/src/filter.cpp +++ b/misc/python/src/filter.cpp @@ -70,16 +70,21 @@ void export_filters() return_value_policy()); } +BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(rallas_ovls, read_all_as_string, 0, 1) + void export_pipe() { - void (Pipe::*pipe_write1)(const std::string&) = &Pipe::write; - void (Pipe::*pipe_write2)(const byte[], u32bit) = &Pipe::write; + void (Pipe::*pipe_write_str)(const std::string&) = &Pipe::write; class_("Pipe") - .def(init< Python_Filter*, optional >()) + .def(init >()) + .def_readonly("LAST_MESSAGE", &Pipe::LAST_MESSAGE) + .def_readonly("DEFAULT_MESSAGE", &Pipe::DEFAULT_MESSAGE) + .add_property("default_msg", &Pipe::default_msg, &Pipe::set_default_msg) + .def("msg_count", &Pipe::message_count) + .def("end_of_data", &Pipe::end_of_data) .def("start_msg", &Pipe::start_msg) .def("end_msg", &Pipe::end_msg) - .def("write", pipe_write1) - .def("write", pipe_write2) - .def("read_all", &Pipe::read_all_as_string); + .def("write", pipe_write_str) + .def("read_all_as_string", &Pipe::read_all_as_string, rallas_ovls()); } -- cgit v1.2.3