module LibCZMQ
Constants
- CZMQ_LIB_PATH
- LIB_PATH
This looks like a sensible search path
- VERSION
Public Class Methods
create_pollitem(args={})
click to toggle source
# File lib/czmq-ffi/structures.rb, line 32 def self.create_pollitem(args={}) pi = ZPollItem.new pi[:socket] = args[:socket] pi[:fd] = args[:fd] || 0 pi[:events] = args[:events] || 0 pi[:revents] = args[:revents] || 0 pi end
create_zloop_callback(func)
click to toggle source
# File lib/czmq-ffi/libczmq.rb, line 299 def self.create_zloop_callback(func) FFI::Function.new(:int, [:pointer, :pointer, :pointer]) do |zloopbuf, zpollitembuf, arg| func.call(zloopbuf, zpollitembuf, arg) end end
zbeacon_destroy(zbeacon)
click to toggle source
# File lib/czmq-ffi/libczmq.rb, line 49 def self.zbeacon_destroy(zbeacon) zbeacon_ptr = FFI::MemoryPointer.new(:pointer) zbeacon_ptr.write_pointer(zbeacon) __zbeacon_destroy(zbeacon_ptr) end
zbeacon_publish(zbeacon, byte_array)
click to toggle source
# File lib/czmq-ffi/libczmq.rb, line 55 def self.zbeacon_publish(zbeacon, byte_array) FFI::MemoryPointer.new(:uint8, byte_array.size) do |p| p.write_array_of_int8(byte_array) __zbeacon_publish(zbeacon, p, byte_array.size) end end
zbeacon_subscribe(zbeacon, byte_array=nil)
click to toggle source
# File lib/czmq-ffi/libczmq.rb, line 62 def self.zbeacon_subscribe(zbeacon, byte_array=nil) if byte_array.nil? __zbeacon_subscribe(zbeacon, nil, 0) else FFI::MemoryPointer.new(:uint8, byte_array.size) do |p| p.write_array_of_int8(byte_array) __zbeacon_subscribe(zbeacon, p, byte_array.size) end end end
zctx_destroy(zctx)
click to toggle source
# File lib/czmq-ffi/libczmq.rb, line 28 def self.zctx_destroy(zctx) zctx_ptr = FFI::MemoryPointer.new(:pointer) zctx_ptr.write_pointer(zctx) __zctx_destroy(zctx_ptr) end
zframe_destroy(zframe)
click to toggle source
# File lib/czmq-ffi/libczmq.rb, line 241 def self.zframe_destroy(zframe) zframe_ptr = FFI::MemoryPointer.new(:pointer) zframe_ptr.write_pointer(zframe) __zframe_destroy(zframe_ptr) end
zframe_new(byte_array=nil)
click to toggle source
These are very low-level functions. Still unsure whether czmq-ffi should provide them. attach_function :zframe_data, [:pointer], :pointer attach_function :zframe_fprint, [:pointer, :string, :pointer], :void attach_function :zframe_print, [:pointer, :string], :void
# File lib/czmq-ffi/libczmq.rb, line 228 def self.zframe_new(byte_array=nil) if byte_array.nil? __zframe_new_empty else zframe = nil FFI::MemoryPointer.new(:uint8, byte_array.size) do |p| p.write_array_of_int8(byte_array) zframe = __zframe_new(p, byte_array.size) end zframe end end
zframe_send(zframe, zsocket, flags)
click to toggle source
# File lib/czmq-ffi/libczmq.rb, line 247 def self.zframe_send(zframe, zsocket, flags) zframe_ptr = FFI::MemoryPointer.new(:pointer) zframe_ptr.write_pointer(zframe) __zframe_send(zframe_ptr, zsocket, flags) end
zframe_strdup(zframe)
click to toggle source
# File lib/czmq-ffi/libczmq.rb, line 257 def self.zframe_strdup(zframe) Utils.extract_string(__zframe_strdup(zframe)) end
zframe_strhex(zframe)
click to toggle source
# File lib/czmq-ffi/libczmq.rb, line 253 def self.zframe_strhex(zframe) Utils.extract_string(__zframe_strhex(zframe)) end
zloop_destroy(zloop)
click to toggle source
# File lib/czmq-ffi/libczmq.rb, line 293 def self.zloop_destroy(zloop) zloop_ptr = FFI::MemoryPointer.new(:pointer) zloop_ptr.write_pointer(zloop) __zloop_destroy(zloop_ptr) end
zmsg_addmem(zmsg, byte_array)
click to toggle source
# File lib/czmq-ffi/libczmq.rb, line 190 def self.zmsg_addmem(zmsg, byte_array) rc = nil FFI::MemoryPointer.new(:uint8, byte_array.size) do |p| p.write_array_of_int8(byte_array) rc = __zmsg_addmem(zmsg, p, byte_array.size) end rc end
zmsg_append(zmsg, zframe)
click to toggle source
zmsg will take ownership of zframe and destroy it at the end
# File lib/czmq-ffi/libczmq.rb, line 175 def self.zmsg_append(zmsg, zframe) zframe_ptr = FFI::MemoryPointer.new(:pointer) zframe_ptr.write_pointer(zframe) __zmsg_append(zmsg, zframe_ptr) end
zmsg_destroy(zmsg)
click to toggle source
NOTE: zmsg_add is deprecated. No point in supporting it. attach_function :zmsg_add, [:pointer, :pointer], :int
# File lib/czmq-ffi/libczmq.rb, line 162 def self.zmsg_destroy(zmsg) zmsg_ptr = FFI::MemoryPointer.new(:pointer) zmsg_ptr.write_pointer(zmsg) __zmsg_destroy(zmsg_ptr) end
zmsg_popstr(zmsg)
click to toggle source
# File lib/czmq-ffi/libczmq.rb, line 199 def self.zmsg_popstr(zmsg) Utils.extract_string(__zmsg_popstr(zmsg)) end
zmsg_pushmem(zmsg, byte_array)
click to toggle source
# File lib/czmq-ffi/libczmq.rb, line 181 def self.zmsg_pushmem(zmsg, byte_array) rc = nil FFI::MemoryPointer.new(:uint8, byte_array.size) do |p| p.write_array_of_int8(byte_array) rc = __zmsg_pushmem(zmsg, p, byte_array.size) end rc end
zmsg_send(zmsg, zsocket)
click to toggle source
# File lib/czmq-ffi/libczmq.rb, line 168 def self.zmsg_send(zmsg, zsocket) zmsg_ptr = FFI::MemoryPointer.new(:pointer) zmsg_ptr.write_pointer(zmsg) __zmsg_send(zmsg_ptr, zsocket) end
zpoller_destroy(zpoller)
click to toggle source
# File lib/czmq-ffi/libczmq.rb, line 271 def self.zpoller_destroy(zpoller) zpoller_ptr = FFI::MemoryPointer.new(:pointer) zpoller_ptr.write_pointer(zpoller) __zpoller_destroy(zpoller_ptr) end
zsocket_type_str(zsocket)
click to toggle source
return nil or (a copy of) the zsocket type name
# File lib/czmq-ffi/libczmq.rb, line 89 def self.zsocket_type_str(zsocket) type_ptr = __zsocket_type_str(zsocket) type_ptr.null? ? nil : type_ptr.read_string end
zstr_recv(zsocket)
click to toggle source
attach_function :__zstr_recvx, :zstr_recvx, [:pointer, :pointer, :varargs], :int
# File lib/czmq-ffi/libczmq.rb, line 105 def self.zstr_recv(zsocket) Utils.extract_string(__zstr_recv(zsocket)) end
zstr_recv_nowait(zsocket)
click to toggle source
# File lib/czmq-ffi/libczmq.rb, line 109 def self.zstr_recv_nowait(zsocket) Utils.extract_string(__zstr_recv_nowait(zsocket)) end