slow_blink 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +9 -0
- data/ext/slow_blink/ext_schema_parser/parser.c +4 -4
- data/ext/slow_blink/message/ext_compact_encoder/compact_encoder.c +5 -5
- data/ext/slow_blink/message/ext_compact_encoder/ext_compact_encoder.c +31 -18
- data/lib/slow_blink/annotatable.rb +20 -17
- data/lib/slow_blink/annotation.rb +20 -18
- data/lib/slow_blink/binary.rb +20 -17
- data/lib/slow_blink/boolean.rb +20 -17
- data/lib/slow_blink/date.rb +20 -17
- data/lib/slow_blink/decimal.rb +20 -17
- data/lib/slow_blink/definition.rb +21 -19
- data/lib/slow_blink/enumeration.rb +30 -26
- data/lib/slow_blink/field.rb +20 -17
- data/lib/slow_blink/fixed.rb +20 -17
- data/lib/slow_blink/floating_point.rb +20 -17
- data/lib/slow_blink/group.rb +21 -18
- data/lib/slow_blink/incremental_annotation.rb +21 -18
- data/lib/slow_blink/integer.rb +20 -17
- data/lib/slow_blink/log.rb +20 -17
- data/lib/slow_blink/message/binary.rb +23 -18
- data/lib/slow_blink/message/boolean.rb +22 -17
- data/lib/slow_blink/message/date.rb +23 -18
- data/lib/slow_blink/message/decimal.rb +38 -21
- data/lib/slow_blink/message/enumeration.rb +31 -21
- data/lib/slow_blink/message/field.rb +23 -18
- data/lib/slow_blink/message/fixed.rb +23 -19
- data/lib/slow_blink/message/floating_point.rb +22 -17
- data/lib/slow_blink/message/group.rb +90 -55
- data/lib/slow_blink/message/integer.rb +51 -24
- data/lib/slow_blink/message/model.rb +197 -131
- data/lib/slow_blink/message/sequence.rb +31 -25
- data/lib/slow_blink/message/string.rb +23 -18
- data/lib/slow_blink/message/time.rb +31 -25
- data/lib/slow_blink/message/time_of_day.rb +24 -18
- data/lib/slow_blink/name_with_id.rb +20 -17
- data/lib/slow_blink/namespace.rb +22 -19
- data/lib/slow_blink/object.rb +20 -17
- data/lib/slow_blink/parse_error.rb +26 -0
- data/lib/slow_blink/ref.rb +20 -17
- data/lib/slow_blink/schema.rb +26 -24
- data/lib/slow_blink/schema_buffer.rb +20 -17
- data/lib/slow_blink/sequence.rb +20 -17
- data/lib/slow_blink/string.rb +20 -17
- data/lib/slow_blink/sym.rb +20 -17
- data/lib/slow_blink/time.rb +20 -17
- data/lib/slow_blink/time_of_day.rb +20 -17
- data/lib/slow_blink/type.rb +20 -17
- data/lib/slow_blink/version.rb +21 -18
- data/lib/slow_blink.rb +19 -17
- data/test/tc_compact_encoder.rb +64 -30
- data/test/tc_group.rb +0 -19
- data/test/tc_incr_annote.rb +0 -21
- data/test/tc_model_decimal.rb +94 -0
- data/test/tc_model_dynamic_group.rb +0 -19
- data/test/tc_model_extension.rb +0 -19
- data/test/tc_model_sequence_of_string.rb +29 -0
- data/test/tc_model_static_group.rb +0 -19
- data/test/tc_model_think_blink.rb +0 -19
- data/test/tc_types.rb +0 -19
- metadata +8 -4
- data/lib/slow_blink/compact_encoder.rb +0 -72
- data/lib/slow_blink/error.rb +0 -23
@@ -1,42 +1,50 @@
|
|
1
|
-
#
|
1
|
+
# @license
|
2
|
+
#
|
3
|
+
# Copyright (c) 2016 Cameron Harper
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
# this software and associated documentation files (the "Software"), to deal in
|
7
|
+
# the Software without restriction, including without limitation the rights to
|
8
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
# subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
2
14
|
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in all
|
11
|
-
# copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
15
|
-
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
16
|
-
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
17
|
-
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
18
|
-
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
19
21
|
|
20
22
|
module SlowBlink::Message
|
21
23
|
|
24
|
+
# @abstract
|
25
|
+
#
|
22
26
|
# A Group may form a complete message or be nested as a {DynamicGroup}
|
23
27
|
class Group
|
24
28
|
|
29
|
+
# @private
|
25
30
|
# @return [Hash<Field>] group fields
|
26
31
|
def self.fields
|
27
32
|
@fields
|
28
33
|
end
|
29
34
|
|
35
|
+
# @api user
|
30
36
|
# @return [Integer,nil] group identifier
|
31
37
|
def self.id
|
32
38
|
@id
|
33
39
|
end
|
34
40
|
|
41
|
+
# @api user
|
35
42
|
# @return [String] name of group
|
36
43
|
def self.name
|
37
44
|
@name
|
38
45
|
end
|
39
46
|
|
47
|
+
# @private
|
40
48
|
# @param input [String] Blink compact form
|
41
49
|
# @param stack [Array] used to measure depth of recursion
|
42
50
|
# @return [Group, nil]
|
@@ -49,7 +57,7 @@ module SlowBlink::Message
|
|
49
57
|
if stack.size < @maxRecursion
|
50
58
|
stack << self
|
51
59
|
else
|
52
|
-
raise
|
60
|
+
raise RecursionLimit
|
53
61
|
end
|
54
62
|
|
55
63
|
@fields.each do |fn, fd|
|
@@ -57,14 +65,18 @@ module SlowBlink::Message
|
|
57
65
|
end
|
58
66
|
|
59
67
|
if input.size > 0
|
60
|
-
expected = input.getU32!
|
61
|
-
|
62
|
-
extensions
|
68
|
+
expected = input.getU32!
|
69
|
+
if expected
|
70
|
+
while extensions.size != expected do
|
71
|
+
extensions << @extensionObject.from_compact!(input, stack)
|
72
|
+
end
|
73
|
+
else
|
74
|
+
raise ExtensionPadding
|
63
75
|
end
|
64
76
|
end
|
65
77
|
|
66
78
|
if input.size != 0
|
67
|
-
raise
|
79
|
+
raise ExtensionPadding
|
68
80
|
end
|
69
81
|
|
70
82
|
group = self.new(fields)
|
@@ -79,10 +91,12 @@ module SlowBlink::Message
|
|
79
91
|
|
80
92
|
end
|
81
93
|
|
82
|
-
# @
|
94
|
+
# @api user
|
95
|
+
# @return [Array<Group>] extension objects
|
83
96
|
attr_reader :extension
|
84
97
|
|
85
|
-
#
|
98
|
+
# @api user
|
99
|
+
# Finds Field by name and calls {Field#set}(value)
|
86
100
|
#
|
87
101
|
# @param name [String] name of field
|
88
102
|
# @param value [Object]
|
@@ -90,13 +104,14 @@ module SlowBlink::Message
|
|
90
104
|
def []=(name, value)
|
91
105
|
if @value[name]
|
92
106
|
@value[name].set(value)
|
93
|
-
self
|
94
107
|
else
|
95
108
|
raise IndexError.new "field #{name} is not defined in this group"
|
96
109
|
end
|
110
|
+
self
|
97
111
|
end
|
98
112
|
|
99
|
-
#
|
113
|
+
# @api user
|
114
|
+
# Finds Field by name and calls {Field#get}
|
100
115
|
#
|
101
116
|
# @param name [String] name of field
|
102
117
|
# @return [Object]
|
@@ -110,27 +125,18 @@ module SlowBlink::Message
|
|
110
125
|
end
|
111
126
|
|
112
127
|
# Get this group
|
113
|
-
# @return [
|
128
|
+
# @return [self]
|
114
129
|
def get
|
115
130
|
self
|
116
131
|
end
|
117
132
|
|
118
|
-
# Get the value hash directly
|
119
|
-
# @return [Hash]
|
120
|
-
def fields
|
121
|
-
@value
|
122
|
-
end
|
123
|
-
|
124
133
|
# Set the contents of this group
|
125
134
|
#
|
126
|
-
#
|
127
|
-
#
|
128
|
-
#
|
129
|
-
#
|
130
|
-
#
|
131
|
-
# Second option is a {Group} where #{Group#fields} will be used in the same manner as the first option.
|
132
|
-
#
|
133
|
-
# @param value [Hash, Group] fields to set
|
135
|
+
# @overload set(value)
|
136
|
+
# @param value [Hash{String=>Field,Numeric,String,Time,nil}] Hash of {Field} objects or literal values
|
137
|
+
# @overload set(value)
|
138
|
+
# @param value [Group] a Hash of {Field} objects will be extracted from a Group object by calling {Group#fields}
|
139
|
+
# @return [self]
|
134
140
|
# @raise [IndexError, TypeError]
|
135
141
|
def set(value)
|
136
142
|
if value.kind_of? Hash
|
@@ -153,11 +159,14 @@ module SlowBlink::Message
|
|
153
159
|
else
|
154
160
|
raise TypeError.new "expecting a Hash or a StaticGroup instance"
|
155
161
|
end
|
162
|
+
self
|
156
163
|
end
|
157
164
|
|
165
|
+
# @api user
|
158
166
|
# Create a Group
|
159
167
|
#
|
160
|
-
# @
|
168
|
+
# @note calls {#set}(fields)
|
169
|
+
# @param fields [Hash]
|
161
170
|
def initialize(fields={})
|
162
171
|
@extension = []
|
163
172
|
@fields = self.class.fields
|
@@ -167,15 +176,17 @@ module SlowBlink::Message
|
|
167
176
|
end
|
168
177
|
set(fields)
|
169
178
|
end
|
170
|
-
|
179
|
+
|
180
|
+
# @return [String] Blink Protocol compact form
|
171
181
|
def encode_compact
|
172
182
|
if self.class.id
|
173
183
|
to_compact("")
|
174
184
|
else
|
175
|
-
raise
|
185
|
+
raise UntaggedGroup.new "cannot encode a group without an ID"
|
176
186
|
end
|
177
187
|
end
|
178
188
|
|
189
|
+
# @private
|
179
190
|
def to_compact(out)
|
180
191
|
group = "".putU64(self.class.id)
|
181
192
|
@value.each do |fn, fv|
|
@@ -187,7 +198,7 @@ module SlowBlink::Message
|
|
187
198
|
#if e.is_a? @extensionObject
|
188
199
|
e.to_compact(group)
|
189
200
|
#else
|
190
|
-
# raise
|
201
|
+
# raise EncodingError.new "cannot convert unknown extension object to compact form"
|
191
202
|
#end
|
192
203
|
end
|
193
204
|
end
|
@@ -195,18 +206,31 @@ module SlowBlink::Message
|
|
195
206
|
out << group
|
196
207
|
end
|
197
208
|
|
209
|
+
protected
|
210
|
+
|
211
|
+
# Get the value hash directly
|
212
|
+
# @return [Hash{String => Field}]
|
213
|
+
def fields
|
214
|
+
@value
|
215
|
+
end
|
216
|
+
|
198
217
|
end
|
199
218
|
|
219
|
+
# @abstract
|
220
|
+
#
|
200
221
|
# A StaticGroup is a kind of {Group} that can only exist as the contents of a {Field}
|
201
222
|
class StaticGroup < Group
|
202
223
|
|
224
|
+
# @private
|
225
|
+
#
|
203
226
|
# @note optionality affects how instances of this type are encoded
|
204
227
|
#
|
205
228
|
# @return [true,false] is optional
|
206
229
|
def self.opt?
|
207
230
|
@opt
|
208
231
|
end
|
209
|
-
|
232
|
+
|
233
|
+
# @private
|
210
234
|
# @param input [String] Blink compact form
|
211
235
|
# @param stack [Array] used to measure depth of recursion
|
212
236
|
# @return [Group, nil]
|
@@ -216,7 +240,7 @@ module SlowBlink::Message
|
|
216
240
|
if stack.size < @maxRecursion
|
217
241
|
stack << self
|
218
242
|
else
|
219
|
-
raise
|
243
|
+
raise RecursionLimit
|
220
244
|
end
|
221
245
|
|
222
246
|
if @opt
|
@@ -239,12 +263,13 @@ module SlowBlink::Message
|
|
239
263
|
|
240
264
|
end
|
241
265
|
|
242
|
-
# @note
|
266
|
+
# @note StaticGroup does not have extensions
|
243
267
|
# @raise [NoMethodError]
|
244
268
|
def extension
|
245
|
-
raise NoMethodError.new "
|
269
|
+
raise NoMethodError.new "StaticGroup does not implement #{__method__}"
|
246
270
|
end
|
247
271
|
|
272
|
+
# @private
|
248
273
|
def to_compact(out)
|
249
274
|
if self.class.opt?
|
250
275
|
out.putPresent
|
@@ -255,8 +280,16 @@ module SlowBlink::Message
|
|
255
280
|
out
|
256
281
|
end
|
257
282
|
|
283
|
+
# @note StaticGroup cannot be encoded as a top level message
|
284
|
+
# @raise [NoMethodError]
|
285
|
+
def encode_compact
|
286
|
+
raise NoMethodError.new "StaticGroup does not inmplement #{__method__}"
|
287
|
+
end
|
288
|
+
|
258
289
|
end
|
259
290
|
|
291
|
+
# @abstract
|
292
|
+
#
|
260
293
|
# A DynamicGroup has a {Group} which has a {Group.id} that appears in {DynamicGroup.permitted} list
|
261
294
|
class DynamicGroup
|
262
295
|
|
@@ -275,6 +308,7 @@ module SlowBlink::Message
|
|
275
308
|
@permitted
|
276
309
|
end
|
277
310
|
|
311
|
+
# @private
|
278
312
|
# @param input [String] Blink compact form
|
279
313
|
# @param stack [Array] used to measure depth of recursion
|
280
314
|
# @return [Group, nil]
|
@@ -284,7 +318,7 @@ module SlowBlink::Message
|
|
284
318
|
if stack.size < @maxRecursion
|
285
319
|
stack << self
|
286
320
|
else
|
287
|
-
raise
|
321
|
+
raise RecursionLimit
|
288
322
|
end
|
289
323
|
|
290
324
|
buf = input.getBinary!
|
@@ -295,13 +329,13 @@ module SlowBlink::Message
|
|
295
329
|
if @permitted.include? group.id
|
296
330
|
result = self.new(group.from_compact!(buf, stack))
|
297
331
|
else
|
298
|
-
raise
|
332
|
+
raise WeakError15.new "W15: Group is known but unexpected"
|
299
333
|
end
|
300
334
|
else
|
301
|
-
raise
|
335
|
+
raise WeakError2.new "W2: Group id #{group.id} is unknown"
|
302
336
|
end
|
303
337
|
else
|
304
|
-
raise
|
338
|
+
raise WeakError5.new "W5: Value cannot be null"
|
305
339
|
end
|
306
340
|
|
307
341
|
stack.pop
|
@@ -316,7 +350,7 @@ module SlowBlink::Message
|
|
316
350
|
if self.class.permitted.include? value.class.id
|
317
351
|
@value = value
|
318
352
|
else
|
319
|
-
raise "group
|
353
|
+
raise TypeError.new "group is known but compatible with schema"
|
320
354
|
end
|
321
355
|
# native values
|
322
356
|
elsif value.kind_of? Hash
|
@@ -337,11 +371,12 @@ module SlowBlink::Message
|
|
337
371
|
@value.extension
|
338
372
|
end
|
339
373
|
|
340
|
-
# @
|
374
|
+
# @note calls {#set}(value)
|
341
375
|
def initialize(value)
|
342
376
|
set(value)
|
343
377
|
end
|
344
378
|
|
379
|
+
# @private
|
345
380
|
def to_compact(out)
|
346
381
|
@value.to_compact(out)
|
347
382
|
end
|
@@ -1,24 +1,27 @@
|
|
1
|
-
#
|
1
|
+
# @license
|
2
|
+
#
|
3
|
+
# Copyright (c) 2016 Cameron Harper
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
# this software and associated documentation files (the "Software"), to deal in
|
7
|
+
# the Software without restriction, including without limitation the rights to
|
8
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
# subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
2
14
|
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
# The above copyright notice and this permission notice shall be included in all
|
11
|
-
# copies or substantial portions of the Software.
|
12
|
-
#
|
13
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
15
|
-
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
16
|
-
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
17
|
-
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
18
|
-
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
19
21
|
|
20
22
|
module SlowBlink::Message
|
21
23
|
|
24
|
+
# @abstract
|
22
25
|
class INTEGER
|
23
26
|
|
24
27
|
# @param value [Integer]
|
@@ -55,8 +58,10 @@ module SlowBlink::Message
|
|
55
58
|
|
56
59
|
end
|
57
60
|
|
61
|
+
# @abstract
|
58
62
|
class U8 < INTEGER
|
59
63
|
|
64
|
+
# @private
|
60
65
|
def self.from_compact!(input, stack)
|
61
66
|
value = input.getU8!
|
62
67
|
if value
|
@@ -66,14 +71,17 @@ module SlowBlink::Message
|
|
66
71
|
end
|
67
72
|
end
|
68
73
|
|
74
|
+
# @private
|
69
75
|
def to_compact(out)
|
70
76
|
out.putU8(@value)
|
71
77
|
end
|
72
78
|
|
73
79
|
end
|
74
80
|
|
81
|
+
# @abstract
|
75
82
|
class U16 < INTEGER
|
76
83
|
|
84
|
+
# @private
|
77
85
|
def self.from_compact!(input, stack)
|
78
86
|
value = input.getU16!
|
79
87
|
if value
|
@@ -82,15 +90,18 @@ module SlowBlink::Message
|
|
82
90
|
value
|
83
91
|
end
|
84
92
|
end
|
85
|
-
|
93
|
+
|
94
|
+
# @private
|
86
95
|
def to_compact(out)
|
87
96
|
out.putU16(@value)
|
88
97
|
end
|
89
98
|
|
90
99
|
end
|
91
100
|
|
101
|
+
# @abstract
|
92
102
|
class U32 < INTEGER
|
93
103
|
|
104
|
+
# @private
|
94
105
|
def self.from_compact!(input, stack)
|
95
106
|
value = input.getU32!
|
96
107
|
if value
|
@@ -100,14 +111,17 @@ module SlowBlink::Message
|
|
100
111
|
end
|
101
112
|
end
|
102
113
|
|
114
|
+
# @private
|
103
115
|
def to_compact(out)
|
104
116
|
out.putU32(@value)
|
105
117
|
end
|
106
118
|
|
107
119
|
end
|
108
120
|
|
121
|
+
# @abstract
|
109
122
|
class U64 < INTEGER
|
110
123
|
|
124
|
+
# @private
|
111
125
|
def self.from_compact!(input, stack)
|
112
126
|
value = input.getU64!
|
113
127
|
if value
|
@@ -116,15 +130,18 @@ module SlowBlink::Message
|
|
116
130
|
value
|
117
131
|
end
|
118
132
|
end
|
119
|
-
|
133
|
+
|
134
|
+
# @private
|
120
135
|
def to_compact(out)
|
121
136
|
out.putU64(@value)
|
122
137
|
end
|
123
138
|
|
124
139
|
end
|
125
140
|
|
141
|
+
# @abstract
|
126
142
|
class I8 < INTEGER
|
127
143
|
|
144
|
+
# @private
|
128
145
|
def self.from_compact!(input, stack)
|
129
146
|
value = input.getI8!
|
130
147
|
if value
|
@@ -133,15 +150,18 @@ module SlowBlink::Message
|
|
133
150
|
value
|
134
151
|
end
|
135
152
|
end
|
136
|
-
|
153
|
+
|
154
|
+
# @private
|
137
155
|
def to_compact(out)
|
138
156
|
out.putI8(@value)
|
139
157
|
end
|
140
158
|
|
141
159
|
end
|
142
160
|
|
161
|
+
# @abstract
|
143
162
|
class I16 < INTEGER
|
144
|
-
|
163
|
+
|
164
|
+
# @private
|
145
165
|
def self.from_compact!(input, stack)
|
146
166
|
value = input.getI16!
|
147
167
|
if value
|
@@ -150,15 +170,18 @@ module SlowBlink::Message
|
|
150
170
|
value
|
151
171
|
end
|
152
172
|
end
|
153
|
-
|
173
|
+
|
174
|
+
# @private
|
154
175
|
def to_compact(out)
|
155
176
|
out.putI16(@value)
|
156
177
|
end
|
157
178
|
|
158
179
|
end
|
159
180
|
|
181
|
+
# @abstract
|
160
182
|
class I32 < INTEGER
|
161
183
|
|
184
|
+
# @private
|
162
185
|
def self.from_compact!(input, stack)
|
163
186
|
value = input.getI32!
|
164
187
|
if value
|
@@ -167,15 +190,18 @@ module SlowBlink::Message
|
|
167
190
|
value
|
168
191
|
end
|
169
192
|
end
|
170
|
-
|
193
|
+
|
194
|
+
# @private
|
171
195
|
def to_compact(out)
|
172
196
|
out.putI32(@value)
|
173
197
|
end
|
174
198
|
|
175
199
|
end
|
176
200
|
|
201
|
+
# @abstract
|
177
202
|
class I64 < INTEGER
|
178
203
|
|
204
|
+
# @private
|
179
205
|
def self.from_compact!(input, stack)
|
180
206
|
value = input.getI64!
|
181
207
|
if value
|
@@ -184,7 +210,8 @@ module SlowBlink::Message
|
|
184
210
|
value
|
185
211
|
end
|
186
212
|
end
|
187
|
-
|
213
|
+
|
214
|
+
# @private
|
188
215
|
def to_compact(out)
|
189
216
|
out.putI64(@value)
|
190
217
|
end
|