summaryrefslogtreecommitdiff
path: root/src/xsub.hpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-04-21 22:27:48 +0200
committerMartin Sustrik <sustrik@250bpm.com>2011-04-21 22:27:48 +0200
commite0246e32d79d71f8e73207b43aed8b23648e4fc7 (patch)
tree9952ee6fd39f4e27bbe932f6b6f30f0073009369 /src/xsub.hpp
parent581697695aac72894f2d3fefac904b9d50b3ba67 (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/xsub.hpp')
-rw-r--r--src/xsub.hpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/xsub.hpp b/src/xsub.hpp
index 6bd55ad..202a29f 100644
--- a/src/xsub.hpp
+++ b/src/xsub.hpp
@@ -21,10 +21,9 @@
#ifndef __ZMQ_XSUB_HPP_INCLUDED__
#define __ZMQ_XSUB_HPP_INCLUDED__
-#include "../include/zmq.h"
-
#include "trie.hpp"
#include "socket_base.hpp"
+#include "msg.hpp"
#include "fq.hpp"
namespace zmq
@@ -42,9 +41,9 @@ namespace zmq
// Overloads of functions from socket_base_t.
void xattach_pipes (class reader_t *inpipe_, class writer_t *outpipe_,
const blob_t &peer_identity_);
- int xsend (zmq_msg_t *msg_, int options_);
+ int xsend (class msg_t *msg_, int options_);
bool xhas_out ();
- int xrecv (zmq_msg_t *msg_, int flags_);
+ int xrecv (class msg_t *msg_, int flags_);
bool xhas_in ();
private:
@@ -53,7 +52,7 @@ namespace zmq
void process_term (int linger_);
// Check whether the message matches at least one subscription.
- bool match (zmq_msg_t *msg_);
+ bool match (class msg_t *msg_);
// Fair queueing object for inbound pipes.
fq_t fq;
@@ -64,7 +63,7 @@ namespace zmq
// If true, 'message' contains a matching message to return on the
// next recv call.
bool has_message;
- zmq_msg_t message;
+ msg_t message;
// If true, part of a multipart message was already received, but
// there are following parts still waiting.