[zeromq-dev] more on c++ api
Burak Arslan
burak.arslan at arskom.com.tr
Wed Oct 27 18:10:23 CEST 2010
hi,
i got a few ideas that would be nice to have in the c++ api:
1) zmq.hpp has
#include <assert.h>
#include <string.h>
in the beginning. converting them to
#include <cassert>
#include <cstring>
would be better in line with c++ conventions, and in case of cstring
header, would help keep the default namespace clean.
2) providing message_t (copy) constructors as such;
message_t(const std::vector<uint8_t> &) // for binary data
message_t(const std::string &) // for strings
will let us call socket.send("blah") or
socket.send(vector_with_binary_data);
3) providing stream operators
zmq::socket_t &operator<<(zmq::socket_t &, zmq::message_t &);
zmq::socket_t &operator>>(zmq::socket_t &, zmq::message_t &);
or even:
std::ostream &operator<<(std::ostream &, zmq::message_t &);
would be nice.
4) providing a multipart_message_t class and adding support for it to
socket's relevant functions would make the api more elegant.
i can probably work on those if you'd be willing to merge them before 3.x.
best,
burak
More information about the zeromq-dev
mailing list