diff options
author | Johannes Schmitz <schmitz@ti.rwth-aachen.de> | 2014-05-07 17:59:01 +0200 |
---|---|---|
committer | Johannes Schmitz <schmitz@ti.rwth-aachen.de> | 2014-05-07 17:59:01 +0200 |
commit | ea2b698dbad69cf5ae62c7cac3a7506d776b0dcd (patch) | |
tree | fb7f3d208433e75d4f18a3e13dc630e73af28869 /gr-zeromq/lib/req_source_impl.cc | |
parent | 35aaec4d0d4b6f995911fd6d38697bc239cd68cf (diff) |
zeromq: Fix doxygen and memcpy for vlen
Diffstat (limited to 'gr-zeromq/lib/req_source_impl.cc')
-rw-r--r-- | gr-zeromq/lib/req_source_impl.cc | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/gr-zeromq/lib/req_source_impl.cc b/gr-zeromq/lib/req_source_impl.cc index ffe31f9953..8dedf6c6af 100644 --- a/gr-zeromq/lib/req_source_impl.cc +++ b/gr-zeromq/lib/req_source_impl.cc @@ -41,7 +41,7 @@ namespace gr { : gr::sync_block("req_source", gr::io_signature::make(0, 0, 0), gr::io_signature::make(1, 1, itemsize * vlen)), - d_itemsize(itemsize) + d_itemsize(itemsize), d_vlen(vlen) { d_context = new zmq::context_t(1); d_socket = new zmq::socket_t(*d_context, ZMQ_REQ); @@ -56,8 +56,8 @@ namespace gr { int req_source_impl::work(int noutput_items, - gr_vector_const_void_star &input_items, - gr_vector_void_star &output_items) + gr_vector_const_void_star &input_items, + gr_vector_void_star &output_items) { char *out = (char*)output_items[0]; @@ -66,10 +66,10 @@ namespace gr { // If we got a reply, process if (itemsout[0].revents & ZMQ_POLLOUT) { - // Request data, FIXME non portable - zmq::message_t request(sizeof(int)); - memcpy ((void *) request.data (), &noutput_items, sizeof(int)); - d_socket->send(request); + // Request data, FIXME non portable + zmq::message_t request(sizeof(int)); + memcpy ((void *) request.data (), &noutput_items, sizeof(int)); + d_socket->send(request); } zmq::pollitem_t itemsin[] = { { *d_socket, 0, ZMQ_POLLIN, 0 } }; @@ -77,14 +77,13 @@ namespace gr { // If we got a reply, process if (itemsin[0].revents & ZMQ_POLLIN) { - // Receive data - zmq::message_t reply; - d_socket->recv(&reply); + // Receive data + zmq::message_t reply; + d_socket->recv(&reply); - // Copy to ouput buffer and return - memcpy(out, (void *)reply.data(), reply.size()); - - return reply.size()/d_itemsize; + // Copy to ouput buffer and return + memcpy(out, (void *)reply.data(), reply.size()); + return reply.size()/(d_itemsize*d_vlen); } return 0; |