From e0246e32d79d71f8e73207b43aed8b23648e4fc7 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Thu, 21 Apr 2011 22:27:48 +0200 Subject: 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 --- src/socket_base.hpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/socket_base.hpp') 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 #include -#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 -- cgit v1.2.3