czmq-ffi-gen 0.9.2-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/AUTHORS +1 -0
- data/CHANGES.md +92 -0
- data/Gemfile +2 -0
- data/LICENSE +14 -0
- data/README.md +112 -0
- data/lib/czmq-ffi-gen.rb +7 -0
- data/lib/czmq-ffi-gen/czmq/ffi.rb +1210 -0
- data/lib/czmq-ffi-gen/czmq/ffi/version.rb +15 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zactor.rb +186 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zarmour.rb +286 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zcert.rb +307 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zcertstore.rb +222 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zchunk.rb +388 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zclock.rb +140 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zconfig.rb +442 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zdigest.rb +156 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zdir.rb +283 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb +194 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zfile.rb +353 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zframe.rb +359 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zhash.rb +416 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zhashx.rb +659 -0
- data/lib/czmq-ffi-gen/czmq/ffi/ziflist.rb +189 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zlist.rb +365 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zlistx.rb +478 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zloop.rb +396 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zmsg.rb +515 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zpoller.rb +194 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zproc.rb +294 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zsock.rb +3479 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zstr.rb +203 -0
- data/lib/czmq-ffi-gen/czmq/ffi/ztimerset.rb +203 -0
- data/lib/czmq-ffi-gen/czmq/ffi/ztrie.rb +221 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zuuid.rb +227 -0
- data/lib/czmq-ffi-gen/errors.rb +12 -0
- data/lib/czmq-ffi-gen/gem_version.rb +5 -0
- data/lib/czmq-ffi-gen/legacy.rb +16 -0
- data/lib/czmq-ffi-gen/libzmq.rb +18 -0
- data/lib/czmq-ffi-gen/signals.rb +27 -0
- data/lib/czmq-ffi-gen/vendor.rb +5 -0
- data/lib/czmq-ffi-gen/versions.rb +19 -0
- data/vendor/local/bin/inproc_lat.exe +0 -0
- data/vendor/local/bin/inproc_thr.exe +0 -0
- data/vendor/local/bin/libczmq.dll +0 -0
- data/vendor/local/bin/libgcc_s_seh-1.dll +0 -0
- data/vendor/local/bin/libstdc++-6.dll +0 -0
- data/vendor/local/bin/libzmq.dll +0 -0
- data/vendor/local/bin/local_lat.exe +0 -0
- data/vendor/local/bin/local_thr.exe +0 -0
- data/vendor/local/bin/remote_lat.exe +0 -0
- data/vendor/local/bin/remote_thr.exe +0 -0
- data/vendor/local/include/czmq.h +31 -0
- data/vendor/local/include/czmq_library.h +199 -0
- data/vendor/local/include/czmq_prelude.h +641 -0
- data/vendor/local/include/readme.txt +83 -0
- data/vendor/local/include/sha1.h +76 -0
- data/vendor/local/include/sha1.inc_c +335 -0
- data/vendor/local/include/slre.h +92 -0
- data/vendor/local/include/slre.inc_c +660 -0
- data/vendor/local/include/zactor.h +76 -0
- data/vendor/local/include/zarmour.h +114 -0
- data/vendor/local/include/zauth.h +100 -0
- data/vendor/local/include/zauth_v2.h +88 -0
- data/vendor/local/include/zbeacon.h +86 -0
- data/vendor/local/include/zbeacon_v2.h +75 -0
- data/vendor/local/include/zcert.h +136 -0
- data/vendor/local/include/zcertstore.h +100 -0
- data/vendor/local/include/zchunk.h +163 -0
- data/vendor/local/include/zclock.h +73 -0
- data/vendor/local/include/zconfig.h +185 -0
- data/vendor/local/include/zctx.h +107 -0
- data/vendor/local/include/zdigest.h +65 -0
- data/vendor/local/include/zdir.h +149 -0
- data/vendor/local/include/zdir_patch.h +82 -0
- data/vendor/local/include/zfile.h +177 -0
- data/vendor/local/include/zframe.h +176 -0
- data/vendor/local/include/zgossip.h +95 -0
- data/vendor/local/include/zgossip_engine.inc +927 -0
- data/vendor/local/include/zgossip_msg.h +129 -0
- data/vendor/local/include/zhash.h +195 -0
- data/vendor/local/include/zhash_primes.inc +329 -0
- data/vendor/local/include/zhashx.h +298 -0
- data/vendor/local/include/ziflist.h +77 -0
- data/vendor/local/include/zlist.h +158 -0
- data/vendor/local/include/zlistx.h +205 -0
- data/vendor/local/include/zloop.h +168 -0
- data/vendor/local/include/zmonitor.h +73 -0
- data/vendor/local/include/zmonitor_v2.h +56 -0
- data/vendor/local/include/zmq.h +617 -0
- data/vendor/local/include/zmq_utils.h +48 -0
- data/vendor/local/include/zmsg.h +280 -0
- data/vendor/local/include/zmutex.h +55 -0
- data/vendor/local/include/zpoller.h +92 -0
- data/vendor/local/include/zproc.h +168 -0
- data/vendor/local/include/zproxy.h +111 -0
- data/vendor/local/include/zproxy_v2.h +62 -0
- data/vendor/local/include/zrex.h +82 -0
- data/vendor/local/include/zsock.h +912 -0
- data/vendor/local/include/zsock_option.inc +4126 -0
- data/vendor/local/include/zsocket.h +110 -0
- data/vendor/local/include/zsockopt.h +256 -0
- data/vendor/local/include/zstr.h +110 -0
- data/vendor/local/include/zsys.h +386 -0
- data/vendor/local/include/zthread.h +50 -0
- data/vendor/local/include/ztimerset.h +90 -0
- data/vendor/local/include/ztrie.h +106 -0
- data/vendor/local/include/zuuid.h +96 -0
- data/vendor/local/lib/libczmq.dll.a +0 -0
- data/vendor/local/lib/liblibzmq.dll.a +0 -0
- data/vendor/local/lib/libzmq-static.a +0 -0
- data/vendor/local/lib/pkgconfig/libczmq.pc +23 -0
- data/vendor/local/lib/pkgconfig/libzmq.pc +11 -0
- data/vendor/local/share/zmq/AUTHORS.txt +147 -0
- data/vendor/local/share/zmq/COPYING.LESSER.txt +181 -0
- data/vendor/local/share/zmq/COPYING.txt +674 -0
- data/vendor/local/share/zmq/NEWS.txt +978 -0
- metadata +230 -0
@@ -0,0 +1,396 @@
|
|
1
|
+
################################################################################
|
2
|
+
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
|
3
|
+
# Read the zproject/README.md for information about making permanent changes. #
|
4
|
+
################################################################################
|
5
|
+
|
6
|
+
module CZMQ
|
7
|
+
module FFI
|
8
|
+
|
9
|
+
# event-driven reactor
|
10
|
+
# @note This class is 100% generated using zproject.
|
11
|
+
class Zloop
|
12
|
+
# Raised when one tries to use an instance of {Zloop} after
|
13
|
+
# the internal pointer to the native object has been nullified.
|
14
|
+
class DestroyedError < RuntimeError; end
|
15
|
+
|
16
|
+
# Boilerplate for self pointer, initializer, and finalizer
|
17
|
+
class << self
|
18
|
+
alias :__new :new
|
19
|
+
end
|
20
|
+
# Attaches the pointer _ptr_ to this instance and defines a finalizer for
|
21
|
+
# it if necessary.
|
22
|
+
# @param ptr [::FFI::Pointer]
|
23
|
+
# @param finalize [Boolean]
|
24
|
+
def initialize(ptr, finalize = true)
|
25
|
+
@ptr = ptr
|
26
|
+
if @ptr.null?
|
27
|
+
@ptr = nil # Remove null pointers so we don't have to test for them.
|
28
|
+
elsif finalize
|
29
|
+
@finalizer = self.class.create_finalizer_for @ptr
|
30
|
+
ObjectSpace.define_finalizer self, @finalizer
|
31
|
+
end
|
32
|
+
end
|
33
|
+
# @param ptr [::FFI::Pointer]
|
34
|
+
# @return [Proc]
|
35
|
+
def self.create_finalizer_for(ptr)
|
36
|
+
Proc.new do
|
37
|
+
ptr_ptr = ::FFI::MemoryPointer.new :pointer
|
38
|
+
ptr_ptr.write_pointer ptr
|
39
|
+
::CZMQ::FFI.zloop_destroy ptr_ptr
|
40
|
+
end
|
41
|
+
end
|
42
|
+
# @return [Boolean]
|
43
|
+
def null?
|
44
|
+
!@ptr or @ptr.null?
|
45
|
+
end
|
46
|
+
# Return internal pointer
|
47
|
+
# @return [::FFI::Pointer]
|
48
|
+
def __ptr
|
49
|
+
raise DestroyedError unless @ptr
|
50
|
+
@ptr
|
51
|
+
end
|
52
|
+
# So external Libraries can just pass the Object to a FFI function which expects a :pointer
|
53
|
+
alias_method :to_ptr, :__ptr
|
54
|
+
# Nullify internal pointer and return pointer pointer.
|
55
|
+
# @note This detaches the current instance from the native object
|
56
|
+
# and thus makes it unusable.
|
57
|
+
# @return [::FFI::MemoryPointer] the pointer pointing to a pointer
|
58
|
+
# pointing to the native object
|
59
|
+
def __ptr_give_ref
|
60
|
+
raise DestroyedError unless @ptr
|
61
|
+
ptr_ptr = ::FFI::MemoryPointer.new :pointer
|
62
|
+
ptr_ptr.write_pointer @ptr
|
63
|
+
__undef_finalizer if @finalizer
|
64
|
+
@ptr = nil
|
65
|
+
ptr_ptr
|
66
|
+
end
|
67
|
+
# Undefines the finalizer for this object.
|
68
|
+
# @note Only use this if you need to and can guarantee that the native
|
69
|
+
# object will be freed by other means.
|
70
|
+
# @return [void]
|
71
|
+
def __undef_finalizer
|
72
|
+
ObjectSpace.undefine_finalizer self
|
73
|
+
@finalizer = nil
|
74
|
+
end
|
75
|
+
|
76
|
+
# Create a new callback of the following type:
|
77
|
+
# Callback function for reactor socket activity
|
78
|
+
# typedef int (zloop_reader_fn) (
|
79
|
+
# zloop_t *loop, zsock_t *reader, void *arg);
|
80
|
+
#
|
81
|
+
# @note WARNING: If your Ruby code doesn't retain a reference to the
|
82
|
+
# FFI::Function object after passing it to a C function call,
|
83
|
+
# it may be garbage collected while C still holds the pointer,
|
84
|
+
# potentially resulting in a segmentation fault.
|
85
|
+
def self.reader_fn
|
86
|
+
::FFI::Function.new :int, [:pointer, :pointer, :pointer], blocking: true do |loop, reader, arg|
|
87
|
+
loop = Zloop.__new loop, false
|
88
|
+
reader = Zsock.__new reader, false
|
89
|
+
result = yield loop, reader, arg
|
90
|
+
result = Integer(result)
|
91
|
+
result
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# Create a new callback of the following type:
|
96
|
+
# Callback function for reactor events (low-level)
|
97
|
+
# typedef int (zloop_fn) (
|
98
|
+
# zloop_t *loop, zmq_pollitem_t *item, void *arg);
|
99
|
+
#
|
100
|
+
# @note WARNING: If your Ruby code doesn't retain a reference to the
|
101
|
+
# FFI::Function object after passing it to a C function call,
|
102
|
+
# it may be garbage collected while C still holds the pointer,
|
103
|
+
# potentially resulting in a segmentation fault.
|
104
|
+
def self.fn
|
105
|
+
::FFI::Function.new :int, [:pointer, :pointer, :pointer], blocking: true do |loop, item, arg|
|
106
|
+
loop = Zloop.__new loop, false
|
107
|
+
result = yield loop, item, arg
|
108
|
+
result = Integer(result)
|
109
|
+
result
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
# Create a new callback of the following type:
|
114
|
+
# Callback for reactor timer events
|
115
|
+
# typedef int (zloop_timer_fn) (
|
116
|
+
# zloop_t *loop, int timer_id, void *arg);
|
117
|
+
#
|
118
|
+
# @note WARNING: If your Ruby code doesn't retain a reference to the
|
119
|
+
# FFI::Function object after passing it to a C function call,
|
120
|
+
# it may be garbage collected while C still holds the pointer,
|
121
|
+
# potentially resulting in a segmentation fault.
|
122
|
+
def self.timer_fn
|
123
|
+
::FFI::Function.new :int, [:pointer, :int, :pointer], blocking: true do |loop, timer_id, arg|
|
124
|
+
loop = Zloop.__new loop, false
|
125
|
+
result = yield loop, timer_id, arg
|
126
|
+
result = Integer(result)
|
127
|
+
result
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
# Create a new zloop reactor
|
132
|
+
# @return [CZMQ::Zloop]
|
133
|
+
def self.new()
|
134
|
+
ptr = ::CZMQ::FFI.zloop_new()
|
135
|
+
__new ptr
|
136
|
+
end
|
137
|
+
|
138
|
+
# Destroy a reactor
|
139
|
+
#
|
140
|
+
# @return [void]
|
141
|
+
def destroy()
|
142
|
+
return unless @ptr
|
143
|
+
self_p = __ptr_give_ref
|
144
|
+
result = ::CZMQ::FFI.zloop_destroy(self_p)
|
145
|
+
result
|
146
|
+
end
|
147
|
+
|
148
|
+
# Register socket reader with the reactor. When the reader has messages,
|
149
|
+
# the reactor will call the handler, passing the arg. Returns 0 if OK, -1
|
150
|
+
# if there was an error. If you register the same socket more than once,
|
151
|
+
# each instance will invoke its corresponding handler.
|
152
|
+
#
|
153
|
+
# @param sock [Zsock, #__ptr]
|
154
|
+
# @param handler [::FFI::Pointer, #to_ptr]
|
155
|
+
# @param arg [::FFI::Pointer, #to_ptr]
|
156
|
+
# @return [Integer]
|
157
|
+
def reader(sock, handler, arg)
|
158
|
+
raise DestroyedError unless @ptr
|
159
|
+
self_p = @ptr
|
160
|
+
sock = sock.__ptr if sock
|
161
|
+
result = ::CZMQ::FFI.zloop_reader(self_p, sock, handler, arg)
|
162
|
+
result
|
163
|
+
end
|
164
|
+
|
165
|
+
# Cancel a socket reader from the reactor. If multiple readers exist for
|
166
|
+
# same socket, cancels ALL of them.
|
167
|
+
#
|
168
|
+
# @param sock [Zsock, #__ptr]
|
169
|
+
# @return [void]
|
170
|
+
def reader_end(sock)
|
171
|
+
raise DestroyedError unless @ptr
|
172
|
+
self_p = @ptr
|
173
|
+
sock = sock.__ptr if sock
|
174
|
+
result = ::CZMQ::FFI.zloop_reader_end(self_p, sock)
|
175
|
+
result
|
176
|
+
end
|
177
|
+
|
178
|
+
# Configure a registered reader to ignore errors. If you do not set this,
|
179
|
+
# then readers that have errors are removed from the reactor silently.
|
180
|
+
#
|
181
|
+
# @param sock [Zsock, #__ptr]
|
182
|
+
# @return [void]
|
183
|
+
def reader_set_tolerant(sock)
|
184
|
+
raise DestroyedError unless @ptr
|
185
|
+
self_p = @ptr
|
186
|
+
sock = sock.__ptr if sock
|
187
|
+
result = ::CZMQ::FFI.zloop_reader_set_tolerant(self_p, sock)
|
188
|
+
result
|
189
|
+
end
|
190
|
+
|
191
|
+
# Register low-level libzmq pollitem with the reactor. When the pollitem
|
192
|
+
# is ready, will call the handler, passing the arg. Returns 0 if OK, -1
|
193
|
+
# if there was an error. If you register the pollitem more than once, each
|
194
|
+
# instance will invoke its corresponding handler. A pollitem with
|
195
|
+
# socket=NULL and fd=0 means 'poll on FD zero'.
|
196
|
+
#
|
197
|
+
# @param item [::FFI::Pointer, #to_ptr]
|
198
|
+
# @param handler [::FFI::Pointer, #to_ptr]
|
199
|
+
# @param arg [::FFI::Pointer, #to_ptr]
|
200
|
+
# @return [Integer]
|
201
|
+
def poller(item, handler, arg)
|
202
|
+
raise DestroyedError unless @ptr
|
203
|
+
self_p = @ptr
|
204
|
+
result = ::CZMQ::FFI.zloop_poller(self_p, item, handler, arg)
|
205
|
+
result
|
206
|
+
end
|
207
|
+
|
208
|
+
# Cancel a pollitem from the reactor, specified by socket or FD. If both
|
209
|
+
# are specified, uses only socket. If multiple poll items exist for same
|
210
|
+
# socket/FD, cancels ALL of them.
|
211
|
+
#
|
212
|
+
# @param item [::FFI::Pointer, #to_ptr]
|
213
|
+
# @return [void]
|
214
|
+
def poller_end(item)
|
215
|
+
raise DestroyedError unless @ptr
|
216
|
+
self_p = @ptr
|
217
|
+
result = ::CZMQ::FFI.zloop_poller_end(self_p, item)
|
218
|
+
result
|
219
|
+
end
|
220
|
+
|
221
|
+
# Configure a registered poller to ignore errors. If you do not set this,
|
222
|
+
# then poller that have errors are removed from the reactor silently.
|
223
|
+
#
|
224
|
+
# @param item [::FFI::Pointer, #to_ptr]
|
225
|
+
# @return [void]
|
226
|
+
def poller_set_tolerant(item)
|
227
|
+
raise DestroyedError unless @ptr
|
228
|
+
self_p = @ptr
|
229
|
+
result = ::CZMQ::FFI.zloop_poller_set_tolerant(self_p, item)
|
230
|
+
result
|
231
|
+
end
|
232
|
+
|
233
|
+
# Register a timer that expires after some delay and repeats some number of
|
234
|
+
# times. At each expiry, will call the handler, passing the arg. To run a
|
235
|
+
# timer forever, use 0 times. Returns a timer_id that is used to cancel the
|
236
|
+
# timer in the future. Returns -1 if there was an error.
|
237
|
+
#
|
238
|
+
# @param delay [Integer, #to_int, #to_i]
|
239
|
+
# @param times [Integer, #to_int, #to_i]
|
240
|
+
# @param handler [::FFI::Pointer, #to_ptr]
|
241
|
+
# @param arg [::FFI::Pointer, #to_ptr]
|
242
|
+
# @return [Integer]
|
243
|
+
def timer(delay, times, handler, arg)
|
244
|
+
raise DestroyedError unless @ptr
|
245
|
+
self_p = @ptr
|
246
|
+
delay = Integer(delay)
|
247
|
+
times = Integer(times)
|
248
|
+
result = ::CZMQ::FFI.zloop_timer(self_p, delay, times, handler, arg)
|
249
|
+
result
|
250
|
+
end
|
251
|
+
|
252
|
+
# Cancel a specific timer identified by a specific timer_id (as returned by
|
253
|
+
# zloop_timer).
|
254
|
+
#
|
255
|
+
# @param timer_id [Integer, #to_int, #to_i]
|
256
|
+
# @return [Integer]
|
257
|
+
def timer_end(timer_id)
|
258
|
+
raise DestroyedError unless @ptr
|
259
|
+
self_p = @ptr
|
260
|
+
timer_id = Integer(timer_id)
|
261
|
+
result = ::CZMQ::FFI.zloop_timer_end(self_p, timer_id)
|
262
|
+
result
|
263
|
+
end
|
264
|
+
|
265
|
+
# Register a ticket timer. Ticket timers are very fast in the case where
|
266
|
+
# you use a lot of timers (thousands), and frequently remove and add them.
|
267
|
+
# The main use case is expiry timers for servers that handle many clients,
|
268
|
+
# and which reset the expiry timer for each message received from a client.
|
269
|
+
# Whereas normal timers perform poorly as the number of clients grows, the
|
270
|
+
# cost of ticket timers is constant, no matter the number of clients. You
|
271
|
+
# must set the ticket delay using zloop_set_ticket_delay before creating a
|
272
|
+
# ticket. Returns a handle to the timer that you should use in
|
273
|
+
# zloop_ticket_reset and zloop_ticket_delete.
|
274
|
+
#
|
275
|
+
# @param handler [::FFI::Pointer, #to_ptr]
|
276
|
+
# @param arg [::FFI::Pointer, #to_ptr]
|
277
|
+
# @return [::FFI::Pointer]
|
278
|
+
def ticket(handler, arg)
|
279
|
+
raise DestroyedError unless @ptr
|
280
|
+
self_p = @ptr
|
281
|
+
result = ::CZMQ::FFI.zloop_ticket(self_p, handler, arg)
|
282
|
+
result
|
283
|
+
end
|
284
|
+
|
285
|
+
# Reset a ticket timer, which moves it to the end of the ticket list and
|
286
|
+
# resets its execution time. This is a very fast operation.
|
287
|
+
#
|
288
|
+
# @param handle [::FFI::Pointer, #to_ptr]
|
289
|
+
# @return [void]
|
290
|
+
def ticket_reset(handle)
|
291
|
+
raise DestroyedError unless @ptr
|
292
|
+
self_p = @ptr
|
293
|
+
result = ::CZMQ::FFI.zloop_ticket_reset(self_p, handle)
|
294
|
+
result
|
295
|
+
end
|
296
|
+
|
297
|
+
# Delete a ticket timer. We do not actually delete the ticket here, as
|
298
|
+
# other code may still refer to the ticket. We mark as deleted, and remove
|
299
|
+
# later and safely.
|
300
|
+
#
|
301
|
+
# @param handle [::FFI::Pointer, #to_ptr]
|
302
|
+
# @return [void]
|
303
|
+
def ticket_delete(handle)
|
304
|
+
raise DestroyedError unless @ptr
|
305
|
+
self_p = @ptr
|
306
|
+
result = ::CZMQ::FFI.zloop_ticket_delete(self_p, handle)
|
307
|
+
result
|
308
|
+
end
|
309
|
+
|
310
|
+
# Set the ticket delay, which applies to all tickets. If you lower the
|
311
|
+
# delay and there are already tickets created, the results are undefined.
|
312
|
+
#
|
313
|
+
# @param ticket_delay [Integer, #to_int, #to_i]
|
314
|
+
# @return [void]
|
315
|
+
def set_ticket_delay(ticket_delay)
|
316
|
+
raise DestroyedError unless @ptr
|
317
|
+
self_p = @ptr
|
318
|
+
ticket_delay = Integer(ticket_delay)
|
319
|
+
result = ::CZMQ::FFI.zloop_set_ticket_delay(self_p, ticket_delay)
|
320
|
+
result
|
321
|
+
end
|
322
|
+
|
323
|
+
# Set hard limit on number of timers allowed. Setting more than a small
|
324
|
+
# number of timers (10-100) can have a dramatic impact on the performance
|
325
|
+
# of the reactor. For high-volume cases, use ticket timers. If the hard
|
326
|
+
# limit is reached, the reactor stops creating new timers and logs an
|
327
|
+
# error.
|
328
|
+
#
|
329
|
+
# @param max_timers [Integer, #to_int, #to_i]
|
330
|
+
# @return [void]
|
331
|
+
def set_max_timers(max_timers)
|
332
|
+
raise DestroyedError unless @ptr
|
333
|
+
self_p = @ptr
|
334
|
+
max_timers = Integer(max_timers)
|
335
|
+
result = ::CZMQ::FFI.zloop_set_max_timers(self_p, max_timers)
|
336
|
+
result
|
337
|
+
end
|
338
|
+
|
339
|
+
# Set verbose tracing of reactor on/off. The default verbose setting is
|
340
|
+
# off (false).
|
341
|
+
#
|
342
|
+
# @param verbose [Boolean]
|
343
|
+
# @return [void]
|
344
|
+
def set_verbose(verbose)
|
345
|
+
raise DestroyedError unless @ptr
|
346
|
+
self_p = @ptr
|
347
|
+
verbose = !(0==verbose||!verbose) # boolean
|
348
|
+
result = ::CZMQ::FFI.zloop_set_verbose(self_p, verbose)
|
349
|
+
result
|
350
|
+
end
|
351
|
+
|
352
|
+
# By default the reactor stops if the process receives a SIGINT or SIGTERM
|
353
|
+
# signal. This makes it impossible to shut-down message based architectures
|
354
|
+
# like zactors. This method lets you switch off break handling. The default
|
355
|
+
# nonstop setting is off (false).
|
356
|
+
#
|
357
|
+
# @param nonstop [Boolean]
|
358
|
+
# @return [void]
|
359
|
+
def set_nonstop(nonstop)
|
360
|
+
raise DestroyedError unless @ptr
|
361
|
+
self_p = @ptr
|
362
|
+
nonstop = !(0==nonstop||!nonstop) # boolean
|
363
|
+
result = ::CZMQ::FFI.zloop_set_nonstop(self_p, nonstop)
|
364
|
+
result
|
365
|
+
end
|
366
|
+
|
367
|
+
# Start the reactor. Takes control of the thread and returns when the 0MQ
|
368
|
+
# context is terminated or the process is interrupted, or any event handler
|
369
|
+
# returns -1. Event handlers may register new sockets and timers, and
|
370
|
+
# cancel sockets. Returns 0 if interrupted, -1 if canceled by a handler.
|
371
|
+
#
|
372
|
+
# @return [Integer]
|
373
|
+
def start()
|
374
|
+
raise DestroyedError unless @ptr
|
375
|
+
self_p = @ptr
|
376
|
+
result = ::CZMQ::FFI.zloop_start(self_p)
|
377
|
+
result
|
378
|
+
end
|
379
|
+
|
380
|
+
# Self test of this class.
|
381
|
+
#
|
382
|
+
# @param verbose [Boolean]
|
383
|
+
# @return [void]
|
384
|
+
def self.test(verbose)
|
385
|
+
verbose = !(0==verbose||!verbose) # boolean
|
386
|
+
result = ::CZMQ::FFI.zloop_test(verbose)
|
387
|
+
result
|
388
|
+
end
|
389
|
+
end
|
390
|
+
end
|
391
|
+
end
|
392
|
+
|
393
|
+
################################################################################
|
394
|
+
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
|
395
|
+
# Read the zproject/README.md for information about making permanent changes. #
|
396
|
+
################################################################################
|
@@ -0,0 +1,515 @@
|
|
1
|
+
################################################################################
|
2
|
+
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
|
3
|
+
# Read the zproject/README.md for information about making permanent changes. #
|
4
|
+
################################################################################
|
5
|
+
|
6
|
+
module CZMQ
|
7
|
+
module FFI
|
8
|
+
|
9
|
+
# working with multipart messages
|
10
|
+
# @note This class is 100% generated using zproject.
|
11
|
+
class Zmsg
|
12
|
+
# Raised when one tries to use an instance of {Zmsg} after
|
13
|
+
# the internal pointer to the native object has been nullified.
|
14
|
+
class DestroyedError < RuntimeError; end
|
15
|
+
|
16
|
+
# Boilerplate for self pointer, initializer, and finalizer
|
17
|
+
class << self
|
18
|
+
alias :__new :new
|
19
|
+
end
|
20
|
+
# Attaches the pointer _ptr_ to this instance and defines a finalizer for
|
21
|
+
# it if necessary.
|
22
|
+
# @param ptr [::FFI::Pointer]
|
23
|
+
# @param finalize [Boolean]
|
24
|
+
def initialize(ptr, finalize = true)
|
25
|
+
@ptr = ptr
|
26
|
+
if @ptr.null?
|
27
|
+
@ptr = nil # Remove null pointers so we don't have to test for them.
|
28
|
+
elsif finalize
|
29
|
+
@finalizer = self.class.create_finalizer_for @ptr
|
30
|
+
ObjectSpace.define_finalizer self, @finalizer
|
31
|
+
end
|
32
|
+
end
|
33
|
+
# @param ptr [::FFI::Pointer]
|
34
|
+
# @return [Proc]
|
35
|
+
def self.create_finalizer_for(ptr)
|
36
|
+
Proc.new do
|
37
|
+
ptr_ptr = ::FFI::MemoryPointer.new :pointer
|
38
|
+
ptr_ptr.write_pointer ptr
|
39
|
+
::CZMQ::FFI.zmsg_destroy ptr_ptr
|
40
|
+
end
|
41
|
+
end
|
42
|
+
# @return [Boolean]
|
43
|
+
def null?
|
44
|
+
!@ptr or @ptr.null?
|
45
|
+
end
|
46
|
+
# Return internal pointer
|
47
|
+
# @return [::FFI::Pointer]
|
48
|
+
def __ptr
|
49
|
+
raise DestroyedError unless @ptr
|
50
|
+
@ptr
|
51
|
+
end
|
52
|
+
# So external Libraries can just pass the Object to a FFI function which expects a :pointer
|
53
|
+
alias_method :to_ptr, :__ptr
|
54
|
+
# Nullify internal pointer and return pointer pointer.
|
55
|
+
# @note This detaches the current instance from the native object
|
56
|
+
# and thus makes it unusable.
|
57
|
+
# @return [::FFI::MemoryPointer] the pointer pointing to a pointer
|
58
|
+
# pointing to the native object
|
59
|
+
def __ptr_give_ref
|
60
|
+
raise DestroyedError unless @ptr
|
61
|
+
ptr_ptr = ::FFI::MemoryPointer.new :pointer
|
62
|
+
ptr_ptr.write_pointer @ptr
|
63
|
+
__undef_finalizer if @finalizer
|
64
|
+
@ptr = nil
|
65
|
+
ptr_ptr
|
66
|
+
end
|
67
|
+
# Undefines the finalizer for this object.
|
68
|
+
# @note Only use this if you need to and can guarantee that the native
|
69
|
+
# object will be freed by other means.
|
70
|
+
# @return [void]
|
71
|
+
def __undef_finalizer
|
72
|
+
ObjectSpace.undefine_finalizer self
|
73
|
+
@finalizer = nil
|
74
|
+
end
|
75
|
+
|
76
|
+
# Create a new empty message object
|
77
|
+
# @return [CZMQ::Zmsg]
|
78
|
+
def self.new()
|
79
|
+
ptr = ::CZMQ::FFI.zmsg_new()
|
80
|
+
__new ptr
|
81
|
+
end
|
82
|
+
|
83
|
+
# Receive message from socket, returns zmsg_t object or NULL if the recv
|
84
|
+
# was interrupted. Does a blocking recv. If you want to not block then use
|
85
|
+
# the zloop class or zmsg_recv_nowait or zmq_poll to check for socket input
|
86
|
+
# before receiving.
|
87
|
+
# @param source [::FFI::Pointer, #to_ptr]
|
88
|
+
# @return [CZMQ::Zmsg]
|
89
|
+
def self.recv(source)
|
90
|
+
ptr = ::CZMQ::FFI.zmsg_recv(source)
|
91
|
+
__new ptr
|
92
|
+
end
|
93
|
+
|
94
|
+
# Load/append an open file into new message, return the message.
|
95
|
+
# Returns NULL if the message could not be loaded.
|
96
|
+
# @param file [::FFI::Pointer, #to_ptr]
|
97
|
+
# @return [CZMQ::Zmsg]
|
98
|
+
def self.load(file)
|
99
|
+
ptr = ::CZMQ::FFI.zmsg_load(file)
|
100
|
+
__new ptr
|
101
|
+
end
|
102
|
+
|
103
|
+
# Decodes a serialized message frame created by zmsg_encode () and returns
|
104
|
+
# a new zmsg_t object. Returns NULL if the frame was badly formatted or
|
105
|
+
# there was insufficient memory to work.
|
106
|
+
# @param frame [Zframe, #__ptr]
|
107
|
+
# @return [CZMQ::Zmsg]
|
108
|
+
def self.decode(frame)
|
109
|
+
frame = frame.__ptr if frame
|
110
|
+
ptr = ::CZMQ::FFI.zmsg_decode(frame)
|
111
|
+
__new ptr
|
112
|
+
end
|
113
|
+
|
114
|
+
# Generate a signal message encoding the given status. A signal is a short
|
115
|
+
# message carrying a 1-byte success/failure code (by convention, 0 means
|
116
|
+
# OK). Signals are encoded to be distinguishable from "normal" messages.
|
117
|
+
# @param status [Integer, #to_int, #to_i]
|
118
|
+
# @return [CZMQ::Zmsg]
|
119
|
+
def self.new_signal(status)
|
120
|
+
status = Integer(status)
|
121
|
+
ptr = ::CZMQ::FFI.zmsg_new_signal(status)
|
122
|
+
__new ptr
|
123
|
+
end
|
124
|
+
|
125
|
+
# Destroy a message object and all frames it contains
|
126
|
+
#
|
127
|
+
# @return [void]
|
128
|
+
def destroy()
|
129
|
+
return unless @ptr
|
130
|
+
self_p = __ptr_give_ref
|
131
|
+
result = ::CZMQ::FFI.zmsg_destroy(self_p)
|
132
|
+
result
|
133
|
+
end
|
134
|
+
|
135
|
+
# Send message to destination socket, and destroy the message after sending
|
136
|
+
# it successfully. If the message has no frames, sends nothing but destroys
|
137
|
+
# the message anyhow. Nullifies the caller's reference to the message (as
|
138
|
+
# it is a destructor).
|
139
|
+
#
|
140
|
+
# @param self_p [#__ptr_give_ref]
|
141
|
+
# @param dest [::FFI::Pointer, #to_ptr]
|
142
|
+
# @return [Integer]
|
143
|
+
def self.send(self_p, dest)
|
144
|
+
self_p = self_p.__ptr_give_ref
|
145
|
+
result = ::CZMQ::FFI.zmsg_send(self_p, dest)
|
146
|
+
result
|
147
|
+
end
|
148
|
+
|
149
|
+
# Send message to destination socket as part of a multipart sequence, and
|
150
|
+
# destroy the message after sending it successfully. Note that after a
|
151
|
+
# zmsg_sendm, you must call zmsg_send or another method that sends a final
|
152
|
+
# message part. If the message has no frames, sends nothing but destroys
|
153
|
+
# the message anyhow. Nullifies the caller's reference to the message (as
|
154
|
+
# it is a destructor).
|
155
|
+
#
|
156
|
+
# @param self_p [#__ptr_give_ref]
|
157
|
+
# @param dest [::FFI::Pointer, #to_ptr]
|
158
|
+
# @return [Integer]
|
159
|
+
def self.sendm(self_p, dest)
|
160
|
+
self_p = self_p.__ptr_give_ref
|
161
|
+
result = ::CZMQ::FFI.zmsg_sendm(self_p, dest)
|
162
|
+
result
|
163
|
+
end
|
164
|
+
|
165
|
+
# Return size of message, i.e. number of frames (0 or more).
|
166
|
+
#
|
167
|
+
# @return [Integer]
|
168
|
+
def size()
|
169
|
+
raise DestroyedError unless @ptr
|
170
|
+
self_p = @ptr
|
171
|
+
result = ::CZMQ::FFI.zmsg_size(self_p)
|
172
|
+
result
|
173
|
+
end
|
174
|
+
|
175
|
+
# Return total size of all frames in message.
|
176
|
+
#
|
177
|
+
# @return [Integer]
|
178
|
+
def content_size()
|
179
|
+
raise DestroyedError unless @ptr
|
180
|
+
self_p = @ptr
|
181
|
+
result = ::CZMQ::FFI.zmsg_content_size(self_p)
|
182
|
+
result
|
183
|
+
end
|
184
|
+
|
185
|
+
# Return message routing ID, if the message came from a ZMQ_SERVER socket.
|
186
|
+
# Else returns zero.
|
187
|
+
#
|
188
|
+
# @return [Integer]
|
189
|
+
def routing_id()
|
190
|
+
raise DestroyedError unless @ptr
|
191
|
+
self_p = @ptr
|
192
|
+
result = ::CZMQ::FFI.zmsg_routing_id(self_p)
|
193
|
+
result
|
194
|
+
end
|
195
|
+
|
196
|
+
# Set routing ID on message. This is used if/when the message is sent to a
|
197
|
+
# ZMQ_SERVER socket.
|
198
|
+
#
|
199
|
+
# @param routing_id [Integer, #to_int, #to_i]
|
200
|
+
# @return [void]
|
201
|
+
def set_routing_id(routing_id)
|
202
|
+
raise DestroyedError unless @ptr
|
203
|
+
self_p = @ptr
|
204
|
+
routing_id = Integer(routing_id)
|
205
|
+
result = ::CZMQ::FFI.zmsg_set_routing_id(self_p, routing_id)
|
206
|
+
result
|
207
|
+
end
|
208
|
+
|
209
|
+
# Push frame to the front of the message, i.e. before all other frames.
|
210
|
+
# Message takes ownership of frame, will destroy it when message is sent.
|
211
|
+
# Returns 0 on success, -1 on error. Deprecates zmsg_push, which did not
|
212
|
+
# nullify the caller's frame reference.
|
213
|
+
#
|
214
|
+
# @param frame_p [#__ptr_give_ref]
|
215
|
+
# @return [Integer]
|
216
|
+
def prepend(frame_p)
|
217
|
+
raise DestroyedError unless @ptr
|
218
|
+
self_p = @ptr
|
219
|
+
frame_p = frame_p.__ptr_give_ref
|
220
|
+
result = ::CZMQ::FFI.zmsg_prepend(self_p, frame_p)
|
221
|
+
result
|
222
|
+
end
|
223
|
+
|
224
|
+
# Add frame to the end of the message, i.e. after all other frames.
|
225
|
+
# Message takes ownership of frame, will destroy it when message is sent.
|
226
|
+
# Returns 0 on success. Deprecates zmsg_add, which did not nullify the
|
227
|
+
# caller's frame reference.
|
228
|
+
#
|
229
|
+
# @param frame_p [#__ptr_give_ref]
|
230
|
+
# @return [Integer]
|
231
|
+
def append(frame_p)
|
232
|
+
raise DestroyedError unless @ptr
|
233
|
+
self_p = @ptr
|
234
|
+
frame_p = frame_p.__ptr_give_ref
|
235
|
+
result = ::CZMQ::FFI.zmsg_append(self_p, frame_p)
|
236
|
+
result
|
237
|
+
end
|
238
|
+
|
239
|
+
# Remove first frame from message, if any. Returns frame, or NULL.
|
240
|
+
#
|
241
|
+
# @return [Zframe]
|
242
|
+
def pop()
|
243
|
+
raise DestroyedError unless @ptr
|
244
|
+
self_p = @ptr
|
245
|
+
result = ::CZMQ::FFI.zmsg_pop(self_p)
|
246
|
+
result = Zframe.__new result, true
|
247
|
+
result
|
248
|
+
end
|
249
|
+
|
250
|
+
# Push block of memory to front of message, as a new frame.
|
251
|
+
# Returns 0 on success, -1 on error.
|
252
|
+
#
|
253
|
+
# @param data [::FFI::Pointer, #to_ptr]
|
254
|
+
# @param size [Integer, #to_int, #to_i]
|
255
|
+
# @return [Integer]
|
256
|
+
def pushmem(data, size)
|
257
|
+
raise DestroyedError unless @ptr
|
258
|
+
self_p = @ptr
|
259
|
+
size = Integer(size)
|
260
|
+
result = ::CZMQ::FFI.zmsg_pushmem(self_p, data, size)
|
261
|
+
result
|
262
|
+
end
|
263
|
+
|
264
|
+
# Add block of memory to the end of the message, as a new frame.
|
265
|
+
# Returns 0 on success, -1 on error.
|
266
|
+
#
|
267
|
+
# @param data [::FFI::Pointer, #to_ptr]
|
268
|
+
# @param size [Integer, #to_int, #to_i]
|
269
|
+
# @return [Integer]
|
270
|
+
def addmem(data, size)
|
271
|
+
raise DestroyedError unless @ptr
|
272
|
+
self_p = @ptr
|
273
|
+
size = Integer(size)
|
274
|
+
result = ::CZMQ::FFI.zmsg_addmem(self_p, data, size)
|
275
|
+
result
|
276
|
+
end
|
277
|
+
|
278
|
+
# Push string as new frame to front of message.
|
279
|
+
# Returns 0 on success, -1 on error.
|
280
|
+
#
|
281
|
+
# @param string [String, #to_s, nil]
|
282
|
+
# @return [Integer]
|
283
|
+
def pushstr(string)
|
284
|
+
raise DestroyedError unless @ptr
|
285
|
+
self_p = @ptr
|
286
|
+
result = ::CZMQ::FFI.zmsg_pushstr(self_p, string)
|
287
|
+
result
|
288
|
+
end
|
289
|
+
|
290
|
+
# Push string as new frame to end of message.
|
291
|
+
# Returns 0 on success, -1 on error.
|
292
|
+
#
|
293
|
+
# @param string [String, #to_s, nil]
|
294
|
+
# @return [Integer]
|
295
|
+
def addstr(string)
|
296
|
+
raise DestroyedError unless @ptr
|
297
|
+
self_p = @ptr
|
298
|
+
result = ::CZMQ::FFI.zmsg_addstr(self_p, string)
|
299
|
+
result
|
300
|
+
end
|
301
|
+
|
302
|
+
# Push formatted string as new frame to front of message.
|
303
|
+
# Returns 0 on success, -1 on error.
|
304
|
+
#
|
305
|
+
# @param format [String, #to_s, nil]
|
306
|
+
# @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
|
307
|
+
# @return [Integer]
|
308
|
+
def pushstrf(format, *args)
|
309
|
+
raise DestroyedError unless @ptr
|
310
|
+
self_p = @ptr
|
311
|
+
result = ::CZMQ::FFI.zmsg_pushstrf(self_p, format, *args)
|
312
|
+
result
|
313
|
+
end
|
314
|
+
|
315
|
+
# Push formatted string as new frame to end of message.
|
316
|
+
# Returns 0 on success, -1 on error.
|
317
|
+
#
|
318
|
+
# @param format [String, #to_s, nil]
|
319
|
+
# @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
|
320
|
+
# @return [Integer]
|
321
|
+
def addstrf(format, *args)
|
322
|
+
raise DestroyedError unless @ptr
|
323
|
+
self_p = @ptr
|
324
|
+
result = ::CZMQ::FFI.zmsg_addstrf(self_p, format, *args)
|
325
|
+
result
|
326
|
+
end
|
327
|
+
|
328
|
+
# Pop frame off front of message, return as fresh string. If there were
|
329
|
+
# no more frames in the message, returns NULL.
|
330
|
+
#
|
331
|
+
# @return [::FFI::AutoPointer]
|
332
|
+
def popstr()
|
333
|
+
raise DestroyedError unless @ptr
|
334
|
+
self_p = @ptr
|
335
|
+
result = ::CZMQ::FFI.zmsg_popstr(self_p)
|
336
|
+
result = ::FFI::AutoPointer.new(result, LibC.method(:free))
|
337
|
+
result
|
338
|
+
end
|
339
|
+
|
340
|
+
# Push encoded message as a new frame. Message takes ownership of
|
341
|
+
# submessage, so the original is destroyed in this call. Returns 0 on
|
342
|
+
# success, -1 on error.
|
343
|
+
#
|
344
|
+
# @param msg_p [#__ptr_give_ref]
|
345
|
+
# @return [Integer]
|
346
|
+
def addmsg(msg_p)
|
347
|
+
raise DestroyedError unless @ptr
|
348
|
+
self_p = @ptr
|
349
|
+
msg_p = msg_p.__ptr_give_ref
|
350
|
+
result = ::CZMQ::FFI.zmsg_addmsg(self_p, msg_p)
|
351
|
+
result
|
352
|
+
end
|
353
|
+
|
354
|
+
# Remove first submessage from message, if any. Returns zmsg_t, or NULL if
|
355
|
+
# decoding was not successful.
|
356
|
+
#
|
357
|
+
# @return [Zmsg]
|
358
|
+
def popmsg()
|
359
|
+
raise DestroyedError unless @ptr
|
360
|
+
self_p = @ptr
|
361
|
+
result = ::CZMQ::FFI.zmsg_popmsg(self_p)
|
362
|
+
result = Zmsg.__new result, true
|
363
|
+
result
|
364
|
+
end
|
365
|
+
|
366
|
+
# Remove specified frame from list, if present. Does not destroy frame.
|
367
|
+
#
|
368
|
+
# @param frame [Zframe, #__ptr]
|
369
|
+
# @return [void]
|
370
|
+
def remove(frame)
|
371
|
+
raise DestroyedError unless @ptr
|
372
|
+
self_p = @ptr
|
373
|
+
frame = frame.__ptr if frame
|
374
|
+
result = ::CZMQ::FFI.zmsg_remove(self_p, frame)
|
375
|
+
result
|
376
|
+
end
|
377
|
+
|
378
|
+
# Set cursor to first frame in message. Returns frame, or NULL, if the
|
379
|
+
# message is empty. Use this to navigate the frames as a list.
|
380
|
+
#
|
381
|
+
# @return [Zframe]
|
382
|
+
def first()
|
383
|
+
raise DestroyedError unless @ptr
|
384
|
+
self_p = @ptr
|
385
|
+
result = ::CZMQ::FFI.zmsg_first(self_p)
|
386
|
+
result = Zframe.__new result, false
|
387
|
+
result
|
388
|
+
end
|
389
|
+
|
390
|
+
# Return the next frame. If there are no more frames, returns NULL. To move
|
391
|
+
# to the first frame call zmsg_first(). Advances the cursor.
|
392
|
+
#
|
393
|
+
# @return [Zframe]
|
394
|
+
def next()
|
395
|
+
raise DestroyedError unless @ptr
|
396
|
+
self_p = @ptr
|
397
|
+
result = ::CZMQ::FFI.zmsg_next(self_p)
|
398
|
+
result = Zframe.__new result, false
|
399
|
+
result
|
400
|
+
end
|
401
|
+
|
402
|
+
# Return the last frame. If there are no frames, returns NULL.
|
403
|
+
#
|
404
|
+
# @return [Zframe]
|
405
|
+
def last()
|
406
|
+
raise DestroyedError unless @ptr
|
407
|
+
self_p = @ptr
|
408
|
+
result = ::CZMQ::FFI.zmsg_last(self_p)
|
409
|
+
result = Zframe.__new result, false
|
410
|
+
result
|
411
|
+
end
|
412
|
+
|
413
|
+
# Save message to an open file, return 0 if OK, else -1. The message is
|
414
|
+
# saved as a series of frames, each with length and data. Note that the
|
415
|
+
# file is NOT guaranteed to be portable between operating systems, not
|
416
|
+
# versions of CZMQ. The file format is at present undocumented and liable
|
417
|
+
# to arbitrary change.
|
418
|
+
#
|
419
|
+
# @param file [::FFI::Pointer, #to_ptr]
|
420
|
+
# @return [Integer]
|
421
|
+
def save(file)
|
422
|
+
raise DestroyedError unless @ptr
|
423
|
+
self_p = @ptr
|
424
|
+
result = ::CZMQ::FFI.zmsg_save(self_p, file)
|
425
|
+
result
|
426
|
+
end
|
427
|
+
|
428
|
+
# Serialize multipart message to a single message frame. Use this method
|
429
|
+
# to send structured messages across transports that do not support
|
430
|
+
# multipart data. Allocates and returns a new frame containing the
|
431
|
+
# serialized message. To decode a serialized message frame, use
|
432
|
+
# zmsg_decode ().
|
433
|
+
#
|
434
|
+
# @return [Zframe]
|
435
|
+
def encode()
|
436
|
+
raise DestroyedError unless @ptr
|
437
|
+
self_p = @ptr
|
438
|
+
result = ::CZMQ::FFI.zmsg_encode(self_p)
|
439
|
+
result = Zframe.__new result, true
|
440
|
+
result
|
441
|
+
end
|
442
|
+
|
443
|
+
# Create copy of message, as new message object. Returns a fresh zmsg_t
|
444
|
+
# object. If message is null, or memory was exhausted, returns null.
|
445
|
+
#
|
446
|
+
# @return [Zmsg]
|
447
|
+
def dup()
|
448
|
+
raise DestroyedError unless @ptr
|
449
|
+
self_p = @ptr
|
450
|
+
result = ::CZMQ::FFI.zmsg_dup(self_p)
|
451
|
+
result = Zmsg.__new result, true
|
452
|
+
result
|
453
|
+
end
|
454
|
+
|
455
|
+
# Send message to zsys log sink (may be stdout, or system facility as
|
456
|
+
# configured by zsys_set_logstream).
|
457
|
+
#
|
458
|
+
# @return [void]
|
459
|
+
def print()
|
460
|
+
raise DestroyedError unless @ptr
|
461
|
+
self_p = @ptr
|
462
|
+
result = ::CZMQ::FFI.zmsg_print(self_p)
|
463
|
+
result
|
464
|
+
end
|
465
|
+
|
466
|
+
# Return true if the two messages have the same number of frames and each
|
467
|
+
# frame in the first message is identical to the corresponding frame in the
|
468
|
+
# other message. As with zframe_eq, return false if either message is NULL.
|
469
|
+
#
|
470
|
+
# @param other [Zmsg, #__ptr]
|
471
|
+
# @return [Boolean]
|
472
|
+
def eq(other)
|
473
|
+
raise DestroyedError unless @ptr
|
474
|
+
self_p = @ptr
|
475
|
+
other = other.__ptr if other
|
476
|
+
result = ::CZMQ::FFI.zmsg_eq(self_p, other)
|
477
|
+
result
|
478
|
+
end
|
479
|
+
|
480
|
+
# Return signal value, 0 or greater, if message is a signal, -1 if not.
|
481
|
+
#
|
482
|
+
# @return [Integer]
|
483
|
+
def signal()
|
484
|
+
raise DestroyedError unless @ptr
|
485
|
+
self_p = @ptr
|
486
|
+
result = ::CZMQ::FFI.zmsg_signal(self_p)
|
487
|
+
result
|
488
|
+
end
|
489
|
+
|
490
|
+
# Probe the supplied object, and report if it looks like a zmsg_t.
|
491
|
+
#
|
492
|
+
# @param self_ [::FFI::Pointer, #to_ptr]
|
493
|
+
# @return [Boolean]
|
494
|
+
def self.is(self_)
|
495
|
+
result = ::CZMQ::FFI.zmsg_is(self_)
|
496
|
+
result
|
497
|
+
end
|
498
|
+
|
499
|
+
# Self test of this class.
|
500
|
+
#
|
501
|
+
# @param verbose [Boolean]
|
502
|
+
# @return [void]
|
503
|
+
def self.test(verbose)
|
504
|
+
verbose = !(0==verbose||!verbose) # boolean
|
505
|
+
result = ::CZMQ::FFI.zmsg_test(verbose)
|
506
|
+
result
|
507
|
+
end
|
508
|
+
end
|
509
|
+
end
|
510
|
+
end
|
511
|
+
|
512
|
+
################################################################################
|
513
|
+
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
|
514
|
+
# Read the zproject/README.md for information about making permanent changes. #
|
515
|
+
################################################################################
|