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.
- 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,442 @@
|
|
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 config files written in rfc.zeromq.org/spec:4/ZPL.
|
10
|
+
# @note This class is 100% generated using zproject.
|
11
|
+
class Zconfig
|
12
|
+
# Raised when one tries to use an instance of {Zconfig} 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.zconfig_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
|
+
#
|
78
|
+
# typedef int (zconfig_fct) (
|
79
|
+
# zconfig_t *self, void *arg, int level);
|
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.fct
|
86
|
+
::FFI::Function.new :int, [:pointer, :pointer, :int], blocking: true do |self_, arg, level|
|
87
|
+
self_ = Zconfig.__new self_, false
|
88
|
+
result = yield self_, arg, level
|
89
|
+
result = Integer(result)
|
90
|
+
result
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
# Create new config item
|
95
|
+
# @param name [String, #to_s, nil]
|
96
|
+
# @param parent [Zconfig, #__ptr]
|
97
|
+
# @return [CZMQ::Zconfig]
|
98
|
+
def self.new(name, parent)
|
99
|
+
parent = parent.__ptr if parent
|
100
|
+
ptr = ::CZMQ::FFI.zconfig_new(name, parent)
|
101
|
+
__new ptr
|
102
|
+
end
|
103
|
+
|
104
|
+
# Load a config tree from a specified ZPL text file; returns a zconfig_t
|
105
|
+
# reference for the root, if the file exists and is readable. Returns NULL
|
106
|
+
# if the file does not exist.
|
107
|
+
# @param filename [String, #to_s, nil]
|
108
|
+
# @return [CZMQ::Zconfig]
|
109
|
+
def self.load(filename)
|
110
|
+
ptr = ::CZMQ::FFI.zconfig_load(filename)
|
111
|
+
__new ptr
|
112
|
+
end
|
113
|
+
|
114
|
+
# Equivalent to zconfig_load, taking a format string instead of a fixed
|
115
|
+
# filename.
|
116
|
+
# @param format [String, #to_s, nil]
|
117
|
+
# @param args [Array<Object>]
|
118
|
+
# @return [CZMQ::Zconfig]
|
119
|
+
def self.loadf(format, *args)
|
120
|
+
ptr = ::CZMQ::FFI.zconfig_loadf(format, *args)
|
121
|
+
__new ptr
|
122
|
+
end
|
123
|
+
|
124
|
+
# Destroy a config item and all its children
|
125
|
+
#
|
126
|
+
# @return [void]
|
127
|
+
def destroy()
|
128
|
+
return unless @ptr
|
129
|
+
self_p = __ptr_give_ref
|
130
|
+
result = ::CZMQ::FFI.zconfig_destroy(self_p)
|
131
|
+
result
|
132
|
+
end
|
133
|
+
|
134
|
+
# Return name of config item
|
135
|
+
#
|
136
|
+
# @return [::FFI::Pointer]
|
137
|
+
def name()
|
138
|
+
raise DestroyedError unless @ptr
|
139
|
+
self_p = @ptr
|
140
|
+
result = ::CZMQ::FFI.zconfig_name(self_p)
|
141
|
+
result
|
142
|
+
end
|
143
|
+
|
144
|
+
# Return value of config item
|
145
|
+
#
|
146
|
+
# @return [::FFI::Pointer]
|
147
|
+
def value()
|
148
|
+
raise DestroyedError unless @ptr
|
149
|
+
self_p = @ptr
|
150
|
+
result = ::CZMQ::FFI.zconfig_value(self_p)
|
151
|
+
result
|
152
|
+
end
|
153
|
+
|
154
|
+
# Insert or update configuration key with value
|
155
|
+
#
|
156
|
+
# @param path [String, #to_s, nil]
|
157
|
+
# @param value [String, #to_s, nil]
|
158
|
+
# @return [void]
|
159
|
+
def put(path, value)
|
160
|
+
raise DestroyedError unless @ptr
|
161
|
+
self_p = @ptr
|
162
|
+
result = ::CZMQ::FFI.zconfig_put(self_p, path, value)
|
163
|
+
result
|
164
|
+
end
|
165
|
+
|
166
|
+
# Equivalent to zconfig_put, accepting a format specifier and variable
|
167
|
+
# argument list, instead of a single string value.
|
168
|
+
#
|
169
|
+
# @param path [String, #to_s, nil]
|
170
|
+
# @param format [String, #to_s, nil]
|
171
|
+
# @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
|
172
|
+
# @return [void]
|
173
|
+
def putf(path, format, *args)
|
174
|
+
raise DestroyedError unless @ptr
|
175
|
+
self_p = @ptr
|
176
|
+
result = ::CZMQ::FFI.zconfig_putf(self_p, path, format, *args)
|
177
|
+
result
|
178
|
+
end
|
179
|
+
|
180
|
+
# Get value for config item into a string value; leading slash is optional
|
181
|
+
# and ignored.
|
182
|
+
#
|
183
|
+
# @param path [String, #to_s, nil]
|
184
|
+
# @param default_value [String, #to_s, nil]
|
185
|
+
# @return [::FFI::Pointer]
|
186
|
+
def get(path, default_value)
|
187
|
+
raise DestroyedError unless @ptr
|
188
|
+
self_p = @ptr
|
189
|
+
result = ::CZMQ::FFI.zconfig_get(self_p, path, default_value)
|
190
|
+
result
|
191
|
+
end
|
192
|
+
|
193
|
+
# Set config item name, name may be NULL
|
194
|
+
#
|
195
|
+
# @param name [String, #to_s, nil]
|
196
|
+
# @return [void]
|
197
|
+
def set_name(name)
|
198
|
+
raise DestroyedError unless @ptr
|
199
|
+
self_p = @ptr
|
200
|
+
result = ::CZMQ::FFI.zconfig_set_name(self_p, name)
|
201
|
+
result
|
202
|
+
end
|
203
|
+
|
204
|
+
# Set new value for config item. The new value may be a string, a printf
|
205
|
+
# format, or NULL. Note that if string may possibly contain '%', or if it
|
206
|
+
# comes from an insecure source, you must use '%s' as the format, followed
|
207
|
+
# by the string.
|
208
|
+
#
|
209
|
+
# @param format [String, #to_s, nil]
|
210
|
+
# @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
|
211
|
+
# @return [void]
|
212
|
+
def set_value(format, *args)
|
213
|
+
raise DestroyedError unless @ptr
|
214
|
+
self_p = @ptr
|
215
|
+
result = ::CZMQ::FFI.zconfig_set_value(self_p, format, *args)
|
216
|
+
result
|
217
|
+
end
|
218
|
+
|
219
|
+
# Find our first child, if any
|
220
|
+
#
|
221
|
+
# @return [Zconfig]
|
222
|
+
def child()
|
223
|
+
raise DestroyedError unless @ptr
|
224
|
+
self_p = @ptr
|
225
|
+
result = ::CZMQ::FFI.zconfig_child(self_p)
|
226
|
+
result = Zconfig.__new result, false
|
227
|
+
result
|
228
|
+
end
|
229
|
+
|
230
|
+
# Find our first sibling, if any
|
231
|
+
#
|
232
|
+
# @return [Zconfig]
|
233
|
+
def next()
|
234
|
+
raise DestroyedError unless @ptr
|
235
|
+
self_p = @ptr
|
236
|
+
result = ::CZMQ::FFI.zconfig_next(self_p)
|
237
|
+
result = Zconfig.__new result, false
|
238
|
+
result
|
239
|
+
end
|
240
|
+
|
241
|
+
# Find a config item along a path; leading slash is optional and ignored.
|
242
|
+
#
|
243
|
+
# @param path [String, #to_s, nil]
|
244
|
+
# @return [Zconfig]
|
245
|
+
def locate(path)
|
246
|
+
raise DestroyedError unless @ptr
|
247
|
+
self_p = @ptr
|
248
|
+
result = ::CZMQ::FFI.zconfig_locate(self_p, path)
|
249
|
+
result = Zconfig.__new result, false
|
250
|
+
result
|
251
|
+
end
|
252
|
+
|
253
|
+
# Locate the last config item at a specified depth
|
254
|
+
#
|
255
|
+
# @param level [Integer, #to_int, #to_i]
|
256
|
+
# @return [Zconfig]
|
257
|
+
def at_depth(level)
|
258
|
+
raise DestroyedError unless @ptr
|
259
|
+
self_p = @ptr
|
260
|
+
level = Integer(level)
|
261
|
+
result = ::CZMQ::FFI.zconfig_at_depth(self_p, level)
|
262
|
+
result = Zconfig.__new result, false
|
263
|
+
result
|
264
|
+
end
|
265
|
+
|
266
|
+
# Execute a callback for each config item in the tree; returns zero if
|
267
|
+
# successful, else -1.
|
268
|
+
#
|
269
|
+
# @param handler [::FFI::Pointer, #to_ptr]
|
270
|
+
# @param arg [::FFI::Pointer, #to_ptr]
|
271
|
+
# @return [Integer]
|
272
|
+
def execute(handler, arg)
|
273
|
+
raise DestroyedError unless @ptr
|
274
|
+
self_p = @ptr
|
275
|
+
result = ::CZMQ::FFI.zconfig_execute(self_p, handler, arg)
|
276
|
+
result
|
277
|
+
end
|
278
|
+
|
279
|
+
# Add comment to config item before saving to disk. You can add as many
|
280
|
+
# comment lines as you like. If you use a null format, all comments are
|
281
|
+
# deleted.
|
282
|
+
#
|
283
|
+
# @param format [String, #to_s, nil]
|
284
|
+
# @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
|
285
|
+
# @return [void]
|
286
|
+
def set_comment(format, *args)
|
287
|
+
raise DestroyedError unless @ptr
|
288
|
+
self_p = @ptr
|
289
|
+
result = ::CZMQ::FFI.zconfig_set_comment(self_p, format, *args)
|
290
|
+
result
|
291
|
+
end
|
292
|
+
|
293
|
+
# Return comments of config item, as zlist.
|
294
|
+
#
|
295
|
+
# @return [Zlist]
|
296
|
+
def comments()
|
297
|
+
raise DestroyedError unless @ptr
|
298
|
+
self_p = @ptr
|
299
|
+
result = ::CZMQ::FFI.zconfig_comments(self_p)
|
300
|
+
result = Zlist.__new result, false
|
301
|
+
result
|
302
|
+
end
|
303
|
+
|
304
|
+
# Save a config tree to a specified ZPL text file, where a filename
|
305
|
+
# "-" means dump to standard output.
|
306
|
+
#
|
307
|
+
# @param filename [String, #to_s, nil]
|
308
|
+
# @return [Integer]
|
309
|
+
def save(filename)
|
310
|
+
raise DestroyedError unless @ptr
|
311
|
+
self_p = @ptr
|
312
|
+
result = ::CZMQ::FFI.zconfig_save(self_p, filename)
|
313
|
+
result
|
314
|
+
end
|
315
|
+
|
316
|
+
# Equivalent to zconfig_save, taking a format string instead of a fixed
|
317
|
+
# filename.
|
318
|
+
#
|
319
|
+
# @param format [String, #to_s, nil]
|
320
|
+
# @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
|
321
|
+
# @return [Integer]
|
322
|
+
def savef(format, *args)
|
323
|
+
raise DestroyedError unless @ptr
|
324
|
+
self_p = @ptr
|
325
|
+
result = ::CZMQ::FFI.zconfig_savef(self_p, format, *args)
|
326
|
+
result
|
327
|
+
end
|
328
|
+
|
329
|
+
# Report filename used during zconfig_load, or NULL if none
|
330
|
+
#
|
331
|
+
# @return [String]
|
332
|
+
def filename()
|
333
|
+
raise DestroyedError unless @ptr
|
334
|
+
self_p = @ptr
|
335
|
+
result = ::CZMQ::FFI.zconfig_filename(self_p)
|
336
|
+
result
|
337
|
+
end
|
338
|
+
|
339
|
+
# Reload config tree from same file that it was previously loaded from.
|
340
|
+
# Returns 0 if OK, -1 if there was an error (and then does not change
|
341
|
+
# existing data).
|
342
|
+
#
|
343
|
+
# @param self_p [#__ptr_give_ref]
|
344
|
+
# @return [Integer]
|
345
|
+
def self.reload(self_p)
|
346
|
+
self_p = self_p.__ptr_give_ref
|
347
|
+
result = ::CZMQ::FFI.zconfig_reload(self_p)
|
348
|
+
result
|
349
|
+
end
|
350
|
+
|
351
|
+
# Load a config tree from a memory chunk
|
352
|
+
#
|
353
|
+
# @param chunk [Zchunk, #__ptr]
|
354
|
+
# @return [Zconfig]
|
355
|
+
def self.chunk_load(chunk)
|
356
|
+
chunk = chunk.__ptr if chunk
|
357
|
+
result = ::CZMQ::FFI.zconfig_chunk_load(chunk)
|
358
|
+
result = Zconfig.__new result, false
|
359
|
+
result
|
360
|
+
end
|
361
|
+
|
362
|
+
# Save a config tree to a new memory chunk
|
363
|
+
#
|
364
|
+
# @return [Zchunk]
|
365
|
+
def chunk_save()
|
366
|
+
raise DestroyedError unless @ptr
|
367
|
+
self_p = @ptr
|
368
|
+
result = ::CZMQ::FFI.zconfig_chunk_save(self_p)
|
369
|
+
result = Zchunk.__new result, false
|
370
|
+
result
|
371
|
+
end
|
372
|
+
|
373
|
+
# Load a config tree from a null-terminated string
|
374
|
+
#
|
375
|
+
# @param string [String, #to_s, nil]
|
376
|
+
# @return [Zconfig]
|
377
|
+
def self.str_load(string)
|
378
|
+
result = ::CZMQ::FFI.zconfig_str_load(string)
|
379
|
+
result = Zconfig.__new result, true
|
380
|
+
result
|
381
|
+
end
|
382
|
+
|
383
|
+
# Save a config tree to a new null terminated string
|
384
|
+
#
|
385
|
+
# @return [::FFI::AutoPointer]
|
386
|
+
def str_save()
|
387
|
+
raise DestroyedError unless @ptr
|
388
|
+
self_p = @ptr
|
389
|
+
result = ::CZMQ::FFI.zconfig_str_save(self_p)
|
390
|
+
result = ::FFI::AutoPointer.new(result, LibC.method(:free))
|
391
|
+
result
|
392
|
+
end
|
393
|
+
|
394
|
+
# Return true if a configuration tree was loaded from a file and that
|
395
|
+
# file has changed in since the tree was loaded.
|
396
|
+
#
|
397
|
+
# @return [Boolean]
|
398
|
+
def has_changed()
|
399
|
+
raise DestroyedError unless @ptr
|
400
|
+
self_p = @ptr
|
401
|
+
result = ::CZMQ::FFI.zconfig_has_changed(self_p)
|
402
|
+
result
|
403
|
+
end
|
404
|
+
|
405
|
+
# Print the config file to open stream
|
406
|
+
#
|
407
|
+
# @param file [::FFI::Pointer, #to_ptr]
|
408
|
+
# @return [void]
|
409
|
+
def fprint(file)
|
410
|
+
raise DestroyedError unless @ptr
|
411
|
+
self_p = @ptr
|
412
|
+
result = ::CZMQ::FFI.zconfig_fprint(self_p, file)
|
413
|
+
result
|
414
|
+
end
|
415
|
+
|
416
|
+
# Print properties of object
|
417
|
+
#
|
418
|
+
# @return [void]
|
419
|
+
def print()
|
420
|
+
raise DestroyedError unless @ptr
|
421
|
+
self_p = @ptr
|
422
|
+
result = ::CZMQ::FFI.zconfig_print(self_p)
|
423
|
+
result
|
424
|
+
end
|
425
|
+
|
426
|
+
# Self test of this class
|
427
|
+
#
|
428
|
+
# @param verbose [Boolean]
|
429
|
+
# @return [void]
|
430
|
+
def self.test(verbose)
|
431
|
+
verbose = !(0==verbose||!verbose) # boolean
|
432
|
+
result = ::CZMQ::FFI.zconfig_test(verbose)
|
433
|
+
result
|
434
|
+
end
|
435
|
+
end
|
436
|
+
end
|
437
|
+
end
|
438
|
+
|
439
|
+
################################################################################
|
440
|
+
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
|
441
|
+
# Read the zproject/README.md for information about making permanent changes. #
|
442
|
+
################################################################################
|
@@ -0,0 +1,156 @@
|
|
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
|
+
# provides hashing functions (SHA-1 at present)
|
10
|
+
# @note This class is 100% generated using zproject.
|
11
|
+
class Zdigest
|
12
|
+
# Raised when one tries to use an instance of {Zdigest} 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.zdigest_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
|
+
# Constructor - creates new digest object, which you use to build up a
|
77
|
+
# digest by repeatedly calling zdigest_update() on chunks of data.
|
78
|
+
# @return [CZMQ::Zdigest]
|
79
|
+
def self.new()
|
80
|
+
ptr = ::CZMQ::FFI.zdigest_new()
|
81
|
+
__new ptr
|
82
|
+
end
|
83
|
+
|
84
|
+
# Destroy a digest object
|
85
|
+
#
|
86
|
+
# @return [void]
|
87
|
+
def destroy()
|
88
|
+
return unless @ptr
|
89
|
+
self_p = __ptr_give_ref
|
90
|
+
result = ::CZMQ::FFI.zdigest_destroy(self_p)
|
91
|
+
result
|
92
|
+
end
|
93
|
+
|
94
|
+
# Add buffer into digest calculation
|
95
|
+
#
|
96
|
+
# @param buffer [::FFI::Pointer, #to_ptr]
|
97
|
+
# @param length [Integer, #to_int, #to_i]
|
98
|
+
# @return [void]
|
99
|
+
def update(buffer, length)
|
100
|
+
raise DestroyedError unless @ptr
|
101
|
+
self_p = @ptr
|
102
|
+
length = Integer(length)
|
103
|
+
result = ::CZMQ::FFI.zdigest_update(self_p, buffer, length)
|
104
|
+
result
|
105
|
+
end
|
106
|
+
|
107
|
+
# Return final digest hash data. If built without crypto support,
|
108
|
+
# returns NULL.
|
109
|
+
#
|
110
|
+
# @return [::FFI::Pointer]
|
111
|
+
def data()
|
112
|
+
raise DestroyedError unless @ptr
|
113
|
+
self_p = @ptr
|
114
|
+
result = ::CZMQ::FFI.zdigest_data(self_p)
|
115
|
+
result
|
116
|
+
end
|
117
|
+
|
118
|
+
# Return final digest hash size
|
119
|
+
#
|
120
|
+
# @return [Integer]
|
121
|
+
def size()
|
122
|
+
raise DestroyedError unless @ptr
|
123
|
+
self_p = @ptr
|
124
|
+
result = ::CZMQ::FFI.zdigest_size(self_p)
|
125
|
+
result
|
126
|
+
end
|
127
|
+
|
128
|
+
# Return digest as printable hex string; caller should not modify nor
|
129
|
+
# free this string. After calling this, you may not use zdigest_update()
|
130
|
+
# on the same digest. If built without crypto support, returns NULL.
|
131
|
+
#
|
132
|
+
# @return [::FFI::Pointer]
|
133
|
+
def string()
|
134
|
+
raise DestroyedError unless @ptr
|
135
|
+
self_p = @ptr
|
136
|
+
result = ::CZMQ::FFI.zdigest_string(self_p)
|
137
|
+
result
|
138
|
+
end
|
139
|
+
|
140
|
+
# Self test of this class.
|
141
|
+
#
|
142
|
+
# @param verbose [Boolean]
|
143
|
+
# @return [void]
|
144
|
+
def self.test(verbose)
|
145
|
+
verbose = !(0==verbose||!verbose) # boolean
|
146
|
+
result = ::CZMQ::FFI.zdigest_test(verbose)
|
147
|
+
result
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
################################################################################
|
154
|
+
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
|
155
|
+
# Read the zproject/README.md for information about making permanent changes. #
|
156
|
+
################################################################################
|