Skip to content

Commit b01b103

Browse files
committed
Merge pull request #1018 from hintjens/master
Problem: zmsg_sendm not defined in API model
2 parents 0dfe5f3 + f9b2809 commit b01b103

File tree

8 files changed

+65
-7
lines changed

8 files changed

+65
-7
lines changed

Makefile.am

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ noinst_LTLIBRARIES =
2424
TESTS =
2525

2626
EXTRA_DIST = \
27-
zgossip_engine.inc \
28-
zhash_primes.inc \
29-
zclass_example.xml \
27+
src/zgossip_engine.inc \
28+
src/zhash_primes.inc \
29+
src/zclass_example.xml \
3030
version.sh
3131

3232
include $(srcdir)/src/Makemodule.am

api/zmsg.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@
3030
<return type = "integer" />
3131
</method>
3232

33+
<method name = "sendm" singleton = "1">
34+
Send message to destination socket as part of a multipart sequence, and
35+
destroy the message after sending it successfully. Note that after a
36+
zmsg_sendm, you must call zmsg_send or another method that sends a final
37+
message part. If the message has no frames, sends nothing but destroys
38+
the message anyhow. Nullifies the caller's reference to the message (as
39+
it is a destructor).
40+
<argument name = "self_p" type = "zmsg" by_reference = "1" />
41+
<argument name = "dest" type = "anything" />
42+
<return type = "integer" />
43+
</method>
44+
3345
<method name = "size">
3446
Return size of message, i.e. number of frames (0 or more).
3547
<return type = "size" />

bindings/python/czmq.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,6 +1388,8 @@ def test(verbose):
13881388
lib.zmsg_recv.argtypes = [c_void_p]
13891389
lib.zmsg_send.restype = c_int
13901390
lib.zmsg_send.argtypes = [POINTER(zmsg_p), c_void_p]
1391+
lib.zmsg_sendm.restype = c_int
1392+
lib.zmsg_sendm.argtypes = [POINTER(zmsg_p), c_void_p]
13911393
lib.zmsg_size.restype = c_size_t
13921394
lib.zmsg_size.argtypes = [zmsg_p]
13931395
lib.zmsg_content_size.restype = c_size_t
@@ -1492,6 +1494,16 @@ def send(self_p, dest):
14921494
it is a destructor)."""
14931495
return lib.zmsg_send(byref(zmsg_p.from_param(self_p)), dest)
14941496

1497+
@staticmethod
1498+
def sendm(self_p, dest):
1499+
"""Send message to destination socket as part of a multipart sequence, and
1500+
destroy the message after sending it successfully. Note that after a
1501+
zmsg_sendm, you must call zmsg_send or another method that sends a final
1502+
message part. If the message has no frames, sends nothing but destroys
1503+
the message anyhow. Nullifies the caller's reference to the message (as
1504+
it is a destructor)."""
1505+
return lib.zmsg_sendm(byref(zmsg_p.from_param(self_p)), dest)
1506+
14951507
def size(self):
14961508
"""Return size of message, i.e. number of frames (0 or more)."""
14971509
return lib.zmsg_size(self._as_parameter_)

bindings/qml/src/QmlZmsg.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,17 @@ int QmlZmsgAttached::send (QmlZmsg *selfP, void *dest) {
222222
return zmsg_send (&selfP->self, dest);
223223
};
224224

225+
///
226+
// Send message to destination socket as part of a multipart sequence, and
227+
// destroy the message after sending it successfully. Note that after a
228+
// zmsg_sendm, you must call zmsg_send or another method that sends a final
229+
// message part. If the message has no frames, sends nothing but destroys
230+
// the message anyhow. Nullifies the caller's reference to the message (as
231+
// it is a destructor).
232+
int QmlZmsgAttached::sendm (QmlZmsg *selfP, void *dest) {
233+
return zmsg_sendm (&selfP->self, dest);
234+
};
235+
225236
///
226237
// Load/append an open file into message, create new message if
227238
// null message provided. Returns NULL if the message could not

bindings/qml/src/QmlZmsg.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,14 @@ public slots:
153153
// it is a destructor).
154154
int send (QmlZmsg *selfP, void *dest);
155155

156+
// Send message to destination socket as part of a multipart sequence, and
157+
// destroy the message after sending it successfully. Note that after a
158+
// zmsg_sendm, you must call zmsg_send or another method that sends a final
159+
// message part. If the message has no frames, sends nothing but destroys
160+
// the message anyhow. Nullifies the caller's reference to the message (as
161+
// it is a destructor).
162+
int sendm (QmlZmsg *selfP, void *dest);
163+
156164
// Load/append an open file into message, create new message if
157165
// null message provided. Returns NULL if the message could not
158166
// be loaded.

bindings/ruby/lib/czmq/ffi.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ def self.available?
200200
attach_function :zmsg_destroy, [:pointer], :void, **opts
201201
attach_function :zmsg_recv, [:pointer], :pointer, **opts
202202
attach_function :zmsg_send, [:pointer, :pointer], :int, **opts
203+
attach_function :zmsg_sendm, [:pointer, :pointer], :int, **opts
203204
attach_function :zmsg_size, [:pointer], :size_t, **opts
204205
attach_function :zmsg_content_size, [:pointer], :size_t, **opts
205206
attach_function :zmsg_prepend, [:pointer, :pointer], :int, **opts

bindings/ruby/lib/czmq/ffi/zmsg.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,18 @@ def self.send self_p, dest
8484
result
8585
end
8686

87+
# Send message to destination socket as part of a multipart sequence, and
88+
# destroy the message after sending it successfully. Note that after a
89+
# zmsg_sendm, you must call zmsg_send or another method that sends a final
90+
# message part. If the message has no frames, sends nothing but destroys
91+
# the message anyhow. Nullifies the caller's reference to the message (as
92+
# it is a destructor).
93+
def self.sendm self_p, dest
94+
self_p = self_p.__ptr_give_ref
95+
result = ::CZMQ::FFI.zmsg_sendm self_p, dest
96+
result
97+
end
98+
8799
# Return size of message, i.e. number of frames (0 or more).
88100
def size
89101
raise DestroyedError unless @ptr

include/zmsg.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,12 @@ CZMQ_EXPORT zmsg_t *
4444
CZMQ_EXPORT int
4545
zmsg_send (zmsg_t **self_p, void *dest);
4646

47-
// Send (More) message to destination socket, and destroy the message after sending
48-
// it successfully. If the message has no frames, sends nothing but destroys
49-
// the message anyhow. Nullifies the caller's reference to the message (as
50-
// it is a destructor).
47+
// Send message to destination socket as part of a multipart sequence, and
48+
// destroy the message after sending it successfully. Note that after a
49+
// zmsg_sendm, you must call zmsg_send or another method that sends a final
50+
// message part. If the message has no frames, sends nothing but destroys
51+
// the message anyhow. Nullifies the caller's reference to the message (as
52+
// it is a destructor).
5153
CZMQ_EXPORT int
5254
zmsg_sendm (zmsg_t **self_p, void *dest);
5355

0 commit comments

Comments
 (0)