diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2011-04-21 22:27:48 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2011-04-21 22:27:48 +0200 |
commit | e0246e32d79d71f8e73207b43aed8b23648e4fc7 (patch) | |
tree | 9952ee6fd39f4e27bbe932f6b6f30f0073009369 /src/socket_base.hpp | |
parent | 581697695aac72894f2d3fefac904b9d50b3ba67 (diff) |
Message-related functionality factored out into msg_t class.
This patch addresses serveral issues:
1. It gathers message related functionality scattered over whole
codebase into a single class.
2. It makes zmq_msg_t an opaque datatype. Internals of the class
don't pollute zmq.h header file.
3. zmq_msg_t size decreases from 48 to 32 bytes. That saves ~33%
of memory in scenarios with large amount of small messages.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/socket_base.hpp')
-rw-r--r-- | src/socket_base.hpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/socket_base.hpp b/src/socket_base.hpp index 333cddd..0a5c574 100644 --- a/src/socket_base.hpp +++ b/src/socket_base.hpp @@ -24,8 +24,6 @@ #include <map> #include <vector> -#include "../include/zmq.h" - #include "own.hpp" #include "array.hpp" #include "mutex.hpp" @@ -69,8 +67,8 @@ namespace zmq int getsockopt (int option_, void *optval_, size_t *optvallen_); int bind (const char *addr_); int connect (const char *addr_); - int send (zmq_msg_t *msg_, int flags_); - int recv (zmq_msg_t *msg_, int flags_); + int send (class msg_t *msg_, int flags_); + int recv (class msg_t *msg_, int flags_); int close (); // These functions are used by the polling mechanism to determine @@ -123,11 +121,11 @@ namespace zmq // The default implementation assumes that send is not supported. virtual bool xhas_out (); - virtual int xsend (zmq_msg_t *msg_, int options_); + virtual int xsend (class msg_t *msg_, int options_); // The default implementation assumes that recv in not supported. virtual bool xhas_in (); - virtual int xrecv (zmq_msg_t *msg_, int options_); + virtual int xrecv (class msg_t *msg_, int options_); // We are declaring termination handler as protected so that // individual socket types can hook into the termination process |