[zeromq-dev] [PATCH] Re: c++ api issues
Burak Arslan
burak.arslan at arskom.com.tr
Thu Oct 21 11:56:20 CEST 2010
On 10/21/10 12:51, Burak Arslan wrote:
> On 10/20/10 15:09, Martin Sustrik wrote:
>>> as for other points, should i file issues? are they already done? in
>>> which release are they going to be?
>> Feel free to submit a patch. It won't break anything so I'll just
>> apply it straight away.
>>
>
here's the patch for const_data.
>From 9dcd5f007043e508e93bdc02768225313e8ee343 Mon Sep 17 00:00:00 2001
From: Burak Arslan <burak-github at arskom.com.tr>
Date: Thu, 21 Oct 2010 12:54:51 +0300
Subject: [PATCH 3/3] added a const method for getting data to zmq::message_t
Signed-off-by: Burak Arslan <burak-github at arskom.com.tr>
---
include/zmq.h | 1 +
include/zmq.hpp | 5 +++++
src/zmq.cpp | 5 +++++
3 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/include/zmq.h b/include/zmq.h
index 275f801..31d7ace 100644
--- a/include/zmq.h
+++ b/include/zmq.h
@@ -149,6 +149,7 @@ ZMQ_EXPORT int zmq_msg_close (zmq_msg_t *msg);
ZMQ_EXPORT int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src);
ZMQ_EXPORT int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src);
ZMQ_EXPORT void *zmq_msg_data (zmq_msg_t *msg);
+ZMQ_EXPORT const void *zmq_msg_const_data (zmq_msg_t *msg);
ZMQ_EXPORT size_t zmq_msg_size (const zmq_msg_t *msg);
/******************************************************************************/
diff --git a/include/zmq.hpp b/include/zmq.hpp
index 9ec72e5..05380c7 100644
--- a/include/zmq.hpp
+++ b/include/zmq.hpp
@@ -148,6 +148,11 @@ namespace zmq
return zmq_msg_data (this);
}
+ inline const void *data () const
+ {
+ return zmq_msg_data (this);
+ }
+
inline size_t size () const
{
return zmq_msg_size (this);
diff --git a/src/zmq.cpp b/src/zmq.cpp
index 5770e04..7e901f6 100644
--- a/src/zmq.cpp
+++ b/src/zmq.cpp
@@ -207,6 +207,11 @@ int zmq_msg_copy (zmq_msg_t *dest_, zmq_msg_t *src_)
return 0;
}
+const void *zmq_msg_const_data (zmq_msg_t *msg_)
+{
+ return zmq_msg_data(msg_);
+}
+
void *zmq_msg_data (zmq_msg_t *msg_)
{
if (msg_->content == (zmq::msg_content_t*) ZMQ_VSM)
--
1.7.2.2
More information about the zeromq-dev
mailing list