czmq-ffi-gen 0.14.0 → 1.0.0
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 +5 -5
- data/CHANGES.md +19 -0
- data/README.md +11 -36
- data/lib/czmq-ffi-gen.rb +4 -2
- data/lib/czmq-ffi-gen/czmq/ffi.rb +168 -23
- data/lib/czmq-ffi-gen/czmq/ffi/version.rb +1 -1
- data/lib/czmq-ffi-gen/czmq/ffi/zactor.rb +2 -2
- data/lib/czmq-ffi-gen/czmq/ffi/zargs.rb +26 -24
- data/lib/czmq-ffi-gen/czmq/ffi/zcertstore.rb +10 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zchunk.rb +41 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zconfig.rb +25 -2
- data/lib/czmq-ffi-gen/czmq/ffi/zfile.rb +1 -1
- data/lib/czmq-ffi-gen/czmq/ffi/zframe.rb +46 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zhttp_client.rb +113 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zhttp_request.rb +312 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zhttp_response.rb +263 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zhttp_server.rb +135 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zhttp_server_connection.rb +91 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zhttp_server_options.rb +161 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zlistx.rb +34 -1
- data/lib/czmq-ffi-gen/czmq/ffi/zmsg.rb +16 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zosc.rb +487 -0
- data/lib/czmq-ffi-gen/czmq/ffi/zpoller.rb +11 -9
- data/lib/czmq-ffi-gen/czmq/ffi/zproc.rb +53 -217
- data/lib/czmq-ffi-gen/czmq/ffi/zsock.rb +946 -2
- data/lib/czmq-ffi-gen/czmq/ffi/zsys.rb +217 -1
- data/lib/czmq-ffi-gen/czmq_ffi_extensions.rb +16 -0
- data/lib/czmq-ffi-gen/gem_version.rb +1 -1
- data/lib/czmq-ffi-gen/libzmq.rb +29 -2
- data/lib/czmq-ffi-gen/versions.rb +1 -11
- metadata +28 -33
- data/lib/czmq-ffi-gen/legacy.rb +0 -16
@@ -0,0 +1,161 @@
|
|
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
|
+
# zhttp server.
|
10
|
+
# @note This class is 100% generated using zproject.
|
11
|
+
class ZhttpServerOptions
|
12
|
+
# Raised when one tries to use an instance of {ZhttpServerOptions} 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.zhttp_server_options_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 zhttp_server_options.
|
77
|
+
# @return [CZMQ::ZhttpServerOptions]
|
78
|
+
def self.new()
|
79
|
+
ptr = ::CZMQ::FFI.zhttp_server_options_new()
|
80
|
+
__new ptr
|
81
|
+
end
|
82
|
+
|
83
|
+
# Create options from config tree.
|
84
|
+
# @param config [Zconfig, #__ptr]
|
85
|
+
# @return [CZMQ::ZhttpServerOptions]
|
86
|
+
def self.from_config(config)
|
87
|
+
config = config.__ptr if config
|
88
|
+
ptr = ::CZMQ::FFI.zhttp_server_options_from_config(config)
|
89
|
+
__new ptr
|
90
|
+
end
|
91
|
+
|
92
|
+
# Destroy the zhttp_server_options.
|
93
|
+
#
|
94
|
+
# @return [void]
|
95
|
+
def destroy()
|
96
|
+
return unless @ptr
|
97
|
+
self_p = __ptr_give_ref
|
98
|
+
result = ::CZMQ::FFI.zhttp_server_options_destroy(self_p)
|
99
|
+
result
|
100
|
+
end
|
101
|
+
|
102
|
+
# Get the server listening port.
|
103
|
+
#
|
104
|
+
# @return [Integer]
|
105
|
+
def port()
|
106
|
+
raise DestroyedError unless @ptr
|
107
|
+
self_p = @ptr
|
108
|
+
result = ::CZMQ::FFI.zhttp_server_options_port(self_p)
|
109
|
+
result
|
110
|
+
end
|
111
|
+
|
112
|
+
# Set the server listening port
|
113
|
+
#
|
114
|
+
# @param port [Integer, #to_int, #to_i]
|
115
|
+
# @return [void]
|
116
|
+
def set_port(port)
|
117
|
+
raise DestroyedError unless @ptr
|
118
|
+
self_p = @ptr
|
119
|
+
port = Integer(port)
|
120
|
+
result = ::CZMQ::FFI.zhttp_server_options_set_port(self_p, port)
|
121
|
+
result
|
122
|
+
end
|
123
|
+
|
124
|
+
# Get the address sockets should connect to in order to receive requests.
|
125
|
+
#
|
126
|
+
# @return [String]
|
127
|
+
def backend_address()
|
128
|
+
raise DestroyedError unless @ptr
|
129
|
+
self_p = @ptr
|
130
|
+
result = ::CZMQ::FFI.zhttp_server_options_backend_address(self_p)
|
131
|
+
result
|
132
|
+
end
|
133
|
+
|
134
|
+
# Set the address sockets should connect to in order to receive requests.
|
135
|
+
#
|
136
|
+
# @param address [String, #to_s, nil]
|
137
|
+
# @return [void]
|
138
|
+
def set_backend_address(address)
|
139
|
+
raise DestroyedError unless @ptr
|
140
|
+
self_p = @ptr
|
141
|
+
result = ::CZMQ::FFI.zhttp_server_options_set_backend_address(self_p, address)
|
142
|
+
result
|
143
|
+
end
|
144
|
+
|
145
|
+
# Self test of this class.
|
146
|
+
#
|
147
|
+
# @param verbose [Boolean]
|
148
|
+
# @return [void]
|
149
|
+
def self.test(verbose)
|
150
|
+
verbose = !(0==verbose||!verbose) # boolean
|
151
|
+
result = ::CZMQ::FFI.zhttp_server_options_test(verbose)
|
152
|
+
result
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
################################################################################
|
159
|
+
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
|
160
|
+
# Read the zproject/README.md for information about making permanent changes. #
|
161
|
+
################################################################################
|
@@ -129,6 +129,17 @@ module CZMQ
|
|
129
129
|
__new ptr
|
130
130
|
end
|
131
131
|
|
132
|
+
# Unpack binary frame into a new list. Packed data must follow format
|
133
|
+
# defined by zlistx_pack. List is set to autofree. An empty frame
|
134
|
+
# unpacks to an empty list.
|
135
|
+
# @param frame [Zframe, #__ptr]
|
136
|
+
# @return [CZMQ::Zlistx]
|
137
|
+
def self.unpack(frame)
|
138
|
+
frame = frame.__ptr if frame
|
139
|
+
ptr = ::CZMQ::FFI.zlistx_unpack(frame)
|
140
|
+
__new ptr
|
141
|
+
end
|
142
|
+
|
132
143
|
# Destroy a list. If an item destructor was specified, all items in the
|
133
144
|
# list are automatically destroyed as well.
|
134
145
|
#
|
@@ -315,7 +326,7 @@ module CZMQ
|
|
315
326
|
result
|
316
327
|
end
|
317
328
|
|
318
|
-
# Delete an item, using its handle. Calls the item destructor
|
329
|
+
# Delete an item, using its handle. Calls the item destructor if any is
|
319
330
|
# set. If handle is null, deletes the first item on the list. Returns 0
|
320
331
|
# if an item was deleted, -1 if not. If cursor was at item, moves cursor
|
321
332
|
# to previous item, so you can delete items while iterating forwards
|
@@ -459,6 +470,28 @@ module CZMQ
|
|
459
470
|
result
|
460
471
|
end
|
461
472
|
|
473
|
+
# Serialize list to a binary frame that can be sent in a message.
|
474
|
+
# The packed format is compatible with the 'strings' type implemented by zproto:
|
475
|
+
#
|
476
|
+
# ; A list of strings
|
477
|
+
# list = list-count *longstr
|
478
|
+
# list-count = number-4
|
479
|
+
#
|
480
|
+
# ; Strings are always length + text contents
|
481
|
+
# longstr = number-4 *VCHAR
|
482
|
+
#
|
483
|
+
# ; Numbers are unsigned integers in network byte order
|
484
|
+
# number-4 = 4OCTET
|
485
|
+
#
|
486
|
+
# @return [Zframe]
|
487
|
+
def pack()
|
488
|
+
raise DestroyedError unless @ptr
|
489
|
+
self_p = @ptr
|
490
|
+
result = ::CZMQ::FFI.zlistx_pack(self_p)
|
491
|
+
result = Zframe.__new result, true
|
492
|
+
result
|
493
|
+
end
|
494
|
+
|
462
495
|
# Self test of this class.
|
463
496
|
#
|
464
497
|
# @param verbose [Boolean]
|
@@ -454,6 +454,7 @@ module CZMQ
|
|
454
454
|
|
455
455
|
# Send message to zsys log sink (may be stdout, or system facility as
|
456
456
|
# configured by zsys_set_logstream).
|
457
|
+
# Long messages are truncated.
|
457
458
|
#
|
458
459
|
# @return [void]
|
459
460
|
def print()
|
@@ -463,6 +464,21 @@ module CZMQ
|
|
463
464
|
result
|
464
465
|
end
|
465
466
|
|
467
|
+
# Send message to zsys log sink (may be stdout, or system facility as
|
468
|
+
# configured by zsys_set_logstream).
|
469
|
+
# Message length is specified; no truncation unless length is zero.
|
470
|
+
# Backwards compatible with zframe_print when length is zero.
|
471
|
+
#
|
472
|
+
# @param size [Integer, #to_int, #to_i]
|
473
|
+
# @return [void]
|
474
|
+
def print_n(size)
|
475
|
+
raise DestroyedError unless @ptr
|
476
|
+
self_p = @ptr
|
477
|
+
size = Integer(size)
|
478
|
+
result = ::CZMQ::FFI.zmsg_print_n(self_p, size)
|
479
|
+
result
|
480
|
+
end
|
481
|
+
|
466
482
|
# Return true if the two messages have the same number of frames and each
|
467
483
|
# frame in the first message is identical to the corresponding frame in the
|
468
484
|
# other message. As with zframe_eq, return false if either message is NULL.
|
@@ -0,0 +1,487 @@
|
|
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
|
+
# Create and decode Open Sound Control messages. (OSC)
|
10
|
+
#
|
11
|
+
# OSC is a serialisation format (and usually transported over UDP) which is
|
12
|
+
# supported by many applications and appliances. It is a de facto protocol
|
13
|
+
# for networking sound synthesizers, computers, and other multimedia devices
|
14
|
+
# for purposes such as musical performance or show control. It is also often
|
15
|
+
# used for rapid prototyping purposes due to the support by many applications
|
16
|
+
# and frameworks in this field. With ZeroMQ's DGRAM sockets it is possible
|
17
|
+
# to use ZeroMQ to send and receive OSC messages which can be understood by
|
18
|
+
# any device supporting OSC.
|
19
|
+
#
|
20
|
+
# Example creating an OSC message:
|
21
|
+
#
|
22
|
+
# zosc_t* conm = zosc_create("/someaddress", "iihfdscF",
|
23
|
+
# 1, 2, 3, 3.14, 6.283185307179586, "greetings", 'q');
|
24
|
+
#
|
25
|
+
# Decoding a message:
|
26
|
+
#
|
27
|
+
# int rc = zosc_retr(oscmsg, "iihfdscF", &intx, &inty, &intz, &floatz,
|
28
|
+
# &doublez, &strings, &charq, &someBool);
|
29
|
+
#
|
30
|
+
# See the class's test method for more examples how to use the class.
|
31
|
+
# @note This class is 100% generated using zproject.
|
32
|
+
class Zosc
|
33
|
+
# Raised when one tries to use an instance of {Zosc} after
|
34
|
+
# the internal pointer to the native object has been nullified.
|
35
|
+
class DestroyedError < RuntimeError; end
|
36
|
+
|
37
|
+
# Boilerplate for self pointer, initializer, and finalizer
|
38
|
+
class << self
|
39
|
+
alias :__new :new
|
40
|
+
end
|
41
|
+
# Attaches the pointer _ptr_ to this instance and defines a finalizer for
|
42
|
+
# it if necessary.
|
43
|
+
# @param ptr [::FFI::Pointer]
|
44
|
+
# @param finalize [Boolean]
|
45
|
+
def initialize(ptr, finalize = true)
|
46
|
+
@ptr = ptr
|
47
|
+
if @ptr.null?
|
48
|
+
@ptr = nil # Remove null pointers so we don't have to test for them.
|
49
|
+
elsif finalize
|
50
|
+
@finalizer = self.class.create_finalizer_for @ptr
|
51
|
+
ObjectSpace.define_finalizer self, @finalizer
|
52
|
+
end
|
53
|
+
end
|
54
|
+
# @param ptr [::FFI::Pointer]
|
55
|
+
# @return [Proc]
|
56
|
+
def self.create_finalizer_for(ptr)
|
57
|
+
Proc.new do
|
58
|
+
ptr_ptr = ::FFI::MemoryPointer.new :pointer
|
59
|
+
ptr_ptr.write_pointer ptr
|
60
|
+
::CZMQ::FFI.zosc_destroy ptr_ptr
|
61
|
+
end
|
62
|
+
end
|
63
|
+
# @return [Boolean]
|
64
|
+
def null?
|
65
|
+
!@ptr or @ptr.null?
|
66
|
+
end
|
67
|
+
# Return internal pointer
|
68
|
+
# @return [::FFI::Pointer]
|
69
|
+
def __ptr
|
70
|
+
raise DestroyedError unless @ptr
|
71
|
+
@ptr
|
72
|
+
end
|
73
|
+
# So external Libraries can just pass the Object to a FFI function which expects a :pointer
|
74
|
+
alias_method :to_ptr, :__ptr
|
75
|
+
# Nullify internal pointer and return pointer pointer.
|
76
|
+
# @note This detaches the current instance from the native object
|
77
|
+
# and thus makes it unusable.
|
78
|
+
# @return [::FFI::MemoryPointer] the pointer pointing to a pointer
|
79
|
+
# pointing to the native object
|
80
|
+
def __ptr_give_ref
|
81
|
+
raise DestroyedError unless @ptr
|
82
|
+
ptr_ptr = ::FFI::MemoryPointer.new :pointer
|
83
|
+
ptr_ptr.write_pointer @ptr
|
84
|
+
__undef_finalizer if @finalizer
|
85
|
+
@ptr = nil
|
86
|
+
ptr_ptr
|
87
|
+
end
|
88
|
+
# Undefines the finalizer for this object.
|
89
|
+
# @note Only use this if you need to and can guarantee that the native
|
90
|
+
# object will be freed by other means.
|
91
|
+
# @return [void]
|
92
|
+
def __undef_finalizer
|
93
|
+
ObjectSpace.undefine_finalizer self
|
94
|
+
@finalizer = nil
|
95
|
+
end
|
96
|
+
|
97
|
+
# Create a new empty OSC message with the specified address string.
|
98
|
+
# @param address [String, #to_s, nil]
|
99
|
+
# @return [CZMQ::Zosc]
|
100
|
+
def self.new(address)
|
101
|
+
ptr = ::CZMQ::FFI.zosc_new(address)
|
102
|
+
__new ptr
|
103
|
+
end
|
104
|
+
|
105
|
+
# Create a new OSC message from the specified zframe. Takes ownership of
|
106
|
+
# the zframe.
|
107
|
+
# @param frame [Zframe, #__ptr]
|
108
|
+
# @return [CZMQ::Zosc]
|
109
|
+
def self.fromframe(frame)
|
110
|
+
frame = frame.__ptr if frame
|
111
|
+
ptr = ::CZMQ::FFI.zosc_fromframe(frame)
|
112
|
+
__new ptr
|
113
|
+
end
|
114
|
+
|
115
|
+
# Create a new zosc message from memory. Take ownership of the memory
|
116
|
+
# and calling free on the data after construction.
|
117
|
+
# @param data [::FFI::Pointer, #to_ptr]
|
118
|
+
# @param size [Integer, #to_int, #to_i]
|
119
|
+
# @return [CZMQ::Zosc]
|
120
|
+
def self.frommem(data, size)
|
121
|
+
size = Integer(size)
|
122
|
+
ptr = ::CZMQ::FFI.zosc_frommem(data, size)
|
123
|
+
__new ptr
|
124
|
+
end
|
125
|
+
|
126
|
+
# Create a new zosc message from the given format and arguments.
|
127
|
+
# The format type tags are as follows:
|
128
|
+
# i - 32bit integer
|
129
|
+
# h - 64bit integer
|
130
|
+
# f - 32bit floating point number (IEEE)
|
131
|
+
# d - 64bit (double) floating point number
|
132
|
+
# s - string (NULL terminated)
|
133
|
+
# t = timetag: an OSC timetag in NTP format (uint64_t)
|
134
|
+
# S - symbol
|
135
|
+
# c - char
|
136
|
+
# m - 4 byte midi packet (8 digits hexadecimal)
|
137
|
+
# T - TRUE (no value required)
|
138
|
+
# F - FALSE (no value required)
|
139
|
+
# N - NIL (no value required)
|
140
|
+
# I - Impulse (for triggers) or INFINITUM (no value required)
|
141
|
+
# b - binary blob
|
142
|
+
# @param address [String, #to_s, nil]
|
143
|
+
# @param format [String, #to_s, nil]
|
144
|
+
# @param args [Array<Object>]
|
145
|
+
# @return [CZMQ::Zosc]
|
146
|
+
def self.create(address, format, *args)
|
147
|
+
ptr = ::CZMQ::FFI.zosc_create(address, format, *args)
|
148
|
+
__new ptr
|
149
|
+
end
|
150
|
+
|
151
|
+
# Destroy an OSC message
|
152
|
+
#
|
153
|
+
# @return [void]
|
154
|
+
def destroy()
|
155
|
+
return unless @ptr
|
156
|
+
self_p = __ptr_give_ref
|
157
|
+
result = ::CZMQ::FFI.zosc_destroy(self_p)
|
158
|
+
result
|
159
|
+
end
|
160
|
+
|
161
|
+
# Return chunk data size
|
162
|
+
#
|
163
|
+
# @return [Integer]
|
164
|
+
def size()
|
165
|
+
raise DestroyedError unless @ptr
|
166
|
+
self_p = @ptr
|
167
|
+
result = ::CZMQ::FFI.zosc_size(self_p)
|
168
|
+
result
|
169
|
+
end
|
170
|
+
|
171
|
+
# Return OSC chunk data. Caller does not own the data!
|
172
|
+
#
|
173
|
+
# @return [::FFI::Pointer]
|
174
|
+
def data()
|
175
|
+
raise DestroyedError unless @ptr
|
176
|
+
self_p = @ptr
|
177
|
+
result = ::CZMQ::FFI.zosc_data(self_p)
|
178
|
+
result
|
179
|
+
end
|
180
|
+
|
181
|
+
# Return the OSC address string
|
182
|
+
#
|
183
|
+
# @return [String]
|
184
|
+
def address()
|
185
|
+
raise DestroyedError unless @ptr
|
186
|
+
self_p = @ptr
|
187
|
+
result = ::CZMQ::FFI.zosc_address(self_p)
|
188
|
+
result
|
189
|
+
end
|
190
|
+
|
191
|
+
# Return the OSC format of the message.
|
192
|
+
# i - 32bit integer
|
193
|
+
# h - 64bit integer
|
194
|
+
# f - 32bit floating point number (IEEE)
|
195
|
+
# d - 64bit (double) floating point number
|
196
|
+
# s - string (NULL terminated)
|
197
|
+
# t = timetag: an OSC timetag in NTP format (uint64_t)
|
198
|
+
# S - symbol
|
199
|
+
# c - char
|
200
|
+
# m - 4 byte midi packet (8 digits hexadecimal)
|
201
|
+
# T - TRUE (no value required)
|
202
|
+
# F - FALSE (no value required)
|
203
|
+
# N - NIL (no value required)
|
204
|
+
# I - Impulse (for triggers) or INFINITUM (no value required)
|
205
|
+
# b - binary blob
|
206
|
+
#
|
207
|
+
# @return [String]
|
208
|
+
def format()
|
209
|
+
raise DestroyedError unless @ptr
|
210
|
+
self_p = @ptr
|
211
|
+
result = ::CZMQ::FFI.zosc_format(self_p)
|
212
|
+
result
|
213
|
+
end
|
214
|
+
|
215
|
+
# Append data to the osc message. The format describes the data that
|
216
|
+
# needs to be appended in the message. This essentially relocates all
|
217
|
+
# data!
|
218
|
+
# The format type tags are as follows:
|
219
|
+
# i - 32bit integer
|
220
|
+
# h - 64bit integer
|
221
|
+
# f - 32bit floating point number (IEEE)
|
222
|
+
# d - 64bit (double) floating point number
|
223
|
+
# s - string (NULL terminated)
|
224
|
+
# t = timetag: an OSC timetag in NTP format (uint64_t)
|
225
|
+
# S - symbol
|
226
|
+
# c - char
|
227
|
+
# m - 4 byte midi packet (8 digits hexadecimal)
|
228
|
+
# T - TRUE (no value required)
|
229
|
+
# F - FALSE (no value required)
|
230
|
+
# N - NIL (no value required)
|
231
|
+
# I - Impulse (for triggers) or INFINITUM (no value required)
|
232
|
+
# b - binary blob
|
233
|
+
#
|
234
|
+
# @param format [String, #to_s, nil]
|
235
|
+
# @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
|
236
|
+
# @return [Integer]
|
237
|
+
def append(format, *args)
|
238
|
+
raise DestroyedError unless @ptr
|
239
|
+
self_p = @ptr
|
240
|
+
result = ::CZMQ::FFI.zosc_append(self_p, format, *args)
|
241
|
+
result
|
242
|
+
end
|
243
|
+
|
244
|
+
# Retrieve the values provided by the given format. Note that zosc_retr
|
245
|
+
# creates the objects and the caller must destroy them when finished.
|
246
|
+
# The supplied pointers do not need to be initialized. Returns 0 if
|
247
|
+
# successful, or -1 if it failed to retrieve a value in which case the
|
248
|
+
# pointers are not modified. If an argument pointer is NULL is skips the
|
249
|
+
# value. See the format method for a detailed list op type tags for the
|
250
|
+
# format string.
|
251
|
+
#
|
252
|
+
# @param format [String, #to_s, nil]
|
253
|
+
# @param args [Array<Object>] see https://github.com/ffi/ffi/wiki/examples#using-varargs
|
254
|
+
# @return [Integer]
|
255
|
+
def retr(format, *args)
|
256
|
+
raise DestroyedError unless @ptr
|
257
|
+
self_p = @ptr
|
258
|
+
result = ::CZMQ::FFI.zosc_retr(self_p, format, *args)
|
259
|
+
result
|
260
|
+
end
|
261
|
+
|
262
|
+
# Create copy of the message, as new chunk object. Returns a fresh zosc_t
|
263
|
+
# object, or null if there was not enough heap memory. If chunk is null,
|
264
|
+
# returns null.
|
265
|
+
#
|
266
|
+
# @return [Zosc]
|
267
|
+
def dup()
|
268
|
+
raise DestroyedError unless @ptr
|
269
|
+
self_p = @ptr
|
270
|
+
result = ::CZMQ::FFI.zosc_dup(self_p)
|
271
|
+
result = Zosc.__new result, true
|
272
|
+
result
|
273
|
+
end
|
274
|
+
|
275
|
+
# Transform zosc into a zframe that can be sent in a message.
|
276
|
+
#
|
277
|
+
# @return [Zframe]
|
278
|
+
def pack()
|
279
|
+
raise DestroyedError unless @ptr
|
280
|
+
self_p = @ptr
|
281
|
+
result = ::CZMQ::FFI.zosc_pack(self_p)
|
282
|
+
result = Zframe.__new result, true
|
283
|
+
result
|
284
|
+
end
|
285
|
+
|
286
|
+
# Transform zosc into a zframe that can be sent in a message.
|
287
|
+
# Take ownership of the chunk.
|
288
|
+
#
|
289
|
+
# @param self_p [#__ptr_give_ref]
|
290
|
+
# @return [Zframe]
|
291
|
+
def self.packx(self_p)
|
292
|
+
self_p = self_p.__ptr_give_ref
|
293
|
+
result = ::CZMQ::FFI.zosc_packx(self_p)
|
294
|
+
result = Zframe.__new result, true
|
295
|
+
result
|
296
|
+
end
|
297
|
+
|
298
|
+
# Transform a zframe into a zosc.
|
299
|
+
#
|
300
|
+
# @param frame [Zframe, #__ptr]
|
301
|
+
# @return [Zosc]
|
302
|
+
def self.unpack(frame)
|
303
|
+
frame = frame.__ptr if frame
|
304
|
+
result = ::CZMQ::FFI.zosc_unpack(frame)
|
305
|
+
result = Zosc.__new result, true
|
306
|
+
result
|
307
|
+
end
|
308
|
+
|
309
|
+
# Dump OSC message to stdout, for debugging and tracing.
|
310
|
+
#
|
311
|
+
# @return [void]
|
312
|
+
def print()
|
313
|
+
raise DestroyedError unless @ptr
|
314
|
+
self_p = @ptr
|
315
|
+
result = ::CZMQ::FFI.zosc_print(self_p)
|
316
|
+
result
|
317
|
+
end
|
318
|
+
|
319
|
+
# Probe the supplied object, and report if it looks like a zosc_t.
|
320
|
+
#
|
321
|
+
# @param self_ [::FFI::Pointer, #to_ptr]
|
322
|
+
# @return [Boolean]
|
323
|
+
def self.is(self_)
|
324
|
+
result = ::CZMQ::FFI.zosc_is(self_)
|
325
|
+
result
|
326
|
+
end
|
327
|
+
|
328
|
+
# Return a pointer to the item at the head of the OSC data.
|
329
|
+
# Sets the given char argument to the type tag of the data.
|
330
|
+
# If the message is empty, returns NULL and the sets the
|
331
|
+
# given char to NULL.
|
332
|
+
#
|
333
|
+
# @param type [::FFI::Pointer, #to_ptr]
|
334
|
+
# @return [::FFI::Pointer]
|
335
|
+
def first(type)
|
336
|
+
raise DestroyedError unless @ptr
|
337
|
+
self_p = @ptr
|
338
|
+
result = ::CZMQ::FFI.zosc_first(self_p, type)
|
339
|
+
result
|
340
|
+
end
|
341
|
+
|
342
|
+
# Return the next item of the OSC message. If the list is empty, returns
|
343
|
+
# NULL. To move to the start of the OSC message call zosc_first ().
|
344
|
+
#
|
345
|
+
# @param type [::FFI::Pointer, #to_ptr]
|
346
|
+
# @return [::FFI::Pointer]
|
347
|
+
def next(type)
|
348
|
+
raise DestroyedError unless @ptr
|
349
|
+
self_p = @ptr
|
350
|
+
result = ::CZMQ::FFI.zosc_next(self_p, type)
|
351
|
+
result
|
352
|
+
end
|
353
|
+
|
354
|
+
# Return a pointer to the item at the tail of the OSC message.
|
355
|
+
# Sets the given char argument to the type tag of the data. If
|
356
|
+
# the message is empty, returns NULL.
|
357
|
+
#
|
358
|
+
# @param type [::FFI::Pointer, #to_ptr]
|
359
|
+
# @return [::FFI::Pointer]
|
360
|
+
def last(type)
|
361
|
+
raise DestroyedError unless @ptr
|
362
|
+
self_p = @ptr
|
363
|
+
result = ::CZMQ::FFI.zosc_last(self_p, type)
|
364
|
+
result
|
365
|
+
end
|
366
|
+
|
367
|
+
# Set the provided 32 bit integer from value at the current cursor position in the message.
|
368
|
+
# If the type tag at the current position does not correspond it will fail and
|
369
|
+
# return -1. Returns 0 on success.
|
370
|
+
#
|
371
|
+
# @param val [::FFI::Pointer, #to_ptr]
|
372
|
+
# @return [Integer]
|
373
|
+
def pop_int32(val)
|
374
|
+
raise DestroyedError unless @ptr
|
375
|
+
self_p = @ptr
|
376
|
+
result = ::CZMQ::FFI.zosc_pop_int32(self_p, val)
|
377
|
+
result
|
378
|
+
end
|
379
|
+
|
380
|
+
# Set the provided 64 bit integer from the value at the current cursor position in the message.
|
381
|
+
# If the type tag at the current position does not correspond it will fail and
|
382
|
+
# return -1. Returns 0 on success.
|
383
|
+
#
|
384
|
+
# @param val [::FFI::Pointer, #to_ptr]
|
385
|
+
# @return [Integer]
|
386
|
+
def pop_int64(val)
|
387
|
+
raise DestroyedError unless @ptr
|
388
|
+
self_p = @ptr
|
389
|
+
result = ::CZMQ::FFI.zosc_pop_int64(self_p, val)
|
390
|
+
result
|
391
|
+
end
|
392
|
+
|
393
|
+
# Set the provided float from the value at the current cursor position in the message.
|
394
|
+
# If the type tag at the current position does not correspond it will fail and
|
395
|
+
# return -1. Returns 0 on success.
|
396
|
+
#
|
397
|
+
# @param val [::FFI::Pointer, #to_ptr]
|
398
|
+
# @return [Integer]
|
399
|
+
def pop_float(val)
|
400
|
+
raise DestroyedError unless @ptr
|
401
|
+
self_p = @ptr
|
402
|
+
result = ::CZMQ::FFI.zosc_pop_float(self_p, val)
|
403
|
+
result
|
404
|
+
end
|
405
|
+
|
406
|
+
# Set the provided double from the value at the current cursor position in the message.
|
407
|
+
# If the type tag at the current position does not correspond it will fail and
|
408
|
+
# return -1. Returns 0 on success.
|
409
|
+
#
|
410
|
+
# @param val [::FFI::Pointer, #to_ptr]
|
411
|
+
# @return [Integer]
|
412
|
+
def pop_double(val)
|
413
|
+
raise DestroyedError unless @ptr
|
414
|
+
self_p = @ptr
|
415
|
+
result = ::CZMQ::FFI.zosc_pop_double(self_p, val)
|
416
|
+
result
|
417
|
+
end
|
418
|
+
|
419
|
+
# Set the provided string from the value at the current cursor position in the message.
|
420
|
+
# If the type tag at the current position does not correspond it will fail and
|
421
|
+
# return -1. Returns 0 on success. Caller owns the string!
|
422
|
+
#
|
423
|
+
# @param val [::FFI::Pointer, #to_ptr]
|
424
|
+
# @return [Integer]
|
425
|
+
def pop_string(val)
|
426
|
+
raise DestroyedError unless @ptr
|
427
|
+
self_p = @ptr
|
428
|
+
result = ::CZMQ::FFI.zosc_pop_string(self_p, val)
|
429
|
+
result
|
430
|
+
end
|
431
|
+
|
432
|
+
# Set the provided char from the value at the current cursor position in the message.
|
433
|
+
# If the type tag at the current position does not correspond it will fail and
|
434
|
+
# return -1. Returns 0 on success.
|
435
|
+
#
|
436
|
+
# @param val [::FFI::Pointer, #to_ptr]
|
437
|
+
# @return [Integer]
|
438
|
+
def pop_char(val)
|
439
|
+
raise DestroyedError unless @ptr
|
440
|
+
self_p = @ptr
|
441
|
+
result = ::CZMQ::FFI.zosc_pop_char(self_p, val)
|
442
|
+
result
|
443
|
+
end
|
444
|
+
|
445
|
+
# Set the provided boolean from the type tag in the message. Booleans are not represented
|
446
|
+
# in the data in the message, only in the type tag. If the type tag at the current
|
447
|
+
# position does not correspond it will fail and return -1. Returns 0 on success.
|
448
|
+
#
|
449
|
+
# @param val [::FFI::Pointer, #to_ptr]
|
450
|
+
# @return [Integer]
|
451
|
+
def pop_bool(val)
|
452
|
+
raise DestroyedError unless @ptr
|
453
|
+
self_p = @ptr
|
454
|
+
result = ::CZMQ::FFI.zosc_pop_bool(self_p, val)
|
455
|
+
result
|
456
|
+
end
|
457
|
+
|
458
|
+
# Set the provided 4 bytes (unsigned 32bit int) from the value at the current
|
459
|
+
# cursor position in the message. If the type tag at the current position does
|
460
|
+
# not correspond it will fail and return -1. Returns 0 on success.
|
461
|
+
#
|
462
|
+
# @param val [::FFI::Pointer, #to_ptr]
|
463
|
+
# @return [Integer]
|
464
|
+
def pop_midi(val)
|
465
|
+
raise DestroyedError unless @ptr
|
466
|
+
self_p = @ptr
|
467
|
+
result = ::CZMQ::FFI.zosc_pop_midi(self_p, val)
|
468
|
+
result
|
469
|
+
end
|
470
|
+
|
471
|
+
# Self test of this class.
|
472
|
+
#
|
473
|
+
# @param verbose [Boolean]
|
474
|
+
# @return [void]
|
475
|
+
def self.test(verbose)
|
476
|
+
verbose = !(0==verbose||!verbose) # boolean
|
477
|
+
result = ::CZMQ::FFI.zosc_test(verbose)
|
478
|
+
result
|
479
|
+
end
|
480
|
+
end
|
481
|
+
end
|
482
|
+
end
|
483
|
+
|
484
|
+
################################################################################
|
485
|
+
# THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY #
|
486
|
+
# Read the zproject/README.md for information about making permanent changes. #
|
487
|
+
################################################################################
|