5 #include <boost/asio/streambuf.hpp> 17 const boost::asio::streambuf & source)
20 dest.commit(bytes_copied);
23 static boost::asio::streambuf &
prepare_proxy(boost::asio::streambuf &
self,
const std::size_t n)
25 self.prepare(n);
return self;
34 typedef boost::asio::streambuf StreamBuffer;
35 bp::class_<StreamBuffer,boost::noncopyable>(
"StreamBuffer",
36 "Stream buffer to save/load serialized objects in binary mode.",
37 bp::init<>(bp::arg(
"self"),
"Default constructor."))
39 .def(
"size",&StreamBuffer::size,
"Get the size of the input sequence.")
40 .def(
"max_size",&StreamBuffer::max_size,
"Get the maximum size of the StreamBuffer.")
41 .def(
"prepare",
prepare_proxy,
"Reserve data.",bp::return_internal_reference<>())
45 bp::class_<StaticBuffer>(
"StaticBuffer",
46 "Static buffer to save/load serialized objects in binary mode with pre-allocated memory.",
47 bp::init<size_t>(
bp::args(
"self",
"size"),
"Default constructor from a given size capacity."))
48 .def(
"size",&StaticBuffer::size,bp::arg(
"self"),
49 "Get the size of the input sequence.")
50 .def(
"reserve",&StaticBuffer::resize,bp::arg(
"new_size"),
51 "Increase the capacity of the vector to a value that's greater or equal to new_size.")
56 "Copy bytes from a source buffer to a target buffer.");
void exposeSerialization()
static void buffer_copy(boost::asio::streambuf &dest, const boost::asio::streambuf &source)
Static buffer with pre-allocated memory.
boost::python::object getOrCreatePythonNamespace(const std::string &submodule_name)
Helper to create or simply return an existing namespace in Python.
static boost::asio::streambuf & prepare_proxy(boost::asio::streambuf &self, const std::size_t n)
Main pinocchio namespace.