sparsam 0.2.3 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,4 @@
1
1
  #ifndef __SERIALIZER_H__
2
- #include <ruby.h>
3
- #include <ruby/intern.h>
4
2
  #ifndef NUM2SHORT
5
3
  #define NUM2SHORT NUM2INT
6
4
  #endif
@@ -20,12 +18,13 @@ enum TOType {
20
18
 
21
19
  enum ValidateStrictness { normal = 0, strict = 1, recursive = 2 };
22
20
 
23
- void serializer_free(void *data);
24
- void *serializer_create();
25
- void serializer_init(void *serializer, int protocol, void *str_arg1,
21
+ void serializer_free(void* data);
22
+ void* serializer_create();
23
+ void serializer_init(void* serializer, int protocol, void* str_arg1,
26
24
  uint32_t len);
27
25
 
28
26
  VALUE serializer_readStruct(VALUE self, VALUE klass);
27
+ VALUE serializer_readUnion(VALUE self, VALUE klass);
29
28
  VALUE serializer_writeStruct(VALUE self, VALUE klass, VALUE data);
30
29
 
31
30
  VALUE cache_fields(VALUE self, VALUE klass);
@@ -37,18 +36,36 @@ void initialize_constants();
37
36
  void initialize_runtime_constants();
38
37
 
39
38
  #ifdef __cplusplus
40
- } // end extern "C"
39
+ } // end extern "C"
41
40
 
41
+ #include <thrift/protocol/TProtocol.h>
42
+ #include <thrift/transport/TBufferTransports.h>
42
43
  #include <boost/shared_ptr.hpp>
43
44
  #include <map>
44
45
  #include <string>
45
- #include <thrift/protocol/TProtocol.h>
46
- #include <thrift/transport/TBufferTransports.h>
47
46
  #include <unordered_set>
48
47
  #include "third-party/sparsepp/sparsepp/spp.h"
49
48
 
50
49
  using ::apache::thrift::protocol::TType;
51
50
 
51
+ // transposed from:
52
+ // https://github.com/apache/thrift/blob/0.10.0/lib/cpp/src/thrift/protocol/TProtocol.h#L176
53
+ // with: https://gist.github.com/andyfangdz/d4d52daa9f8a75223e76e92657036bb0
54
+ // fun fact: it's not sorted there
55
+ const std::string TTypeNames[] = {
56
+ "T_STOP", "T_VOID", "T_BOOL", "T_BYTE or T_I08",
57
+ "T_DOUBLE", "T_UNKNOWN", "T_I16", "T_UNKNOWN",
58
+ "T_I32", "T_U64", "T_I64", "T_STRING or T_UTF7",
59
+ "T_STRUCT", "T_MAP", "T_SET", "T_LIST",
60
+ "T_UTF8", "T_UTF16"};
61
+
62
+ const size_t TTypeMaxID = sizeof(TTypeNames) / sizeof(TTypeNames[0]);
63
+
64
+ const std::string TTypeUnknown = "T_UNKNOWN";
65
+
66
+ #define TTypeName(typeId) \
67
+ (typeId < TTypeMaxID ? TTypeNames[typeId] : TTypeUnknown)
68
+
52
69
  typedef uint16_t FieldIdIndex;
53
70
  typedef uint16_t KlassIndex;
54
71
 
@@ -61,38 +78,41 @@ typedef struct FieldBegin {
61
78
 
62
79
  typedef struct FieldInfo {
63
80
  TType ftype;
64
- VALUE klass; // set if TTYPE is struct or union
65
- ID ivarName; // set if field is on struct
66
- VALUE symName; // set if field is on struct/union
81
+ VALUE klass; // set if TTYPE is struct or union
82
+ ID ivarName; // set if field is on struct
83
+ VALUE symName; // set if field is on struct/union
67
84
  bool isOptional;
68
85
  bool isBinaryString;
69
- FieldInfo *elementType; // element of list or set, or map
70
- FieldInfo *keyType; // type of key in maps
86
+ FieldInfo* elementType; // element of list or set, or map
87
+ FieldInfo* keyType; // type of key in maps
71
88
  } FieldInfo;
72
89
 
73
- typedef std::map<FieldID, FieldInfo *> FieldInfoMap;
74
- typedef spp::sparse_hash_map<VALUE, FieldInfoMap *> KlassFieldsCache;
90
+ typedef std::map<FieldID, FieldInfo*> FieldInfoMap;
91
+ typedef spp::sparse_hash_map<VALUE, FieldInfoMap*> KlassFieldsCache;
75
92
 
76
93
  class ThriftSerializer {
77
- public:
94
+ public:
78
95
  ThriftSerializer(){};
96
+ // clang-format off
79
97
  boost::shared_ptr< ::apache::thrift::protocol::TProtocol > tprot;
80
98
  boost::shared_ptr< ::apache::thrift::transport::TMemoryBuffer > tmb;
99
+ // clang-format on
81
100
 
82
101
  VALUE readStruct(VALUE klass);
102
+ VALUE readUnion(VALUE klass);
83
103
  void writeStruct(VALUE klass, VALUE data);
84
104
 
85
- private:
86
- VALUE readUnion(VALUE klass);
87
- VALUE readAny(TType ttype, FieldInfo *field_info);
88
- void writeAny(TType ttype, FieldInfo *field_info, VALUE data, VALUE outer_struct, VALUE field_sym);
105
+ private:
106
+ VALUE readAny(TType ttype, FieldInfo* field_info);
107
+ void writeAny(TType ttype, FieldInfo* field_info, VALUE data,
108
+ VALUE outer_struct, VALUE field_sym);
89
109
  void skip_n_type(uint32_t n, TType ttype);
90
110
  void skip_n_pair(uint32_t n, TType type_a, TType type_b);
91
111
  };
92
112
 
93
- FieldInfoMap *FindOrCreateFieldInfoMap(VALUE klass);
94
- FieldInfo *CreateFieldInfo(VALUE field_map_entry);
95
- FieldInfoMap *CreateFieldInfoMap(VALUE klass);
113
+ FieldInfoMap* FindOrCreateFieldInfoMap(VALUE klass);
114
+ FieldInfo* CreateFieldInfo(VALUE field_map_entry);
115
+ FieldInfoMap* CreateFieldInfoMap(VALUE klass);
96
116
 
97
117
  #endif
98
118
  #endif
@@ -2,7 +2,11 @@ module Sparsam
2
2
  module Deserializer
3
3
  def self.deserialize(klass, serialized_string, prot = Sparsam::CompactProtocol)
4
4
  s = Sparsam::Serializer.new(prot, serialized_string)
5
- s.deserialize(klass)
5
+ if klass <= Sparsam::Union
6
+ s.deserializeUnion(klass)
7
+ else
8
+ s.deserialize(klass)
9
+ end
6
10
  end
7
11
  end
8
12
  end
@@ -16,6 +16,8 @@ module Sparsam
16
16
  reader = name_to_accessors(info[:name]).reader
17
17
  return false unless send(reader) == other.send(reader)
18
18
  end
19
+
20
+ true
19
21
  end
20
22
  alias_method :eql?, :==
21
23
  end
@@ -13,15 +13,51 @@ module Magic
13
13
  Blue = 3
14
14
  Green = 4
15
15
  VALUE_MAP = {0 => "Black", 1 => "White", 2 => "Red", 3 => "Blue", 4 => "Green"}
16
+ INVERTED_VALUE_MAP = {"Black" => 0, "White" => 1, "Red" => 2, "Blue" => 3, "Green" => 4}
16
17
  VALID_VALUES = Set.new([Black, White, Red, Blue, Green]).freeze
17
18
  end
18
19
 
19
20
  class US < ::Sparsam::Struct
20
21
  FIELDS = {
21
- 1 => {:type => ::Sparsam::Types::I32, :name => 'id_i32', :optional => true},
22
- 2 => {:type => ::Sparsam::Types::STRING, :name => 'id_s', :default => %q"id_s default", :binary => true, :optional => true},
23
- 3 => {:type => ::Sparsam::Types::SET, :name => 'string_set', :element => {:type => ::Sparsam::Types::STRING}, :optional => true},
24
- 4 => {:type => ::Sparsam::Types::SET, :name => 'int_set', :element => {:type => ::Sparsam::Types::I32}, :optional => true}
22
+ 1 => {
23
+ :type => ::Sparsam::Types::I32,
24
+ :name => 'id_i32',
25
+ :optional => true,
26
+ :annotations => {
27
+ },
28
+ },
29
+ 2 => {
30
+ :type => ::Sparsam::Types::STRING,
31
+ :name => 'id_s',
32
+ :default => %q"id_s default",
33
+ :binary => true,
34
+ :optional => true,
35
+ :annotations => {
36
+ },
37
+ },
38
+ 3 => {
39
+ :type => ::Sparsam::Types::SET,
40
+ :name => 'string_set',
41
+ :element => {
42
+ :type => ::Sparsam::Types::STRING,
43
+ },
44
+ :optional => true,
45
+ :annotations => {
46
+ },
47
+ },
48
+ 4 => {
49
+ :type => ::Sparsam::Types::SET,
50
+ :name => 'int_set',
51
+ :element => {
52
+ :type => ::Sparsam::Types::I32,
53
+ },
54
+ :optional => true,
55
+ :annotations => {
56
+ },
57
+ }
58
+ }
59
+
60
+ ANNOTATIONS = {
25
61
  }
26
62
 
27
63
  init_thrift_struct(self)
@@ -29,8 +65,23 @@ end
29
65
 
30
66
  class UN < ::Sparsam::Union
31
67
  FIELDS = {
32
- 1 => {:type => ::Sparsam::Types::I32, :name => 'id_i32', :optional => true},
33
- 2 => {:type => ::Sparsam::Types::STRING, :name => 'id_s', :optional => true}
68
+ 1 => {
69
+ :type => ::Sparsam::Types::I32,
70
+ :name => 'id_i32',
71
+ :optional => true,
72
+ :annotations => {
73
+ },
74
+ },
75
+ 2 => {
76
+ :type => ::Sparsam::Types::STRING,
77
+ :name => 'id_s',
78
+ :optional => true,
79
+ :annotations => {
80
+ },
81
+ }
82
+ }
83
+
84
+ ANNOTATIONS = {
34
85
  }
35
86
 
36
87
  init_thrift_struct(self)
@@ -38,16 +89,107 @@ end
38
89
 
39
90
  class SS < ::Sparsam::Struct
40
91
  FIELDS = {
41
- 1 => {:type => ::Sparsam::Types::I32, :name => 'id_i32', :optional => true},
42
- 2 => {:type => ::Sparsam::Types::STRING, :name => 'id_s', :optional => true},
43
- 3 => {:type => ::Sparsam::Types::STRUCT, :name => 'us_i', :class => ::US, :optional => true},
44
- 4 => {:type => ::Sparsam::Types::SET, :name => 'us_s', :element => {:type => ::Sparsam::Types::STRUCT, :class => ::US}, :optional => true},
45
- 5 => {:type => ::Sparsam::Types::LIST, :name => 's_l', :element => {:type => ::Sparsam::Types::STRING}, :optional => true},
46
- 6 => {:type => ::Sparsam::Types::MAP, :name => 'mappy', :key => {:type => ::Sparsam::Types::I32}, :value => {:type => ::Sparsam::Types::STRING}, :optional => true},
47
- 7 => {:type => ::Sparsam::Types::BYTE, :name => 'byte_field', :optional => true},
48
- 8 => {:type => ::Sparsam::Types::STRUCT, :name => 'un_field', :class => ::UN, :optional => true},
49
- 9 => {:type => ::Sparsam::Types::I32, :name => 'magic_field', :optional => true, :enum_class => ::Magic},
50
- 10 => {:type => ::Sparsam::Types::MAP, :name => 'troll', :key => {:type => ::Sparsam::Types::I32}, :value => {:type => ::Sparsam::Types::MAP, :key => {:type => ::Sparsam::Types::I32}, :value => {:type => ::Sparsam::Types::I32}}, :optional => true}
92
+ 1 => {
93
+ :type => ::Sparsam::Types::I32,
94
+ :name => 'id_i32',
95
+ :optional => true,
96
+ :annotations => {
97
+ },
98
+ },
99
+ 2 => {
100
+ :type => ::Sparsam::Types::STRING,
101
+ :name => 'id_s',
102
+ :optional => true,
103
+ :annotations => {
104
+ },
105
+ },
106
+ 3 => {
107
+ :type => ::Sparsam::Types::STRUCT,
108
+ :name => 'us_i',
109
+ :class => ::US,
110
+ :optional => true,
111
+ :annotations => {
112
+ },
113
+ },
114
+ 4 => {
115
+ :type => ::Sparsam::Types::SET,
116
+ :name => 'us_s',
117
+ :element => {
118
+ :type => ::Sparsam::Types::STRUCT,
119
+ :class => ::US,
120
+ },
121
+ :optional => true,
122
+ :annotations => {
123
+ },
124
+ },
125
+ 5 => {
126
+ :type => ::Sparsam::Types::LIST,
127
+ :name => 's_l',
128
+ :element => {
129
+ :type => ::Sparsam::Types::STRING,
130
+ },
131
+ :optional => true,
132
+ :annotations => {
133
+ },
134
+ },
135
+ 6 => {
136
+ :type => ::Sparsam::Types::MAP,
137
+ :name => 'mappy',
138
+ :key => {
139
+ :type => ::Sparsam::Types::I32,
140
+ },
141
+ :value => {
142
+ :type => ::Sparsam::Types::STRING,
143
+ },
144
+ :optional => true,
145
+ :annotations => {
146
+ },
147
+ },
148
+ 7 => {
149
+ :type => ::Sparsam::Types::BYTE,
150
+ :name => 'byte_field',
151
+ :optional => true,
152
+ :annotations => {
153
+ },
154
+ },
155
+ 8 => {
156
+ :type => ::Sparsam::Types::STRUCT,
157
+ :name => 'un_field',
158
+ :class => ::UN,
159
+ :optional => true,
160
+ :annotations => {
161
+ },
162
+ },
163
+ 9 => {
164
+ :type => ::Sparsam::Types::I32,
165
+ :name => 'magic_field',
166
+ :optional => true,
167
+ :enum_class => ::Magic ,
168
+ :annotations => {
169
+ },
170
+ },
171
+ 10 => {
172
+ :type => ::Sparsam::Types::MAP,
173
+ :name => 'troll',
174
+ :key => {
175
+ :type => ::Sparsam::Types::I32,
176
+ },
177
+ :value => {
178
+ :type => ::Sparsam::Types::MAP,
179
+ :key => {
180
+ :type => ::Sparsam::Types::I32,
181
+ },
182
+ :value => {
183
+ :type => ::Sparsam::Types::I32,
184
+ },
185
+ },
186
+ :optional => true,
187
+ :annotations => {
188
+ },
189
+ }
190
+ }
191
+
192
+ ANNOTATIONS = {
51
193
  }
52
194
 
53
195
  init_thrift_struct(self)
@@ -55,7 +197,15 @@ end
55
197
 
56
198
  class MiniRequired < ::Sparsam::Struct
57
199
  FIELDS = {
58
- 1 => {:type => ::Sparsam::Types::I32, :name => 'id_i32'}
200
+ 1 => {
201
+ :type => ::Sparsam::Types::I32,
202
+ :name => 'id_i32',
203
+ :annotations => {
204
+ },
205
+ }
206
+ }
207
+
208
+ ANNOTATIONS = {
59
209
  }
60
210
 
61
211
  init_thrift_struct(self)
@@ -63,15 +213,135 @@ end
63
213
 
64
214
  class EasilyInvalid < ::Sparsam::Struct
65
215
  FIELDS = {
66
- 1 => {:type => ::Sparsam::Types::STRUCT, :name => 'tail', :class => ::EasilyInvalid, :optional => true},
67
- 2 => {:type => ::Sparsam::Types::SET, :name => 's_self', :element => {:type => ::Sparsam::Types::STRUCT, :class => ::EasilyInvalid}, :optional => true},
68
- 3 => {:type => ::Sparsam::Types::LIST, :name => 'l_self', :element => {:type => ::Sparsam::Types::STRUCT, :class => ::EasilyInvalid}, :optional => true},
69
- 4 => {:type => ::Sparsam::Types::MAP, :name => 'mappy1', :key => {:type => ::Sparsam::Types::STRUCT, :class => ::EasilyInvalid}, :value => {:type => ::Sparsam::Types::I32}, :optional => true},
70
- 5 => {:type => ::Sparsam::Types::MAP, :name => 'mappy2', :key => {:type => ::Sparsam::Types::I32}, :value => {:type => ::Sparsam::Types::STRUCT, :class => ::EasilyInvalid}, :optional => true},
71
- 6 => {:type => ::Sparsam::Types::MAP, :name => 'mappy3', :key => {:type => ::Sparsam::Types::STRUCT, :class => ::EasilyInvalid}, :value => {:type => ::Sparsam::Types::STRUCT, :class => ::EasilyInvalid}, :optional => true},
72
- 7 => {:type => ::Sparsam::Types::LIST, :name => 'sure', :element => {:type => ::Sparsam::Types::MAP, :key => {:type => ::Sparsam::Types::SET, :element => {:type => ::Sparsam::Types::I32}}, :value => {:type => ::Sparsam::Types::MAP, :key => {:type => ::Sparsam::Types::I32}, :value => {:type => ::Sparsam::Types::SET, :element => {:type => ::Sparsam::Types::LIST, :element => {:type => ::Sparsam::Types::MAP, :key => {:type => ::Sparsam::Types::STRUCT, :class => ::EasilyInvalid}, :value => {:type => ::Sparsam::Types::STRING}}}}}}, :optional => true},
73
- 8 => {:type => ::Sparsam::Types::STRUCT, :name => 'required_stuff', :class => ::MiniRequired, :optional => true},
74
- 9 => {:type => ::Sparsam::Types::I32, :name => 'id_i32', :optional => true}
216
+ 1 => {
217
+ :type => ::Sparsam::Types::STRUCT,
218
+ :name => 'tail',
219
+ :class => ::EasilyInvalid,
220
+ :optional => true,
221
+ :annotations => {
222
+ },
223
+ },
224
+ 2 => {
225
+ :type => ::Sparsam::Types::SET,
226
+ :name => 's_self',
227
+ :element => {
228
+ :type => ::Sparsam::Types::STRUCT,
229
+ :class => ::EasilyInvalid,
230
+ },
231
+ :optional => true,
232
+ :annotations => {
233
+ },
234
+ },
235
+ 3 => {
236
+ :type => ::Sparsam::Types::LIST,
237
+ :name => 'l_self',
238
+ :element => {
239
+ :type => ::Sparsam::Types::STRUCT,
240
+ :class => ::EasilyInvalid,
241
+ },
242
+ :optional => true,
243
+ :annotations => {
244
+ },
245
+ },
246
+ 4 => {
247
+ :type => ::Sparsam::Types::MAP,
248
+ :name => 'mappy1',
249
+ :key => {
250
+ :type => ::Sparsam::Types::STRUCT,
251
+ :class => ::EasilyInvalid,
252
+ },
253
+ :value => {
254
+ :type => ::Sparsam::Types::I32,
255
+ },
256
+ :optional => true,
257
+ :annotations => {
258
+ },
259
+ },
260
+ 5 => {
261
+ :type => ::Sparsam::Types::MAP,
262
+ :name => 'mappy2',
263
+ :key => {
264
+ :type => ::Sparsam::Types::I32,
265
+ },
266
+ :value => {
267
+ :type => ::Sparsam::Types::STRUCT,
268
+ :class => ::EasilyInvalid,
269
+ },
270
+ :optional => true,
271
+ :annotations => {
272
+ },
273
+ },
274
+ 6 => {
275
+ :type => ::Sparsam::Types::MAP,
276
+ :name => 'mappy3',
277
+ :key => {
278
+ :type => ::Sparsam::Types::STRUCT,
279
+ :class => ::EasilyInvalid,
280
+ },
281
+ :value => {
282
+ :type => ::Sparsam::Types::STRUCT,
283
+ :class => ::EasilyInvalid,
284
+ },
285
+ :optional => true,
286
+ :annotations => {
287
+ },
288
+ },
289
+ 7 => {
290
+ :type => ::Sparsam::Types::LIST,
291
+ :name => 'sure',
292
+ :element => {
293
+ :type => ::Sparsam::Types::MAP,
294
+ :key => {
295
+ :type => ::Sparsam::Types::SET,
296
+ :element => {
297
+ :type => ::Sparsam::Types::I32,
298
+ },
299
+ },
300
+ :value => {
301
+ :type => ::Sparsam::Types::MAP,
302
+ :key => {
303
+ :type => ::Sparsam::Types::I32,
304
+ },
305
+ :value => {
306
+ :type => ::Sparsam::Types::SET,
307
+ :element => {
308
+ :type => ::Sparsam::Types::LIST,
309
+ :element => {
310
+ :type => ::Sparsam::Types::MAP,
311
+ :key => {
312
+ :type => ::Sparsam::Types::STRUCT,
313
+ :class => ::EasilyInvalid,
314
+ },
315
+ :value => {
316
+ :type => ::Sparsam::Types::STRING,
317
+ },
318
+ },
319
+ },
320
+ },
321
+ },
322
+ },
323
+ :optional => true,
324
+ :annotations => {
325
+ },
326
+ },
327
+ 8 => {
328
+ :type => ::Sparsam::Types::STRUCT,
329
+ :name => 'required_stuff',
330
+ :class => ::MiniRequired,
331
+ :optional => true,
332
+ :annotations => {
333
+ },
334
+ },
335
+ 9 => {
336
+ :type => ::Sparsam::Types::I32,
337
+ :name => 'id_i32',
338
+ :optional => true,
339
+ :annotations => {
340
+ },
341
+ }
342
+ }
343
+
344
+ ANNOTATIONS = {
75
345
  }
76
346
 
77
347
  init_thrift_struct(self)
@@ -79,8 +349,23 @@ end
79
349
 
80
350
  class NotSS < ::Sparsam::Struct
81
351
  FIELDS = {
82
- 1 => {:type => ::Sparsam::Types::STRING, :name => 'id_s', :optional => true},
83
- 3 => {:type => ::Sparsam::Types::I32, :name => 'id_i32', :optional => true}
352
+ 1 => {
353
+ :type => ::Sparsam::Types::STRING,
354
+ :name => 'id_s',
355
+ :optional => true,
356
+ :annotations => {
357
+ },
358
+ },
359
+ 3 => {
360
+ :type => ::Sparsam::Types::I32,
361
+ :name => 'id_i32',
362
+ :optional => true,
363
+ :annotations => {
364
+ },
365
+ }
366
+ }
367
+
368
+ ANNOTATIONS = {
84
369
  }
85
370
 
86
371
  init_thrift_struct(self)
@@ -88,9 +373,30 @@ end
88
373
 
89
374
  class NotSS_plus < ::Sparsam::Struct
90
375
  FIELDS = {
91
- 1 => {:type => ::Sparsam::Types::STRING, :name => 'id_s', :optional => true},
92
- 2 => {:type => ::Sparsam::Types::STRING, :name => 'id_s2', :optional => true},
93
- 3 => {:type => ::Sparsam::Types::I32, :name => 'id_i32', :optional => true}
376
+ 1 => {
377
+ :type => ::Sparsam::Types::STRING,
378
+ :name => 'id_s',
379
+ :optional => true,
380
+ :annotations => {
381
+ },
382
+ },
383
+ 2 => {
384
+ :type => ::Sparsam::Types::STRING,
385
+ :name => 'id_s2',
386
+ :optional => true,
387
+ :annotations => {
388
+ },
389
+ },
390
+ 3 => {
391
+ :type => ::Sparsam::Types::I32,
392
+ :name => 'id_i32',
393
+ :optional => true,
394
+ :annotations => {
395
+ },
396
+ }
397
+ }
398
+
399
+ ANNOTATIONS = {
94
400
  }
95
401
 
96
402
  init_thrift_struct(self)
@@ -101,26 +407,200 @@ class Nothing < ::Sparsam::Struct
101
407
 
102
408
  }
103
409
 
410
+ ANNOTATIONS = {
411
+ }
412
+
104
413
  init_thrift_struct(self)
105
414
  end
106
415
 
107
416
  class EveryType < ::Sparsam::Struct
108
417
  FIELDS = {
109
- 1 => {:type => ::Sparsam::Types::BOOL, :name => 'a_bool', :optional => true},
110
- 2 => {:type => ::Sparsam::Types::BYTE, :name => 'a_byte', :optional => true},
111
- 3 => {:type => ::Sparsam::Types::I16, :name => 'an_i16', :optional => true},
112
- 4 => {:type => ::Sparsam::Types::I32, :name => 'an_i32', :optional => true},
113
- 5 => {:type => ::Sparsam::Types::I64, :name => 'an_i64', :optional => true},
114
- 6 => {:type => ::Sparsam::Types::DOUBLE, :name => 'a_double', :optional => true},
115
- 7 => {:type => ::Sparsam::Types::STRING, :name => 'a_binary', :binary => true, :optional => true},
116
- 8 => {:type => ::Sparsam::Types::STRING, :name => 'a_string', :optional => true},
117
- 9 => {:type => ::Sparsam::Types::LIST, :name => 'an_i64_list', :element => {:type => ::Sparsam::Types::I64}, :optional => true},
118
- 10 => {:type => ::Sparsam::Types::SET, :name => 'an_i64_set', :element => {:type => ::Sparsam::Types::I64}, :optional => true},
119
- 11 => {:type => ::Sparsam::Types::MAP, :name => 'an_i64_map', :key => {:type => ::Sparsam::Types::I64}, :value => {:type => ::Sparsam::Types::I64}, :optional => true},
120
- 12 => {:type => ::Sparsam::Types::LIST, :name => 'a_list_of_i64_maps', :element => {:type => ::Sparsam::Types::MAP, :key => {:type => ::Sparsam::Types::I64}, :value => {:type => ::Sparsam::Types::I64}}, :optional => true},
121
- 13 => {:type => ::Sparsam::Types::MAP, :name => 'a_map_of_i64_maps', :key => {:type => ::Sparsam::Types::MAP, :key => {:type => ::Sparsam::Types::I64}, :value => {:type => ::Sparsam::Types::I64}}, :value => {:type => ::Sparsam::Types::MAP, :key => {:type => ::Sparsam::Types::I64}, :value => {:type => ::Sparsam::Types::I64}}, :optional => true},
122
- 14 => {:type => ::Sparsam::Types::STRUCT, :name => 'a_struct', :class => ::US, :optional => true},
123
- 15 => {:type => ::Sparsam::Types::STRUCT, :name => 'a_union', :class => ::UN, :optional => true}
418
+ 1 => {
419
+ :type => ::Sparsam::Types::BOOL,
420
+ :name => 'a_bool',
421
+ :optional => true,
422
+ :annotations => {
423
+ },
424
+ },
425
+ 2 => {
426
+ :type => ::Sparsam::Types::BYTE,
427
+ :name => 'a_byte',
428
+ :optional => true,
429
+ :annotations => {
430
+ },
431
+ },
432
+ 3 => {
433
+ :type => ::Sparsam::Types::I16,
434
+ :name => 'an_i16',
435
+ :optional => true,
436
+ :annotations => {
437
+ },
438
+ },
439
+ 4 => {
440
+ :type => ::Sparsam::Types::I32,
441
+ :name => 'an_i32',
442
+ :optional => true,
443
+ :annotations => {
444
+ },
445
+ },
446
+ 5 => {
447
+ :type => ::Sparsam::Types::I64,
448
+ :name => 'an_i64',
449
+ :optional => true,
450
+ :annotations => {
451
+ },
452
+ },
453
+ 6 => {
454
+ :type => ::Sparsam::Types::DOUBLE,
455
+ :name => 'a_double',
456
+ :optional => true,
457
+ :annotations => {
458
+ },
459
+ },
460
+ 7 => {
461
+ :type => ::Sparsam::Types::STRING,
462
+ :name => 'a_binary',
463
+ :binary => true,
464
+ :optional => true,
465
+ :annotations => {
466
+ },
467
+ },
468
+ 8 => {
469
+ :type => ::Sparsam::Types::STRING,
470
+ :name => 'a_string',
471
+ :optional => true,
472
+ :annotations => {
473
+ },
474
+ },
475
+ 9 => {
476
+ :type => ::Sparsam::Types::LIST,
477
+ :name => 'an_i64_list',
478
+ :element => {
479
+ :type => ::Sparsam::Types::I64,
480
+ },
481
+ :optional => true,
482
+ :annotations => {
483
+ },
484
+ },
485
+ 10 => {
486
+ :type => ::Sparsam::Types::SET,
487
+ :name => 'an_i64_set',
488
+ :element => {
489
+ :type => ::Sparsam::Types::I64,
490
+ },
491
+ :optional => true,
492
+ :annotations => {
493
+ },
494
+ },
495
+ 11 => {
496
+ :type => ::Sparsam::Types::MAP,
497
+ :name => 'an_i64_map',
498
+ :key => {
499
+ :type => ::Sparsam::Types::I64,
500
+ },
501
+ :value => {
502
+ :type => ::Sparsam::Types::I64,
503
+ },
504
+ :optional => true,
505
+ :annotations => {
506
+ },
507
+ },
508
+ 12 => {
509
+ :type => ::Sparsam::Types::LIST,
510
+ :name => 'a_list_of_i64_maps',
511
+ :element => {
512
+ :type => ::Sparsam::Types::MAP,
513
+ :key => {
514
+ :type => ::Sparsam::Types::I64,
515
+ },
516
+ :value => {
517
+ :type => ::Sparsam::Types::I64,
518
+ },
519
+ },
520
+ :optional => true,
521
+ :annotations => {
522
+ },
523
+ },
524
+ 13 => {
525
+ :type => ::Sparsam::Types::MAP,
526
+ :name => 'a_map_of_i64_maps',
527
+ :key => {
528
+ :type => ::Sparsam::Types::MAP,
529
+ :key => {
530
+ :type => ::Sparsam::Types::I64,
531
+ },
532
+ :value => {
533
+ :type => ::Sparsam::Types::I64,
534
+ },
535
+ },
536
+ :value => {
537
+ :type => ::Sparsam::Types::MAP,
538
+ :key => {
539
+ :type => ::Sparsam::Types::I64,
540
+ },
541
+ :value => {
542
+ :type => ::Sparsam::Types::I64,
543
+ },
544
+ },
545
+ :optional => true,
546
+ :annotations => {
547
+ },
548
+ },
549
+ 14 => {
550
+ :type => ::Sparsam::Types::STRUCT,
551
+ :name => 'a_struct',
552
+ :class => ::US,
553
+ :optional => true,
554
+ :annotations => {
555
+ },
556
+ },
557
+ 15 => {
558
+ :type => ::Sparsam::Types::STRUCT,
559
+ :name => 'a_union',
560
+ :class => ::UN,
561
+ :optional => true,
562
+ :annotations => {
563
+ },
564
+ }
565
+ }
566
+
567
+ ANNOTATIONS = {
568
+ }
569
+
570
+ init_thrift_struct(self)
571
+ end
572
+
573
+ class RecursiveStruct < ::Sparsam::Struct
574
+ FIELDS = {
575
+ 1 => {
576
+ :type => ::Sparsam::Types::I64,
577
+ :name => 'id',
578
+ :optional => true,
579
+ :annotations => {
580
+ },
581
+ },
582
+ 2 => {
583
+ :type => ::Sparsam::Types::STRUCT,
584
+ :name => 'self_struct',
585
+ :class => ::RecursiveStruct,
586
+ :optional => true,
587
+ :annotations => {
588
+ },
589
+ },
590
+ 3 => {
591
+ :type => ::Sparsam::Types::LIST,
592
+ :name => 'self_list',
593
+ :element => {
594
+ :type => ::Sparsam::Types::STRUCT,
595
+ :class => ::RecursiveStruct,
596
+ },
597
+ :optional => true,
598
+ :annotations => {
599
+ },
600
+ }
601
+ }
602
+
603
+ ANNOTATIONS = {
124
604
  }
125
605
 
126
606
  init_thrift_struct(self)
@@ -128,7 +608,16 @@ end
128
608
 
129
609
  class SimpleException < ::Sparsam::ApplicationException
130
610
  FIELDS = {
131
- 1 => {:type => ::Sparsam::Types::STRING, :name => 'message', :optional => true}
611
+ 1 => {
612
+ :type => ::Sparsam::Types::STRING,
613
+ :name => 'message',
614
+ :optional => true,
615
+ :annotations => {
616
+ },
617
+ }
618
+ }
619
+
620
+ ANNOTATIONS = {
132
621
  }
133
622
 
134
623
  init_thrift_struct(self)
@@ -136,8 +625,23 @@ end
136
625
 
137
626
  class WithFieldsException < ::Sparsam::ApplicationException
138
627
  FIELDS = {
139
- 1 => {:type => ::Sparsam::Types::I64, :name => 'an_i64', :optional => true},
140
- 2 => {:type => ::Sparsam::Types::STRING, :name => 'message', :optional => true}
628
+ 1 => {
629
+ :type => ::Sparsam::Types::I64,
630
+ :name => 'an_i64',
631
+ :optional => true,
632
+ :annotations => {
633
+ },
634
+ },
635
+ 2 => {
636
+ :type => ::Sparsam::Types::STRING,
637
+ :name => 'message',
638
+ :optional => true,
639
+ :annotations => {
640
+ },
641
+ }
642
+ }
643
+
644
+ ANNOTATIONS = {
141
645
  }
142
646
 
143
647
  init_thrift_struct(self)