czmq-ffi-gen 0.9.1-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/AUTHORS +1 -0
- data/CHANGES.md +88 -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_sjlj-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,388 @@
|
|
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
|
+
# work with memory chunks
|
10
|
+
# @note This class is 100% generated using zproject.
|
11
|
+
class Zchunk
|
12
|
+
# Raised when one tries to use an instance of {Zchunk} 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.zchunk_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 chunk of the specified size. If you specify the data, it
|
77
|
+
# is copied into the chunk. If you do not specify the data, the chunk is
|
78
|
+
# allocated and left empty, and you can then add data using zchunk_append.
|
79
|
+
# @param data [::FFI::Pointer, #to_ptr]
|
80
|
+
# @param size [Integer, #to_int, #to_i]
|
81
|
+
# @return [CZMQ::Zchunk]
|
82
|
+
def self.new(data, size)
|
83
|
+
size = Integer(size)
|
84
|
+
ptr = ::CZMQ::FFI.zchunk_new(data, size)
|
85
|
+
__new ptr
|
86
|
+
end
|
87
|
+
|
88
|
+
# Destroy a chunk
|
89
|
+
#
|
90
|
+
# @return [void]
|
91
|
+
def destroy()
|
92
|
+
return unless @ptr
|
93
|
+
self_p = __ptr_give_ref
|
94
|
+
result = ::CZMQ::FFI.zchunk_destroy(self_p)
|
95
|
+
result
|
96
|
+
end
|
97
|
+
|
98
|
+
# Resizes chunk max_size as requested; chunk_cur size is set to zero
|
99
|
+
#
|
100
|
+
# @param size [Integer, #to_int, #to_i]
|
101
|
+
# @return [void]
|
102
|
+
def resize(size)
|
103
|
+
raise DestroyedError unless @ptr
|
104
|
+
self_p = @ptr
|
105
|
+
size = Integer(size)
|
106
|
+
result = ::CZMQ::FFI.zchunk_resize(self_p, size)
|
107
|
+
result
|
108
|
+
end
|
109
|
+
|
110
|
+
# Return chunk cur size
|
111
|
+
#
|
112
|
+
# @return [Integer]
|
113
|
+
def size()
|
114
|
+
raise DestroyedError unless @ptr
|
115
|
+
self_p = @ptr
|
116
|
+
result = ::CZMQ::FFI.zchunk_size(self_p)
|
117
|
+
result
|
118
|
+
end
|
119
|
+
|
120
|
+
# Return chunk max size
|
121
|
+
#
|
122
|
+
# @return [Integer]
|
123
|
+
def max_size()
|
124
|
+
raise DestroyedError unless @ptr
|
125
|
+
self_p = @ptr
|
126
|
+
result = ::CZMQ::FFI.zchunk_max_size(self_p)
|
127
|
+
result
|
128
|
+
end
|
129
|
+
|
130
|
+
# Return chunk data
|
131
|
+
#
|
132
|
+
# @return [::FFI::Pointer]
|
133
|
+
def data()
|
134
|
+
raise DestroyedError unless @ptr
|
135
|
+
self_p = @ptr
|
136
|
+
result = ::CZMQ::FFI.zchunk_data(self_p)
|
137
|
+
result
|
138
|
+
end
|
139
|
+
|
140
|
+
# Set chunk data from user-supplied data; truncate if too large. Data may
|
141
|
+
# be null. Returns actual size of chunk
|
142
|
+
#
|
143
|
+
# @param data [::FFI::Pointer, #to_ptr]
|
144
|
+
# @param size [Integer, #to_int, #to_i]
|
145
|
+
# @return [Integer]
|
146
|
+
def set(data, size)
|
147
|
+
raise DestroyedError unless @ptr
|
148
|
+
self_p = @ptr
|
149
|
+
size = Integer(size)
|
150
|
+
result = ::CZMQ::FFI.zchunk_set(self_p, data, size)
|
151
|
+
result
|
152
|
+
end
|
153
|
+
|
154
|
+
# Fill chunk data from user-supplied octet
|
155
|
+
#
|
156
|
+
# @param filler [Integer, #to_int, #to_i]
|
157
|
+
# @param size [Integer, #to_int, #to_i]
|
158
|
+
# @return [Integer]
|
159
|
+
def fill(filler, size)
|
160
|
+
raise DestroyedError unless @ptr
|
161
|
+
self_p = @ptr
|
162
|
+
filler = Integer(filler)
|
163
|
+
size = Integer(size)
|
164
|
+
result = ::CZMQ::FFI.zchunk_fill(self_p, filler, size)
|
165
|
+
result
|
166
|
+
end
|
167
|
+
|
168
|
+
# Append user-supplied data to chunk, return resulting chunk size. If the
|
169
|
+
# data would exceeded the available space, it is truncated. If you want to
|
170
|
+
# grow the chunk to accommodate new data, use the zchunk_extend method.
|
171
|
+
#
|
172
|
+
# @param data [::FFI::Pointer, #to_ptr]
|
173
|
+
# @param size [Integer, #to_int, #to_i]
|
174
|
+
# @return [Integer]
|
175
|
+
def append(data, size)
|
176
|
+
raise DestroyedError unless @ptr
|
177
|
+
self_p = @ptr
|
178
|
+
size = Integer(size)
|
179
|
+
result = ::CZMQ::FFI.zchunk_append(self_p, data, size)
|
180
|
+
result
|
181
|
+
end
|
182
|
+
|
183
|
+
# Append user-supplied data to chunk, return resulting chunk size. If the
|
184
|
+
# data would exceeded the available space, the chunk grows in size.
|
185
|
+
#
|
186
|
+
# @param data [::FFI::Pointer, #to_ptr]
|
187
|
+
# @param size [Integer, #to_int, #to_i]
|
188
|
+
# @return [Integer]
|
189
|
+
def extend(data, size)
|
190
|
+
raise DestroyedError unless @ptr
|
191
|
+
self_p = @ptr
|
192
|
+
size = Integer(size)
|
193
|
+
result = ::CZMQ::FFI.zchunk_extend(self_p, data, size)
|
194
|
+
result
|
195
|
+
end
|
196
|
+
|
197
|
+
# Copy as much data from 'source' into the chunk as possible; returns the
|
198
|
+
# new size of chunk. If all data from 'source' is used, returns exhausted
|
199
|
+
# on the source chunk. Source can be consumed as many times as needed until
|
200
|
+
# it is exhausted. If source was already exhausted, does not change chunk.
|
201
|
+
#
|
202
|
+
# @param source [Zchunk, #__ptr]
|
203
|
+
# @return [Integer]
|
204
|
+
def consume(source)
|
205
|
+
raise DestroyedError unless @ptr
|
206
|
+
self_p = @ptr
|
207
|
+
source = source.__ptr if source
|
208
|
+
result = ::CZMQ::FFI.zchunk_consume(self_p, source)
|
209
|
+
result
|
210
|
+
end
|
211
|
+
|
212
|
+
# Returns true if the chunk was exhausted by consume methods, or if the
|
213
|
+
# chunk has a size of zero.
|
214
|
+
#
|
215
|
+
# @return [Boolean]
|
216
|
+
def exhausted()
|
217
|
+
raise DestroyedError unless @ptr
|
218
|
+
self_p = @ptr
|
219
|
+
result = ::CZMQ::FFI.zchunk_exhausted(self_p)
|
220
|
+
result
|
221
|
+
end
|
222
|
+
|
223
|
+
# Read chunk from an open file descriptor
|
224
|
+
#
|
225
|
+
# @param handle [::FFI::Pointer, #to_ptr]
|
226
|
+
# @param bytes [Integer, #to_int, #to_i]
|
227
|
+
# @return [Zchunk]
|
228
|
+
def self.read(handle, bytes)
|
229
|
+
bytes = Integer(bytes)
|
230
|
+
result = ::CZMQ::FFI.zchunk_read(handle, bytes)
|
231
|
+
result = Zchunk.__new result, true
|
232
|
+
result
|
233
|
+
end
|
234
|
+
|
235
|
+
# Write chunk to an open file descriptor
|
236
|
+
#
|
237
|
+
# @param handle [::FFI::Pointer, #to_ptr]
|
238
|
+
# @return [Integer]
|
239
|
+
def write(handle)
|
240
|
+
raise DestroyedError unless @ptr
|
241
|
+
self_p = @ptr
|
242
|
+
result = ::CZMQ::FFI.zchunk_write(self_p, handle)
|
243
|
+
result
|
244
|
+
end
|
245
|
+
|
246
|
+
# Try to slurp an entire file into a chunk. Will read up to maxsize of
|
247
|
+
# the file. If maxsize is 0, will attempt to read the entire file and
|
248
|
+
# fail with an assertion if that cannot fit into memory. Returns a new
|
249
|
+
# chunk containing the file data, or NULL if the file could not be read.
|
250
|
+
#
|
251
|
+
# @param filename [String, #to_s, nil]
|
252
|
+
# @param maxsize [Integer, #to_int, #to_i]
|
253
|
+
# @return [Zchunk]
|
254
|
+
def self.slurp(filename, maxsize)
|
255
|
+
maxsize = Integer(maxsize)
|
256
|
+
result = ::CZMQ::FFI.zchunk_slurp(filename, maxsize)
|
257
|
+
result = Zchunk.__new result, true
|
258
|
+
result
|
259
|
+
end
|
260
|
+
|
261
|
+
# Create copy of chunk, as new chunk object. Returns a fresh zchunk_t
|
262
|
+
# object, or null if there was not enough heap memory. If chunk is null,
|
263
|
+
# returns null.
|
264
|
+
#
|
265
|
+
# @return [Zchunk]
|
266
|
+
def dup()
|
267
|
+
raise DestroyedError unless @ptr
|
268
|
+
self_p = @ptr
|
269
|
+
result = ::CZMQ::FFI.zchunk_dup(self_p)
|
270
|
+
result = Zchunk.__new result, true
|
271
|
+
result
|
272
|
+
end
|
273
|
+
|
274
|
+
# Return chunk data encoded as printable hex string. Caller must free
|
275
|
+
# string when finished with it.
|
276
|
+
#
|
277
|
+
# @return [::FFI::AutoPointer]
|
278
|
+
def strhex()
|
279
|
+
raise DestroyedError unless @ptr
|
280
|
+
self_p = @ptr
|
281
|
+
result = ::CZMQ::FFI.zchunk_strhex(self_p)
|
282
|
+
result = ::FFI::AutoPointer.new(result, LibC.method(:free))
|
283
|
+
result
|
284
|
+
end
|
285
|
+
|
286
|
+
# Return chunk data copied into freshly allocated string
|
287
|
+
# Caller must free string when finished with it.
|
288
|
+
#
|
289
|
+
# @return [::FFI::AutoPointer]
|
290
|
+
def strdup()
|
291
|
+
raise DestroyedError unless @ptr
|
292
|
+
self_p = @ptr
|
293
|
+
result = ::CZMQ::FFI.zchunk_strdup(self_p)
|
294
|
+
result = ::FFI::AutoPointer.new(result, LibC.method(:free))
|
295
|
+
result
|
296
|
+
end
|
297
|
+
|
298
|
+
# Return TRUE if chunk body is equal to string, excluding terminator
|
299
|
+
#
|
300
|
+
# @param string [String, #to_s, nil]
|
301
|
+
# @return [Boolean]
|
302
|
+
def streq(string)
|
303
|
+
raise DestroyedError unless @ptr
|
304
|
+
self_p = @ptr
|
305
|
+
result = ::CZMQ::FFI.zchunk_streq(self_p, string)
|
306
|
+
result
|
307
|
+
end
|
308
|
+
|
309
|
+
# Transform zchunk into a zframe that can be sent in a message.
|
310
|
+
#
|
311
|
+
# @return [Zframe]
|
312
|
+
def pack()
|
313
|
+
raise DestroyedError unless @ptr
|
314
|
+
self_p = @ptr
|
315
|
+
result = ::CZMQ::FFI.zchunk_pack(self_p)
|
316
|
+
result = Zframe.__new result, true
|
317
|
+
result
|
318
|
+
end
|
319
|
+
|
320
|
+
# Transform a zframe into a zchunk.
|
321
|
+
#
|
322
|
+
# @param frame [Zframe, #__ptr]
|
323
|
+
# @return [Zchunk]
|
324
|
+
def self.unpack(frame)
|
325
|
+
frame = frame.__ptr if frame
|
326
|
+
result = ::CZMQ::FFI.zchunk_unpack(frame)
|
327
|
+
result = Zchunk.__new result, true
|
328
|
+
result
|
329
|
+
end
|
330
|
+
|
331
|
+
# Calculate SHA1 digest for chunk, using zdigest class.
|
332
|
+
#
|
333
|
+
# @return [String]
|
334
|
+
def digest()
|
335
|
+
raise DestroyedError unless @ptr
|
336
|
+
self_p = @ptr
|
337
|
+
result = ::CZMQ::FFI.zchunk_digest(self_p)
|
338
|
+
result
|
339
|
+
end
|
340
|
+
|
341
|
+
# Dump chunk to FILE stream, for debugging and tracing.
|
342
|
+
#
|
343
|
+
# @param file [::FFI::Pointer, #to_ptr]
|
344
|
+
# @return [void]
|
345
|
+
def fprint(file)
|
346
|
+
raise DestroyedError unless @ptr
|
347
|
+
self_p = @ptr
|
348
|
+
result = ::CZMQ::FFI.zchunk_fprint(self_p, file)
|
349
|
+
result
|
350
|
+
end
|
351
|
+
|
352
|
+
# Dump message to stderr, for debugging and tracing.
|
353
|
+
# See zchunk_fprint for details
|
354
|
+
#
|
355
|
+
# @return [void]
|
356
|
+
def print()
|
357
|
+
raise DestroyedError unless @ptr
|
358
|
+
self_p = @ptr
|
359
|
+
result = ::CZMQ::FFI.zchunk_print(self_p)
|
360
|
+
result
|
361
|
+
end
|
362
|
+
|
363
|
+
# Probe the supplied object, and report if it looks like a zchunk_t.
|
364
|
+
#
|
365
|
+
# @param self_ [::FFI::Pointer, #to_ptr]
|
366
|
+
# @return [Boolean]
|
367
|
+
def self.is(self_)
|
368
|
+
result = ::CZMQ::FFI.zchunk_is(self_)
|
369
|
+
result
|
370
|
+
end
|
371
|
+
|
372
|
+
# Self test of this class.
|
373
|
+
#
|
374
|
+
# @param verbose [Boolean]
|
375
|
+
# @return [void]
|
376
|
+
def self.test(verbose)
|
377
|
+
verbose = !(0==verbose||!verbose) # boolean
|
378
|
+
result = ::CZMQ::FFI.zchunk_test(verbose)
|
379
|
+
result
|
380
|
+
end
|
381
|
+
end
|
382
|
+
end
|
383
|
+
end
|
384
|
+
|
385
|
+
################################################################################
|
386
|
+
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
|
387
|
+
# Read the zproject/README.md for information about making permanent changes. #
|
388
|
+
################################################################################
|
@@ -0,0 +1,140 @@
|
|
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
|
+
# millisecond clocks and delays
|
10
|
+
# @note This class is 100% generated using zproject.
|
11
|
+
class Zclock
|
12
|
+
# Raised when one tries to use an instance of {Zclock} 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
|
+
# @return [Proc]
|
34
|
+
def self.create_finalizer_for(ptr)
|
35
|
+
Proc.new do
|
36
|
+
"WARNING: "\
|
37
|
+
"Objects of type #{self} cannot be destroyed implicitly. "\
|
38
|
+
"Please call the correct destroy method with the relevant arguments."
|
39
|
+
end
|
40
|
+
end
|
41
|
+
# @return [Boolean]
|
42
|
+
def null?
|
43
|
+
!@ptr or @ptr.null?
|
44
|
+
end
|
45
|
+
# Return internal pointer
|
46
|
+
# @return [::FFI::Pointer]
|
47
|
+
def __ptr
|
48
|
+
raise DestroyedError unless @ptr
|
49
|
+
@ptr
|
50
|
+
end
|
51
|
+
# So external Libraries can just pass the Object to a FFI function which expects a :pointer
|
52
|
+
alias_method :to_ptr, :__ptr
|
53
|
+
# Nullify internal pointer and return pointer pointer.
|
54
|
+
# @note This detaches the current instance from the native object
|
55
|
+
# and thus makes it unusable.
|
56
|
+
# @return [::FFI::MemoryPointer] the pointer pointing to a pointer
|
57
|
+
# pointing to the native object
|
58
|
+
def __ptr_give_ref
|
59
|
+
raise DestroyedError unless @ptr
|
60
|
+
ptr_ptr = ::FFI::MemoryPointer.new :pointer
|
61
|
+
ptr_ptr.write_pointer @ptr
|
62
|
+
__undef_finalizer if @finalizer
|
63
|
+
@ptr = nil
|
64
|
+
ptr_ptr
|
65
|
+
end
|
66
|
+
# Undefines the finalizer for this object.
|
67
|
+
# @note Only use this if you need to and can guarantee that the native
|
68
|
+
# object will be freed by other means.
|
69
|
+
# @return [void]
|
70
|
+
def __undef_finalizer
|
71
|
+
ObjectSpace.undefine_finalizer self
|
72
|
+
@finalizer = nil
|
73
|
+
end
|
74
|
+
|
75
|
+
# Sleep for a number of milliseconds
|
76
|
+
#
|
77
|
+
# @param msecs [Integer, #to_int, #to_i]
|
78
|
+
# @return [void]
|
79
|
+
def self.sleep(msecs)
|
80
|
+
msecs = Integer(msecs)
|
81
|
+
result = ::CZMQ::FFI.zclock_sleep(msecs)
|
82
|
+
result
|
83
|
+
end
|
84
|
+
|
85
|
+
# Return current system clock as milliseconds. Note that this clock can
|
86
|
+
# jump backwards (if the system clock is changed) so is unsafe to use for
|
87
|
+
# timers and time offsets. Use zclock_mono for that instead.
|
88
|
+
#
|
89
|
+
# @return [::FFI::Pointer]
|
90
|
+
def self.time()
|
91
|
+
result = ::CZMQ::FFI.zclock_time()
|
92
|
+
result
|
93
|
+
end
|
94
|
+
|
95
|
+
# Return current monotonic clock in milliseconds. Use this when you compute
|
96
|
+
# time offsets. The monotonic clock is not affected by system changes and
|
97
|
+
# so will never be reset backwards, unlike a system clock.
|
98
|
+
#
|
99
|
+
# @return [::FFI::Pointer]
|
100
|
+
def self.mono()
|
101
|
+
result = ::CZMQ::FFI.zclock_mono()
|
102
|
+
result
|
103
|
+
end
|
104
|
+
|
105
|
+
# Return current monotonic clock in microseconds. Use this when you compute
|
106
|
+
# time offsets. The monotonic clock is not affected by system changes and
|
107
|
+
# so will never be reset backwards, unlike a system clock.
|
108
|
+
#
|
109
|
+
# @return [::FFI::Pointer]
|
110
|
+
def self.usecs()
|
111
|
+
result = ::CZMQ::FFI.zclock_usecs()
|
112
|
+
result
|
113
|
+
end
|
114
|
+
|
115
|
+
# Return formatted date/time as fresh string. Free using zstr_free().
|
116
|
+
#
|
117
|
+
# @return [::FFI::AutoPointer]
|
118
|
+
def self.timestr()
|
119
|
+
result = ::CZMQ::FFI.zclock_timestr()
|
120
|
+
result = ::FFI::AutoPointer.new(result, LibC.method(:free))
|
121
|
+
result
|
122
|
+
end
|
123
|
+
|
124
|
+
# Self test of this class.
|
125
|
+
#
|
126
|
+
# @param verbose [Boolean]
|
127
|
+
# @return [void]
|
128
|
+
def self.test(verbose)
|
129
|
+
verbose = !(0==verbose||!verbose) # boolean
|
130
|
+
result = ::CZMQ::FFI.zclock_test(verbose)
|
131
|
+
result
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
################################################################################
|
138
|
+
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
|
139
|
+
# Read the zproject/README.md for information about making permanent changes. #
|
140
|
+
################################################################################
|