diff options
author | lloyd <[email protected]> | 2006-08-23 04:23:58 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-08-23 04:23:58 +0000 |
commit | b35edb5db557517df9bcc07036c8ed2bac783fac (patch) | |
tree | ed4b3ab65b0abe4851b773df02b6c13d4b553420 /misc/python | |
parent | 7df8c3ed065db43b5c0fa2d6f7eb546a803e99e8 (diff) |
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.
Diffstat (limited to 'misc/python')
-rw-r--r-- | misc/python/src/filter.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
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<manage_new_object>()); } +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, boost::noncopyable>("Pipe") - .def(init< Python_Filter*, optional<Python_Filter*> >()) + .def(init<optional<Python_Filter*, Python_Filter*, Python_Filter*> >()) + .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()); } |