czmq-ffi-gen 0.9.1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +7 -0
  2. data/AUTHORS +1 -0
  3. data/CHANGES.md +88 -0
  4. data/Gemfile +2 -0
  5. data/LICENSE +14 -0
  6. data/README.md +112 -0
  7. data/lib/czmq-ffi-gen.rb +7 -0
  8. data/lib/czmq-ffi-gen/czmq/ffi.rb +1210 -0
  9. data/lib/czmq-ffi-gen/czmq/ffi/version.rb +15 -0
  10. data/lib/czmq-ffi-gen/czmq/ffi/zactor.rb +186 -0
  11. data/lib/czmq-ffi-gen/czmq/ffi/zarmour.rb +286 -0
  12. data/lib/czmq-ffi-gen/czmq/ffi/zcert.rb +307 -0
  13. data/lib/czmq-ffi-gen/czmq/ffi/zcertstore.rb +222 -0
  14. data/lib/czmq-ffi-gen/czmq/ffi/zchunk.rb +388 -0
  15. data/lib/czmq-ffi-gen/czmq/ffi/zclock.rb +140 -0
  16. data/lib/czmq-ffi-gen/czmq/ffi/zconfig.rb +442 -0
  17. data/lib/czmq-ffi-gen/czmq/ffi/zdigest.rb +156 -0
  18. data/lib/czmq-ffi-gen/czmq/ffi/zdir.rb +283 -0
  19. data/lib/czmq-ffi-gen/czmq/ffi/zdir_patch.rb +194 -0
  20. data/lib/czmq-ffi-gen/czmq/ffi/zfile.rb +353 -0
  21. data/lib/czmq-ffi-gen/czmq/ffi/zframe.rb +359 -0
  22. data/lib/czmq-ffi-gen/czmq/ffi/zhash.rb +416 -0
  23. data/lib/czmq-ffi-gen/czmq/ffi/zhashx.rb +659 -0
  24. data/lib/czmq-ffi-gen/czmq/ffi/ziflist.rb +189 -0
  25. data/lib/czmq-ffi-gen/czmq/ffi/zlist.rb +365 -0
  26. data/lib/czmq-ffi-gen/czmq/ffi/zlistx.rb +478 -0
  27. data/lib/czmq-ffi-gen/czmq/ffi/zloop.rb +396 -0
  28. data/lib/czmq-ffi-gen/czmq/ffi/zmsg.rb +515 -0
  29. data/lib/czmq-ffi-gen/czmq/ffi/zpoller.rb +194 -0
  30. data/lib/czmq-ffi-gen/czmq/ffi/zproc.rb +294 -0
  31. data/lib/czmq-ffi-gen/czmq/ffi/zsock.rb +3479 -0
  32. data/lib/czmq-ffi-gen/czmq/ffi/zstr.rb +203 -0
  33. data/lib/czmq-ffi-gen/czmq/ffi/ztimerset.rb +203 -0
  34. data/lib/czmq-ffi-gen/czmq/ffi/ztrie.rb +221 -0
  35. data/lib/czmq-ffi-gen/czmq/ffi/zuuid.rb +227 -0
  36. data/lib/czmq-ffi-gen/errors.rb +12 -0
  37. data/lib/czmq-ffi-gen/gem_version.rb +5 -0
  38. data/lib/czmq-ffi-gen/legacy.rb +16 -0
  39. data/lib/czmq-ffi-gen/libzmq.rb +18 -0
  40. data/lib/czmq-ffi-gen/signals.rb +27 -0
  41. data/lib/czmq-ffi-gen/vendor.rb +5 -0
  42. data/lib/czmq-ffi-gen/versions.rb +19 -0
  43. data/vendor/local/bin/inproc_lat.exe +0 -0
  44. data/vendor/local/bin/inproc_thr.exe +0 -0
  45. data/vendor/local/bin/libczmq.dll +0 -0
  46. data/vendor/local/bin/libgcc_s_sjlj-1.dll +0 -0
  47. data/vendor/local/bin/libstdc++-6.dll +0 -0
  48. data/vendor/local/bin/libzmq.dll +0 -0
  49. data/vendor/local/bin/local_lat.exe +0 -0
  50. data/vendor/local/bin/local_thr.exe +0 -0
  51. data/vendor/local/bin/remote_lat.exe +0 -0
  52. data/vendor/local/bin/remote_thr.exe +0 -0
  53. data/vendor/local/include/czmq.h +31 -0
  54. data/vendor/local/include/czmq_library.h +199 -0
  55. data/vendor/local/include/czmq_prelude.h +641 -0
  56. data/vendor/local/include/readme.txt +83 -0
  57. data/vendor/local/include/sha1.h +76 -0
  58. data/vendor/local/include/sha1.inc_c +335 -0
  59. data/vendor/local/include/slre.h +92 -0
  60. data/vendor/local/include/slre.inc_c +660 -0
  61. data/vendor/local/include/zactor.h +76 -0
  62. data/vendor/local/include/zarmour.h +114 -0
  63. data/vendor/local/include/zauth.h +100 -0
  64. data/vendor/local/include/zauth_v2.h +88 -0
  65. data/vendor/local/include/zbeacon.h +86 -0
  66. data/vendor/local/include/zbeacon_v2.h +75 -0
  67. data/vendor/local/include/zcert.h +136 -0
  68. data/vendor/local/include/zcertstore.h +100 -0
  69. data/vendor/local/include/zchunk.h +163 -0
  70. data/vendor/local/include/zclock.h +73 -0
  71. data/vendor/local/include/zconfig.h +185 -0
  72. data/vendor/local/include/zctx.h +107 -0
  73. data/vendor/local/include/zdigest.h +65 -0
  74. data/vendor/local/include/zdir.h +149 -0
  75. data/vendor/local/include/zdir_patch.h +82 -0
  76. data/vendor/local/include/zfile.h +177 -0
  77. data/vendor/local/include/zframe.h +176 -0
  78. data/vendor/local/include/zgossip.h +95 -0
  79. data/vendor/local/include/zgossip_engine.inc +927 -0
  80. data/vendor/local/include/zgossip_msg.h +129 -0
  81. data/vendor/local/include/zhash.h +195 -0
  82. data/vendor/local/include/zhash_primes.inc +329 -0
  83. data/vendor/local/include/zhashx.h +298 -0
  84. data/vendor/local/include/ziflist.h +77 -0
  85. data/vendor/local/include/zlist.h +158 -0
  86. data/vendor/local/include/zlistx.h +205 -0
  87. data/vendor/local/include/zloop.h +168 -0
  88. data/vendor/local/include/zmonitor.h +73 -0
  89. data/vendor/local/include/zmonitor_v2.h +56 -0
  90. data/vendor/local/include/zmq.h +617 -0
  91. data/vendor/local/include/zmq_utils.h +48 -0
  92. data/vendor/local/include/zmsg.h +280 -0
  93. data/vendor/local/include/zmutex.h +55 -0
  94. data/vendor/local/include/zpoller.h +92 -0
  95. data/vendor/local/include/zproc.h +168 -0
  96. data/vendor/local/include/zproxy.h +111 -0
  97. data/vendor/local/include/zproxy_v2.h +62 -0
  98. data/vendor/local/include/zrex.h +82 -0
  99. data/vendor/local/include/zsock.h +912 -0
  100. data/vendor/local/include/zsock_option.inc +4126 -0
  101. data/vendor/local/include/zsocket.h +110 -0
  102. data/vendor/local/include/zsockopt.h +256 -0
  103. data/vendor/local/include/zstr.h +110 -0
  104. data/vendor/local/include/zsys.h +386 -0
  105. data/vendor/local/include/zthread.h +50 -0
  106. data/vendor/local/include/ztimerset.h +90 -0
  107. data/vendor/local/include/ztrie.h +106 -0
  108. data/vendor/local/include/zuuid.h +96 -0
  109. data/vendor/local/lib/libczmq.dll.a +0 -0
  110. data/vendor/local/lib/liblibzmq.dll.a +0 -0
  111. data/vendor/local/lib/libzmq-static.a +0 -0
  112. data/vendor/local/lib/pkgconfig/libczmq.pc +23 -0
  113. data/vendor/local/lib/pkgconfig/libzmq.pc +11 -0
  114. data/vendor/local/share/zmq/AUTHORS.txt +147 -0
  115. data/vendor/local/share/zmq/COPYING.LESSER.txt +181 -0
  116. data/vendor/local/share/zmq/COPYING.txt +674 -0
  117. data/vendor/local/share/zmq/NEWS.txt +978 -0
  118. metadata +230 -0
@@ -0,0 +1,416 @@
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
+ # generic type-free hash container (simple)
10
+ # @note This class is 100% generated using zproject.
11
+ class Zhash
12
+ # Raised when one tries to use an instance of {Zhash} 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.zhash_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 zhash_freefn method
78
+ # typedef void (zhash_free_fn) (
79
+ # void *data);
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.free_fn
86
+ ::FFI::Function.new :void, [:pointer], blocking: true do |data|
87
+ result = yield data
88
+ result
89
+ end
90
+ end
91
+
92
+ # Create a new callback of the following type:
93
+ # Callback function for zhash_foreach method. Deprecated.
94
+ # typedef int (zhash_foreach_fn) (
95
+ # const char *key, void *item, void *argument);
96
+ #
97
+ # @note WARNING: If your Ruby code doesn't retain a reference to the
98
+ # FFI::Function object after passing it to a C function call,
99
+ # it may be garbage collected while C still holds the pointer,
100
+ # potentially resulting in a segmentation fault.
101
+ def self.foreach_fn
102
+ ::FFI::Function.new :int, [:string, :pointer, :pointer], blocking: true do |key, item, argument|
103
+ result = yield key, item, argument
104
+ result = Integer(result)
105
+ result
106
+ end
107
+ end
108
+
109
+ # Create a new, empty hash container
110
+ # @return [CZMQ::Zhash]
111
+ def self.new()
112
+ ptr = ::CZMQ::FFI.zhash_new()
113
+ __new ptr
114
+ end
115
+
116
+ # Unpack binary frame into a new hash table. Packed data must follow format
117
+ # defined by zhash_pack. Hash table is set to autofree. An empty frame
118
+ # unpacks to an empty hash table.
119
+ # @param frame [Zframe, #__ptr]
120
+ # @return [CZMQ::Zhash]
121
+ def self.unpack(frame)
122
+ frame = frame.__ptr if frame
123
+ ptr = ::CZMQ::FFI.zhash_unpack(frame)
124
+ __new ptr
125
+ end
126
+
127
+ # Destroy a hash container and all items in it
128
+ #
129
+ # @return [void]
130
+ def destroy()
131
+ return unless @ptr
132
+ self_p = __ptr_give_ref
133
+ result = ::CZMQ::FFI.zhash_destroy(self_p)
134
+ result
135
+ end
136
+
137
+ # Insert item into hash table with specified key and item.
138
+ # If key is already present returns -1 and leaves existing item unchanged
139
+ # Returns 0 on success.
140
+ #
141
+ # @param key [String, #to_s, nil]
142
+ # @param item [::FFI::Pointer, #to_ptr]
143
+ # @return [Integer]
144
+ def insert(key, item)
145
+ raise DestroyedError unless @ptr
146
+ self_p = @ptr
147
+ result = ::CZMQ::FFI.zhash_insert(self_p, key, item)
148
+ result
149
+ end
150
+
151
+ # Update item into hash table with specified key and item.
152
+ # If key is already present, destroys old item and inserts new one.
153
+ # Use free_fn method to ensure deallocator is properly called on item.
154
+ #
155
+ # @param key [String, #to_s, nil]
156
+ # @param item [::FFI::Pointer, #to_ptr]
157
+ # @return [void]
158
+ def update(key, item)
159
+ raise DestroyedError unless @ptr
160
+ self_p = @ptr
161
+ result = ::CZMQ::FFI.zhash_update(self_p, key, item)
162
+ result
163
+ end
164
+
165
+ # Remove an item specified by key from the hash table. If there was no such
166
+ # item, this function does nothing.
167
+ #
168
+ # @param key [String, #to_s, nil]
169
+ # @return [void]
170
+ def delete(key)
171
+ raise DestroyedError unless @ptr
172
+ self_p = @ptr
173
+ result = ::CZMQ::FFI.zhash_delete(self_p, key)
174
+ result
175
+ end
176
+
177
+ # Return the item at the specified key, or null
178
+ #
179
+ # @param key [String, #to_s, nil]
180
+ # @return [::FFI::Pointer]
181
+ def lookup(key)
182
+ raise DestroyedError unless @ptr
183
+ self_p = @ptr
184
+ result = ::CZMQ::FFI.zhash_lookup(self_p, key)
185
+ result
186
+ end
187
+
188
+ # Reindexes an item from an old key to a new key. If there was no such
189
+ # item, does nothing. Returns 0 if successful, else -1.
190
+ #
191
+ # @param old_key [String, #to_s, nil]
192
+ # @param new_key [String, #to_s, nil]
193
+ # @return [Integer]
194
+ def rename(old_key, new_key)
195
+ raise DestroyedError unless @ptr
196
+ self_p = @ptr
197
+ result = ::CZMQ::FFI.zhash_rename(self_p, old_key, new_key)
198
+ result
199
+ end
200
+
201
+ # Set a free function for the specified hash table item. When the item is
202
+ # destroyed, the free function, if any, is called on that item.
203
+ # Use this when hash items are dynamically allocated, to ensure that
204
+ # you don't have memory leaks. You can pass 'free' or NULL as a free_fn.
205
+ # Returns the item, or NULL if there is no such item.
206
+ #
207
+ # @param key [String, #to_s, nil]
208
+ # @param free_fn [::FFI::Pointer, #to_ptr]
209
+ # @return [::FFI::Pointer]
210
+ def freefn(key, free_fn)
211
+ raise DestroyedError unless @ptr
212
+ self_p = @ptr
213
+ result = ::CZMQ::FFI.zhash_freefn(self_p, key, free_fn)
214
+ result
215
+ end
216
+
217
+ # Return the number of keys/items in the hash table
218
+ #
219
+ # @return [Integer]
220
+ def size()
221
+ raise DestroyedError unless @ptr
222
+ self_p = @ptr
223
+ result = ::CZMQ::FFI.zhash_size(self_p)
224
+ result
225
+ end
226
+
227
+ # Make copy of hash table; if supplied table is null, returns null.
228
+ # Does not copy items themselves. Rebuilds new table so may be slow on
229
+ # very large tables. NOTE: only works with item values that are strings
230
+ # since there's no other way to know how to duplicate the item value.
231
+ #
232
+ # @return [Zhash]
233
+ def dup()
234
+ raise DestroyedError unless @ptr
235
+ self_p = @ptr
236
+ result = ::CZMQ::FFI.zhash_dup(self_p)
237
+ result = Zhash.__new result, true
238
+ result
239
+ end
240
+
241
+ # Return keys for items in table
242
+ #
243
+ # @return [Zlist]
244
+ def keys()
245
+ raise DestroyedError unless @ptr
246
+ self_p = @ptr
247
+ result = ::CZMQ::FFI.zhash_keys(self_p)
248
+ result = Zlist.__new result, true
249
+ result
250
+ end
251
+
252
+ # Simple iterator; returns first item in hash table, in no given order,
253
+ # or NULL if the table is empty. This method is simpler to use than the
254
+ # foreach() method, which is deprecated. To access the key for this item
255
+ # use zhash_cursor(). NOTE: do NOT modify the table while iterating.
256
+ #
257
+ # @return [::FFI::Pointer]
258
+ def first()
259
+ raise DestroyedError unless @ptr
260
+ self_p = @ptr
261
+ result = ::CZMQ::FFI.zhash_first(self_p)
262
+ result
263
+ end
264
+
265
+ # Simple iterator; returns next item in hash table, in no given order,
266
+ # or NULL if the last item was already returned. Use this together with
267
+ # zhash_first() to process all items in a hash table. If you need the
268
+ # items in sorted order, use zhash_keys() and then zlist_sort(). To
269
+ # access the key for this item use zhash_cursor(). NOTE: do NOT modify
270
+ # the table while iterating.
271
+ #
272
+ # @return [::FFI::Pointer]
273
+ def next()
274
+ raise DestroyedError unless @ptr
275
+ self_p = @ptr
276
+ result = ::CZMQ::FFI.zhash_next(self_p)
277
+ result
278
+ end
279
+
280
+ # After a successful first/next method, returns the key for the item that
281
+ # was returned. This is a constant string that you may not modify or
282
+ # deallocate, and which lasts as long as the item in the hash. After an
283
+ # unsuccessful first/next, returns NULL.
284
+ #
285
+ # @return [String]
286
+ def cursor()
287
+ raise DestroyedError unless @ptr
288
+ self_p = @ptr
289
+ result = ::CZMQ::FFI.zhash_cursor(self_p)
290
+ result
291
+ end
292
+
293
+ # Add a comment to hash table before saving to disk. You can add as many
294
+ # comment lines as you like. These comment lines are discarded when loading
295
+ # the file. If you use a null format, all comments are deleted.
296
+ #
297
+ # @param format [String, #to_s, nil]
298
+ # @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
299
+ # @return [void]
300
+ def comment(format, *args)
301
+ raise DestroyedError unless @ptr
302
+ self_p = @ptr
303
+ result = ::CZMQ::FFI.zhash_comment(self_p, format, *args)
304
+ result
305
+ end
306
+
307
+ # Serialize hash table to a binary frame that can be sent in a message.
308
+ # The packed format is compatible with the 'dictionary' type defined in
309
+ # http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto:
310
+ #
311
+ # ; A list of name/value pairs
312
+ # dictionary = dict-count *( dict-name dict-value )
313
+ # dict-count = number-4
314
+ # dict-value = longstr
315
+ # dict-name = string
316
+ #
317
+ # ; Strings are always length + text contents
318
+ # longstr = number-4 *VCHAR
319
+ # string = number-1 *VCHAR
320
+ #
321
+ # ; Numbers are unsigned integers in network byte order
322
+ # number-1 = 1OCTET
323
+ # number-4 = 4OCTET
324
+ #
325
+ # Comments are not included in the packed data. Item values MUST be
326
+ # strings.
327
+ #
328
+ # @return [Zframe]
329
+ def pack()
330
+ raise DestroyedError unless @ptr
331
+ self_p = @ptr
332
+ result = ::CZMQ::FFI.zhash_pack(self_p)
333
+ result = Zframe.__new result, true
334
+ result
335
+ end
336
+
337
+ # Save hash table to a text file in name=value format. Hash values must be
338
+ # printable strings; keys may not contain '=' character. Returns 0 if OK,
339
+ # else -1 if a file error occurred.
340
+ #
341
+ # @param filename [String, #to_s, nil]
342
+ # @return [Integer]
343
+ def save(filename)
344
+ raise DestroyedError unless @ptr
345
+ self_p = @ptr
346
+ result = ::CZMQ::FFI.zhash_save(self_p, filename)
347
+ result
348
+ end
349
+
350
+ # Load hash table from a text file in name=value format; hash table must
351
+ # already exist. Hash values must printable strings; keys may not contain
352
+ # '=' character. Returns 0 if OK, else -1 if a file was not readable.
353
+ #
354
+ # @param filename [String, #to_s, nil]
355
+ # @return [Integer]
356
+ def load(filename)
357
+ raise DestroyedError unless @ptr
358
+ self_p = @ptr
359
+ result = ::CZMQ::FFI.zhash_load(self_p, filename)
360
+ result
361
+ end
362
+
363
+ # When a hash table was loaded from a file by zhash_load, this method will
364
+ # reload the file if it has been modified since, and is "stable", i.e. not
365
+ # still changing. Returns 0 if OK, -1 if there was an error reloading the
366
+ # file.
367
+ #
368
+ # @return [Integer]
369
+ def refresh()
370
+ raise DestroyedError unless @ptr
371
+ self_p = @ptr
372
+ result = ::CZMQ::FFI.zhash_refresh(self_p)
373
+ result
374
+ end
375
+
376
+ # Set hash for automatic value destruction
377
+ #
378
+ # @return [void]
379
+ def autofree()
380
+ raise DestroyedError unless @ptr
381
+ self_p = @ptr
382
+ result = ::CZMQ::FFI.zhash_autofree(self_p)
383
+ result
384
+ end
385
+
386
+ # Apply function to each item in the hash table. Items are iterated in no
387
+ # defined order. Stops if callback function returns non-zero and returns
388
+ # final return code from callback function (zero = success). Deprecated.
389
+ #
390
+ # @param callback [::FFI::Pointer, #to_ptr]
391
+ # @param argument [::FFI::Pointer, #to_ptr]
392
+ # @return [Integer]
393
+ def foreach(callback, argument)
394
+ raise DestroyedError unless @ptr
395
+ self_p = @ptr
396
+ result = ::CZMQ::FFI.zhash_foreach(self_p, callback, argument)
397
+ result
398
+ end
399
+
400
+ # Self test of this class.
401
+ #
402
+ # @param verbose [Boolean]
403
+ # @return [void]
404
+ def self.test(verbose)
405
+ verbose = !(0==verbose||!verbose) # boolean
406
+ result = ::CZMQ::FFI.zhash_test(verbose)
407
+ result
408
+ end
409
+ end
410
+ end
411
+ end
412
+
413
+ ################################################################################
414
+ # THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
415
+ # Read the zproject/README.md for information about making permanent changes. #
416
+ ################################################################################
@@ -0,0 +1,659 @@
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
+ # extended generic type-free hash container
10
+ # @note This class is 100% generated using zproject.
11
+ class Zhashx
12
+ # Raised when one tries to use an instance of {Zhashx} 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.zhashx_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
+ # Destroy an item
78
+ # typedef void (zhashx_destructor_fn) (
79
+ # void **item);
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.destructor_fn
86
+ ::FFI::Function.new :void, [:pointer], blocking: true do |item|
87
+ result = yield item
88
+ result
89
+ end
90
+ end
91
+
92
+ # Create a new callback of the following type:
93
+ # Duplicate an item
94
+ # typedef void * (zhashx_duplicator_fn) (
95
+ # const void *item);
96
+ #
97
+ # @note WARNING: If your Ruby code doesn't retain a reference to the
98
+ # FFI::Function object after passing it to a C function call,
99
+ # it may be garbage collected while C still holds the pointer,
100
+ # potentially resulting in a segmentation fault.
101
+ def self.duplicator_fn
102
+ ::FFI::Function.new :pointer, [:pointer], blocking: true do |item|
103
+ result = yield item
104
+ result
105
+ end
106
+ end
107
+
108
+ # Create a new callback of the following type:
109
+ # Compare two items, for sorting
110
+ # typedef int (zhashx_comparator_fn) (
111
+ # const void *item1, const void *item2);
112
+ #
113
+ # @note WARNING: If your Ruby code doesn't retain a reference to the
114
+ # FFI::Function object after passing it to a C function call,
115
+ # it may be garbage collected while C still holds the pointer,
116
+ # potentially resulting in a segmentation fault.
117
+ def self.comparator_fn
118
+ ::FFI::Function.new :int, [:pointer, :pointer], blocking: true do |item1, item2|
119
+ result = yield item1, item2
120
+ result = Integer(result)
121
+ result
122
+ end
123
+ end
124
+
125
+ # Create a new callback of the following type:
126
+ # compare two items, for sorting
127
+ # typedef void (zhashx_free_fn) (
128
+ # void *data);
129
+ #
130
+ # @note WARNING: If your Ruby code doesn't retain a reference to the
131
+ # FFI::Function object after passing it to a C function call,
132
+ # it may be garbage collected while C still holds the pointer,
133
+ # potentially resulting in a segmentation fault.
134
+ def self.free_fn
135
+ ::FFI::Function.new :void, [:pointer], blocking: true do |data|
136
+ result = yield data
137
+ result
138
+ end
139
+ end
140
+
141
+ # Create a new callback of the following type:
142
+ # compare two items, for sorting
143
+ # typedef size_t (zhashx_hash_fn) (
144
+ # const void *key);
145
+ #
146
+ # @note WARNING: If your Ruby code doesn't retain a reference to the
147
+ # FFI::Function object after passing it to a C function call,
148
+ # it may be garbage collected while C still holds the pointer,
149
+ # potentially resulting in a segmentation fault.
150
+ def self.hash_fn
151
+ ::FFI::Function.new :size_t, [:pointer], blocking: true do |key|
152
+ result = yield key
153
+ result = Integer(result)
154
+ result
155
+ end
156
+ end
157
+
158
+ # Create a new callback of the following type:
159
+ # Serializes an item to a longstr.
160
+ # The caller takes ownership of the newly created object.
161
+ # typedef char * (zhashx_serializer_fn) (
162
+ # const void *item);
163
+ #
164
+ # @note WARNING: If your Ruby code doesn't retain a reference to the
165
+ # FFI::Function object after passing it to a C function call,
166
+ # it may be garbage collected while C still holds the pointer,
167
+ # potentially resulting in a segmentation fault.
168
+ def self.serializer_fn
169
+ ::FFI::Function.new :pointer, [:pointer], blocking: true do |item|
170
+ result = yield item
171
+ result
172
+ end
173
+ end
174
+
175
+ # Create a new callback of the following type:
176
+ # Deserializes a longstr into an item.
177
+ # The caller takes ownership of the newly created object.
178
+ # typedef void * (zhashx_deserializer_fn) (
179
+ # const char *item_str);
180
+ #
181
+ # @note WARNING: If your Ruby code doesn't retain a reference to the
182
+ # FFI::Function object after passing it to a C function call,
183
+ # it may be garbage collected while C still holds the pointer,
184
+ # potentially resulting in a segmentation fault.
185
+ def self.deserializer_fn
186
+ ::FFI::Function.new :pointer, [:string], blocking: true do |item_str|
187
+ result = yield item_str
188
+ result
189
+ end
190
+ end
191
+
192
+ # Create a new callback of the following type:
193
+ # Callback function for zhashx_foreach method.
194
+ # This callback is deprecated and you should use zhashx_first/_next instead.
195
+ # typedef int (zhashx_foreach_fn) (
196
+ # const char *key, void *item, void *argument);
197
+ #
198
+ # @note WARNING: If your Ruby code doesn't retain a reference to the
199
+ # FFI::Function object after passing it to a C function call,
200
+ # it may be garbage collected while C still holds the pointer,
201
+ # potentially resulting in a segmentation fault.
202
+ def self.foreach_fn
203
+ ::FFI::Function.new :int, [:string, :pointer, :pointer], blocking: true do |key, item, argument|
204
+ result = yield key, item, argument
205
+ result = Integer(result)
206
+ result
207
+ end
208
+ end
209
+
210
+ # Create a new, empty hash container
211
+ # @return [CZMQ::Zhashx]
212
+ def self.new()
213
+ ptr = ::CZMQ::FFI.zhashx_new()
214
+ __new ptr
215
+ end
216
+
217
+ # Unpack binary frame into a new hash table. Packed data must follow format
218
+ # defined by zhashx_pack. Hash table is set to autofree. An empty frame
219
+ # unpacks to an empty hash table.
220
+ # @param frame [Zframe, #__ptr]
221
+ # @return [CZMQ::Zhashx]
222
+ def self.unpack(frame)
223
+ frame = frame.__ptr if frame
224
+ ptr = ::CZMQ::FFI.zhashx_unpack(frame)
225
+ __new ptr
226
+ end
227
+
228
+ # Same as unpack but uses a user-defined deserializer function to convert
229
+ # a longstr back into item format.
230
+ # @param frame [Zframe, #__ptr]
231
+ # @param deserializer [::FFI::Pointer, #to_ptr]
232
+ # @return [CZMQ::Zhashx]
233
+ def self.unpack_own(frame, deserializer)
234
+ frame = frame.__ptr if frame
235
+ ptr = ::CZMQ::FFI.zhashx_unpack_own(frame, deserializer)
236
+ __new ptr
237
+ end
238
+
239
+ # Destroy a hash container and all items in it
240
+ #
241
+ # @return [void]
242
+ def destroy()
243
+ return unless @ptr
244
+ self_p = __ptr_give_ref
245
+ result = ::CZMQ::FFI.zhashx_destroy(self_p)
246
+ result
247
+ end
248
+
249
+ # Insert item into hash table with specified key and item.
250
+ # If key is already present returns -1 and leaves existing item unchanged
251
+ # Returns 0 on success.
252
+ #
253
+ # @param key [::FFI::Pointer, #to_ptr]
254
+ # @param item [::FFI::Pointer, #to_ptr]
255
+ # @return [Integer]
256
+ def insert(key, item)
257
+ raise DestroyedError unless @ptr
258
+ self_p = @ptr
259
+ result = ::CZMQ::FFI.zhashx_insert(self_p, key, item)
260
+ result
261
+ end
262
+
263
+ # Update or insert item into hash table with specified key and item. If the
264
+ # key is already present, destroys old item and inserts new one. If you set
265
+ # a container item destructor, this is called on the old value. If the key
266
+ # was not already present, inserts a new item. Sets the hash cursor to the
267
+ # new item.
268
+ #
269
+ # @param key [::FFI::Pointer, #to_ptr]
270
+ # @param item [::FFI::Pointer, #to_ptr]
271
+ # @return [void]
272
+ def update(key, item)
273
+ raise DestroyedError unless @ptr
274
+ self_p = @ptr
275
+ result = ::CZMQ::FFI.zhashx_update(self_p, key, item)
276
+ result
277
+ end
278
+
279
+ # Remove an item specified by key from the hash table. If there was no such
280
+ # item, this function does nothing.
281
+ #
282
+ # @param key [::FFI::Pointer, #to_ptr]
283
+ # @return [void]
284
+ def delete(key)
285
+ raise DestroyedError unless @ptr
286
+ self_p = @ptr
287
+ result = ::CZMQ::FFI.zhashx_delete(self_p, key)
288
+ result
289
+ end
290
+
291
+ # Delete all items from the hash table. If the key destructor is
292
+ # set, calls it on every key. If the item destructor is set, calls
293
+ # it on every item.
294
+ #
295
+ # @return [void]
296
+ def purge()
297
+ raise DestroyedError unless @ptr
298
+ self_p = @ptr
299
+ result = ::CZMQ::FFI.zhashx_purge(self_p)
300
+ result
301
+ end
302
+
303
+ # Return the item at the specified key, or null
304
+ #
305
+ # @param key [::FFI::Pointer, #to_ptr]
306
+ # @return [::FFI::Pointer]
307
+ def lookup(key)
308
+ raise DestroyedError unless @ptr
309
+ self_p = @ptr
310
+ result = ::CZMQ::FFI.zhashx_lookup(self_p, key)
311
+ result
312
+ end
313
+
314
+ # Reindexes an item from an old key to a new key. If there was no such
315
+ # item, does nothing. Returns 0 if successful, else -1.
316
+ #
317
+ # @param old_key [::FFI::Pointer, #to_ptr]
318
+ # @param new_key [::FFI::Pointer, #to_ptr]
319
+ # @return [Integer]
320
+ def rename(old_key, new_key)
321
+ raise DestroyedError unless @ptr
322
+ self_p = @ptr
323
+ result = ::CZMQ::FFI.zhashx_rename(self_p, old_key, new_key)
324
+ result
325
+ end
326
+
327
+ # Set a free function for the specified hash table item. When the item is
328
+ # destroyed, the free function, if any, is called on that item.
329
+ # Use this when hash items are dynamically allocated, to ensure that
330
+ # you don't have memory leaks. You can pass 'free' or NULL as a free_fn.
331
+ # Returns the item, or NULL if there is no such item.
332
+ #
333
+ # @param key [::FFI::Pointer, #to_ptr]
334
+ # @param free_fn [::FFI::Pointer, #to_ptr]
335
+ # @return [::FFI::Pointer]
336
+ def freefn(key, free_fn)
337
+ raise DestroyedError unless @ptr
338
+ self_p = @ptr
339
+ result = ::CZMQ::FFI.zhashx_freefn(self_p, key, free_fn)
340
+ result
341
+ end
342
+
343
+ # Return the number of keys/items in the hash table
344
+ #
345
+ # @return [Integer]
346
+ def size()
347
+ raise DestroyedError unless @ptr
348
+ self_p = @ptr
349
+ result = ::CZMQ::FFI.zhashx_size(self_p)
350
+ result
351
+ end
352
+
353
+ # Return a zlistx_t containing the keys for the items in the
354
+ # table. Uses the key_duplicator to duplicate all keys and sets the
355
+ # key_destructor as destructor for the list.
356
+ #
357
+ # @return [Zlistx]
358
+ def keys()
359
+ raise DestroyedError unless @ptr
360
+ self_p = @ptr
361
+ result = ::CZMQ::FFI.zhashx_keys(self_p)
362
+ result = Zlistx.__new result, true
363
+ result
364
+ end
365
+
366
+ # Return a zlistx_t containing the values for the items in the
367
+ # table. Uses the duplicator to duplicate all items and sets the
368
+ # destructor as destructor for the list.
369
+ #
370
+ # @return [Zlistx]
371
+ def values()
372
+ raise DestroyedError unless @ptr
373
+ self_p = @ptr
374
+ result = ::CZMQ::FFI.zhashx_values(self_p)
375
+ result = Zlistx.__new result, true
376
+ result
377
+ end
378
+
379
+ # Simple iterator; returns first item in hash table, in no given order,
380
+ # or NULL if the table is empty. This method is simpler to use than the
381
+ # foreach() method, which is deprecated. To access the key for this item
382
+ # use zhashx_cursor(). NOTE: do NOT modify the table while iterating.
383
+ #
384
+ # @return [::FFI::Pointer]
385
+ def first()
386
+ raise DestroyedError unless @ptr
387
+ self_p = @ptr
388
+ result = ::CZMQ::FFI.zhashx_first(self_p)
389
+ result
390
+ end
391
+
392
+ # Simple iterator; returns next item in hash table, in no given order,
393
+ # or NULL if the last item was already returned. Use this together with
394
+ # zhashx_first() to process all items in a hash table. If you need the
395
+ # items in sorted order, use zhashx_keys() and then zlistx_sort(). To
396
+ # access the key for this item use zhashx_cursor(). NOTE: do NOT modify
397
+ # the table while iterating.
398
+ #
399
+ # @return [::FFI::Pointer]
400
+ def next()
401
+ raise DestroyedError unless @ptr
402
+ self_p = @ptr
403
+ result = ::CZMQ::FFI.zhashx_next(self_p)
404
+ result
405
+ end
406
+
407
+ # After a successful first/next method, returns the key for the item that
408
+ # was returned. This is a constant string that you may not modify or
409
+ # deallocate, and which lasts as long as the item in the hash. After an
410
+ # unsuccessful first/next, returns NULL.
411
+ #
412
+ # @return [::FFI::Pointer]
413
+ def cursor()
414
+ raise DestroyedError unless @ptr
415
+ self_p = @ptr
416
+ result = ::CZMQ::FFI.zhashx_cursor(self_p)
417
+ result
418
+ end
419
+
420
+ # Add a comment to hash table before saving to disk. You can add as many
421
+ # comment lines as you like. These comment lines are discarded when loading
422
+ # the file. If you use a null format, all comments are deleted.
423
+ #
424
+ # @param format [String, #to_s, nil]
425
+ # @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
426
+ # @return [void]
427
+ def comment(format, *args)
428
+ raise DestroyedError unless @ptr
429
+ self_p = @ptr
430
+ result = ::CZMQ::FFI.zhashx_comment(self_p, format, *args)
431
+ result
432
+ end
433
+
434
+ # Save hash table to a text file in name=value format. Hash values must be
435
+ # printable strings; keys may not contain '=' character. Returns 0 if OK,
436
+ # else -1 if a file error occurred.
437
+ #
438
+ # @param filename [String, #to_s, nil]
439
+ # @return [Integer]
440
+ def save(filename)
441
+ raise DestroyedError unless @ptr
442
+ self_p = @ptr
443
+ result = ::CZMQ::FFI.zhashx_save(self_p, filename)
444
+ result
445
+ end
446
+
447
+ # Load hash table from a text file in name=value format; hash table must
448
+ # already exist. Hash values must printable strings; keys may not contain
449
+ # '=' character. Returns 0 if OK, else -1 if a file was not readable.
450
+ #
451
+ # @param filename [String, #to_s, nil]
452
+ # @return [Integer]
453
+ def load(filename)
454
+ raise DestroyedError unless @ptr
455
+ self_p = @ptr
456
+ result = ::CZMQ::FFI.zhashx_load(self_p, filename)
457
+ result
458
+ end
459
+
460
+ # When a hash table was loaded from a file by zhashx_load, this method will
461
+ # reload the file if it has been modified since, and is "stable", i.e. not
462
+ # still changing. Returns 0 if OK, -1 if there was an error reloading the
463
+ # file.
464
+ #
465
+ # @return [Integer]
466
+ def refresh()
467
+ raise DestroyedError unless @ptr
468
+ self_p = @ptr
469
+ result = ::CZMQ::FFI.zhashx_refresh(self_p)
470
+ result
471
+ end
472
+
473
+ # Serialize hash table to a binary frame that can be sent in a message.
474
+ # The packed format is compatible with the 'dictionary' type defined in
475
+ # http://rfc.zeromq.org/spec:35/FILEMQ, and implemented by zproto:
476
+ #
477
+ # ; A list of name/value pairs
478
+ # dictionary = dict-count *( dict-name dict-value )
479
+ # dict-count = number-4
480
+ # dict-value = longstr
481
+ # dict-name = string
482
+ #
483
+ # ; Strings are always length + text contents
484
+ # longstr = number-4 *VCHAR
485
+ # string = number-1 *VCHAR
486
+ #
487
+ # ; Numbers are unsigned integers in network byte order
488
+ # number-1 = 1OCTET
489
+ # number-4 = 4OCTET
490
+ #
491
+ # Comments are not included in the packed data. Item values MUST be
492
+ # strings.
493
+ #
494
+ # @return [Zframe]
495
+ def pack()
496
+ raise DestroyedError unless @ptr
497
+ self_p = @ptr
498
+ result = ::CZMQ::FFI.zhashx_pack(self_p)
499
+ result = Zframe.__new result, true
500
+ result
501
+ end
502
+
503
+ # Same as pack but uses a user-defined serializer function to convert items
504
+ # into longstr.
505
+ #
506
+ # @param serializer [::FFI::Pointer, #to_ptr]
507
+ # @return [Zframe]
508
+ def pack_own(serializer)
509
+ raise DestroyedError unless @ptr
510
+ self_p = @ptr
511
+ result = ::CZMQ::FFI.zhashx_pack_own(self_p, serializer)
512
+ result = Zframe.__new result, true
513
+ result
514
+ end
515
+
516
+ # Make a copy of the list; items are duplicated if you set a duplicator
517
+ # for the list, otherwise not. Copying a null reference returns a null
518
+ # reference. Note that this method's behavior changed slightly for CZMQ
519
+ # v3.x, as it does not set nor respect autofree. It does however let you
520
+ # duplicate any hash table safely. The old behavior is in zhashx_dup_v2.
521
+ #
522
+ # @return [Zhashx]
523
+ def dup()
524
+ raise DestroyedError unless @ptr
525
+ self_p = @ptr
526
+ result = ::CZMQ::FFI.zhashx_dup(self_p)
527
+ result = Zhashx.__new result, true
528
+ result
529
+ end
530
+
531
+ # Set a user-defined deallocator for hash items; by default items are not
532
+ # freed when the hash is destroyed.
533
+ #
534
+ # @param destructor [::FFI::Pointer, #to_ptr]
535
+ # @return [void]
536
+ def set_destructor(destructor)
537
+ raise DestroyedError unless @ptr
538
+ self_p = @ptr
539
+ result = ::CZMQ::FFI.zhashx_set_destructor(self_p, destructor)
540
+ result
541
+ end
542
+
543
+ # Set a user-defined duplicator for hash items; by default items are not
544
+ # copied when the hash is duplicated.
545
+ #
546
+ # @param duplicator [::FFI::Pointer, #to_ptr]
547
+ # @return [void]
548
+ def set_duplicator(duplicator)
549
+ raise DestroyedError unless @ptr
550
+ self_p = @ptr
551
+ result = ::CZMQ::FFI.zhashx_set_duplicator(self_p, duplicator)
552
+ result
553
+ end
554
+
555
+ # Set a user-defined deallocator for keys; by default keys are freed
556
+ # when the hash is destroyed using free().
557
+ #
558
+ # @param destructor [::FFI::Pointer, #to_ptr]
559
+ # @return [void]
560
+ def set_key_destructor(destructor)
561
+ raise DestroyedError unless @ptr
562
+ self_p = @ptr
563
+ result = ::CZMQ::FFI.zhashx_set_key_destructor(self_p, destructor)
564
+ result
565
+ end
566
+
567
+ # Set a user-defined duplicator for keys; by default keys are duplicated
568
+ # using strdup.
569
+ #
570
+ # @param duplicator [::FFI::Pointer, #to_ptr]
571
+ # @return [void]
572
+ def set_key_duplicator(duplicator)
573
+ raise DestroyedError unless @ptr
574
+ self_p = @ptr
575
+ result = ::CZMQ::FFI.zhashx_set_key_duplicator(self_p, duplicator)
576
+ result
577
+ end
578
+
579
+ # Set a user-defined comparator for keys; by default keys are
580
+ # compared using strcmp.
581
+ #
582
+ # @param comparator [::FFI::Pointer, #to_ptr]
583
+ # @return [void]
584
+ def set_key_comparator(comparator)
585
+ raise DestroyedError unless @ptr
586
+ self_p = @ptr
587
+ result = ::CZMQ::FFI.zhashx_set_key_comparator(self_p, comparator)
588
+ result
589
+ end
590
+
591
+ # Set a user-defined comparator for keys; by default keys are
592
+ # compared using strcmp.
593
+ #
594
+ # @param hasher [::FFI::Pointer, #to_ptr]
595
+ # @return [void]
596
+ def set_key_hasher(hasher)
597
+ raise DestroyedError unless @ptr
598
+ self_p = @ptr
599
+ result = ::CZMQ::FFI.zhashx_set_key_hasher(self_p, hasher)
600
+ result
601
+ end
602
+
603
+ # Make copy of hash table; if supplied table is null, returns null.
604
+ # Does not copy items themselves. Rebuilds new table so may be slow on
605
+ # very large tables. NOTE: only works with item values that are strings
606
+ # since there's no other way to know how to duplicate the item value.
607
+ #
608
+ # @return [Zhashx]
609
+ def dup_v2()
610
+ raise DestroyedError unless @ptr
611
+ self_p = @ptr
612
+ result = ::CZMQ::FFI.zhashx_dup_v2(self_p)
613
+ result = Zhashx.__new result, false
614
+ result
615
+ end
616
+
617
+ # Set hash for automatic value destruction. This method is deprecated
618
+ # and you should use set_destructor instead.
619
+ #
620
+ # @return [void]
621
+ def autofree()
622
+ raise DestroyedError unless @ptr
623
+ self_p = @ptr
624
+ result = ::CZMQ::FFI.zhashx_autofree(self_p)
625
+ result
626
+ end
627
+
628
+ # Apply function to each item in the hash table. Items are iterated in no
629
+ # defined order. Stops if callback function returns non-zero and returns
630
+ # final return code from callback function (zero = success). This method
631
+ # is deprecated and you should use zhashx_first/_next instead.
632
+ #
633
+ # @param callback [::FFI::Pointer, #to_ptr]
634
+ # @param argument [::FFI::Pointer, #to_ptr]
635
+ # @return [Integer]
636
+ def foreach(callback, argument)
637
+ raise DestroyedError unless @ptr
638
+ self_p = @ptr
639
+ result = ::CZMQ::FFI.zhashx_foreach(self_p, callback, argument)
640
+ result
641
+ end
642
+
643
+ # Self test of this class.
644
+ #
645
+ # @param verbose [Boolean]
646
+ # @return [void]
647
+ def self.test(verbose)
648
+ verbose = !(0==verbose||!verbose) # boolean
649
+ result = ::CZMQ::FFI.zhashx_test(verbose)
650
+ result
651
+ end
652
+ end
653
+ end
654
+ end
655
+
656
+ ################################################################################
657
+ # THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
658
+ # Read the zproject/README.md for information about making permanent changes. #
659
+ ################################################################################