babeltrace2 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +21 -0
  3. data/babeltrace2.gemspec +13 -0
  4. data/lib/babeltrace2.rb +49 -0
  5. data/lib/babeltrace2/error-reporting.rb +432 -0
  6. data/lib/babeltrace2/func-status.rb +26 -0
  7. data/lib/babeltrace2/graph/component-class-dev.rb +801 -0
  8. data/lib/babeltrace2/graph/component-class.rb +134 -0
  9. data/lib/babeltrace2/graph/component-descriptor-set.rb +78 -0
  10. data/lib/babeltrace2/graph/component.rb +362 -0
  11. data/lib/babeltrace2/graph/connection.rb +35 -0
  12. data/lib/babeltrace2/graph/graph.rb +523 -0
  13. data/lib/babeltrace2/graph/interrupter.rb +57 -0
  14. data/lib/babeltrace2/graph/message-iterator-class.rb +374 -0
  15. data/lib/babeltrace2/graph/message-iterator.rb +253 -0
  16. data/lib/babeltrace2/graph/message.rb +721 -0
  17. data/lib/babeltrace2/graph/port.rb +124 -0
  18. data/lib/babeltrace2/graph/private-query-executor.rb +4 -0
  19. data/lib/babeltrace2/graph/query-executor.rb +142 -0
  20. data/lib/babeltrace2/graph/self-component-class.rb +37 -0
  21. data/lib/babeltrace2/graph/self-component-port.rb +35 -0
  22. data/lib/babeltrace2/graph/self-component.rb +264 -0
  23. data/lib/babeltrace2/graph/self-message-iterator.rb +147 -0
  24. data/lib/babeltrace2/integer-range-set.rb +275 -0
  25. data/lib/babeltrace2/logging-defs.rb +19 -0
  26. data/lib/babeltrace2/logging.rb +77 -0
  27. data/lib/babeltrace2/plugin/plugin-dev.rb +335 -0
  28. data/lib/babeltrace2/plugin/plugin-loading.rb +459 -0
  29. data/lib/babeltrace2/trace-ir/clock-class.rb +258 -0
  30. data/lib/babeltrace2/trace-ir/clock-snapshot.rb +45 -0
  31. data/lib/babeltrace2/trace-ir/event-class.rb +292 -0
  32. data/lib/babeltrace2/trace-ir/event.rb +91 -0
  33. data/lib/babeltrace2/trace-ir/field-class.rb +1416 -0
  34. data/lib/babeltrace2/trace-ir/field-path.rb +123 -0
  35. data/lib/babeltrace2/trace-ir/field.rb +871 -0
  36. data/lib/babeltrace2/trace-ir/packet.rb +57 -0
  37. data/lib/babeltrace2/trace-ir/stream-class.rb +425 -0
  38. data/lib/babeltrace2/trace-ir/stream.rb +137 -0
  39. data/lib/babeltrace2/trace-ir/trace-class.rb +343 -0
  40. data/lib/babeltrace2/trace-ir/trace.rb +321 -0
  41. data/lib/babeltrace2/types.rb +667 -0
  42. data/lib/babeltrace2/util.rb +23 -0
  43. data/lib/babeltrace2/value.rb +869 -0
  44. data/lib/babeltrace2/version.rb +126 -0
  45. metadata +105 -0
@@ -0,0 +1,26 @@
1
+ module Babeltrace2
2
+
3
+ BT_FUNC_STATUS_OVERFLOW_ERROR = -75
4
+ private_constant :BT_FUNC_STATUS_OVERFLOW_ERROR
5
+ BT_FUNC_STATUS_MEMORY_ERROR = -12
6
+ private_constant :BT_FUNC_STATUS_MEMORY_ERROR
7
+ BT_FUNC_STATUS_USER_ERROR = -2
8
+ private_constant :BT_FUNC_STATUS_USER_ERROR
9
+ BT_FUNC_STATUS_ERROR = -1
10
+ private_constant :BT_FUNC_STATUS_ERROR
11
+ BT_FUNC_STATUS_OK = 0
12
+ private_constant :BT_FUNC_STATUS_OK
13
+ BT_FUNC_STATUS_END = 1
14
+ private_constant :BT_FUNC_STATUS_END
15
+ BT_FUNC_STATUS_NOT_FOUND = 2
16
+ private_constant :BT_FUNC_STATUS_NOT_FOUND
17
+ BT_FUNC_STATUS_INTERRUPTED = 4
18
+ private_constant :BT_FUNC_STATUS_INTERRUPTED
19
+ BT_FUNC_STATUS_NO_MATCH = 6
20
+ private_constant :BT_FUNC_STATUS_NO_MATCH
21
+ BT_FUNC_STATUS_AGAIN = 11
22
+ private_constant :BT_FUNC_STATUS_AGAIN
23
+ BT_FUNC_STATUS_UNKNOWN_OBJECT = 42
24
+ private_constant :BT_FUNC_STATUS_UNKNOWN_OBJECT
25
+
26
+ end
@@ -0,0 +1,801 @@
1
+ module Babeltrace2
2
+
3
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK = BT_FUNC_STATUS_OK
4
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_END = BT_FUNC_STATUS_END
5
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_AGAIN = BT_FUNC_STATUS_AGAIN
6
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
7
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR = BT_FUNC_STATUS_ERROR
8
+ BTComponentClassSinkConsumeMethodStatus = enum :bt_component_class_sink_consume_method_status,
9
+ [ :BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK,
10
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK,
11
+ :BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_END,
12
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_END,
13
+ :BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_AGAIN,
14
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_AGAIN,
15
+ :BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_MEMORY_ERROR,
16
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_MEMORY_ERROR,
17
+ :BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR,
18
+ BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR ]
19
+
20
+ callback :bt_component_class_sink_consume_method,
21
+ [:bt_self_component_sink_handle],
22
+ :bt_component_class_sink_consume_method_status
23
+
24
+ def self._wrap_component_class_sink_consume_method(method)
25
+ lambda { |self_component|
26
+ begin
27
+ method.call(BTSelfComponentSink.new(self_component,
28
+ retain: false, auto_release: false))
29
+ :BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK
30
+ rescue StopIteration
31
+ :BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_END
32
+ rescue Exception => e
33
+ Babeltrace2.stack_ruby_error(e, source: self_component)
34
+ :BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_ERROR
35
+ end
36
+ }
37
+ end
38
+
39
+ callback :bt_component_class_source_finalize_method,
40
+ [:bt_self_component_source_handle],
41
+ :void
42
+
43
+ callback :bt_component_class_filter_finalize_method,
44
+ [:bt_self_component_filter_handle],
45
+ :void
46
+
47
+ callback :bt_component_class_sink_finalize_method,
48
+ [:bt_self_component_sink_handle],
49
+ :void
50
+
51
+ def self._wrap_component_class_finalize_method(component_class, handle, method)
52
+ id = handle.to_i
53
+ method_wrapper = lambda { |self_component|
54
+ begin
55
+ method.call(component_class.new(self_component,
56
+ retain: false, auto_release: false))
57
+ rescue Exception => e
58
+ puts e
59
+ end
60
+ }
61
+ @@callbacks[id][:finalize_method] = method_wrapper
62
+ method_wrapper
63
+ end
64
+
65
+ BT_COMPONENT_CLASS_GET_SUPPORTED_MIP_VERSIONS_METHOD_STATUS_OK = BT_FUNC_STATUS_OK
66
+ BT_COMPONENT_CLASS_GET_SUPPORTED_MIP_VERSIONS_METHOD_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
67
+ BT_COMPONENT_CLASS_GET_SUPPORTED_MIP_VERSIONS_METHOD_STATUS_ERROR = BT_FUNC_STATUS_ERROR
68
+ BTComponentClassGetSupportedMipVersionsMethodStatus =
69
+ enum :bt_component_class_get_supported_mip_versions_method_status,
70
+ [ :BT_COMPONENT_CLASS_GET_SUPPORTED_MIP_VERSIONS_METHOD_STATUS_OK,
71
+ BT_COMPONENT_CLASS_GET_SUPPORTED_MIP_VERSIONS_METHOD_STATUS_OK,
72
+ :BT_COMPONENT_CLASS_GET_SUPPORTED_MIP_VERSIONS_METHOD_STATUS_MEMORY_ERROR,
73
+ BT_COMPONENT_CLASS_GET_SUPPORTED_MIP_VERSIONS_METHOD_STATUS_MEMORY_ERROR,
74
+ :BT_COMPONENT_CLASS_GET_SUPPORTED_MIP_VERSIONS_METHOD_STATUS_ERROR,
75
+ BT_COMPONENT_CLASS_GET_SUPPORTED_MIP_VERSIONS_METHOD_STATUS_ERROR ]
76
+
77
+ callback :bt_component_class_source_get_supported_mip_versions_method,
78
+ [:bt_self_component_class_source_handle, :bt_value_handle, :pointer, :bt_logging_level, :bt_integer_range_set_unsigned_handle],
79
+ :bt_component_class_get_supported_mip_versions_method_status
80
+
81
+ callback :bt_component_class_filter_get_supported_mip_versions_method,
82
+ [:bt_self_component_class_filter_handle, :bt_value_handle, :pointer, :bt_logging_level, :bt_integer_range_set_unsigned_handle],
83
+ :bt_component_class_get_supported_mip_versions_method_status
84
+
85
+ callback :bt_component_class_sink_get_supported_mip_versions_method,
86
+ [:bt_self_component_class_sink_handle, :bt_value_handle, :pointer, :bt_logging_level, :bt_integer_range_set_unsigned_handle],
87
+ :bt_component_class_get_supported_mip_versions_method_status
88
+
89
+ def self._wrap_component_class_get_supported_mip_versions_method(component_class_class, handle, method)
90
+ id = handle.to_i
91
+ method_wrapper = lambda { |self_component_class, params, initialize_method_data, logging_level, supported_versions|
92
+ begin
93
+ method.call(component_class_class.new(self_component_class,
94
+ retain: false, auto_release: false),
95
+ BTValue.from_handle(params, retain: false, auto_release: false),
96
+ initialize_method_data, logging_level,
97
+ BTIntergerRangeSetUnsigned.new(supported_versions,
98
+ retain: false, auto_release: false))
99
+ :BT_COMPONENT_CLASS_GET_SUPPORTED_MIP_VERSIONS_METHOD_STATUS_OK
100
+ rescue Exception => e
101
+ Babeltrace2.stack_ruby_error(e, source: self_component_class)
102
+ :BT_COMPONENT_CLASS_GET_SUPPORTED_MIP_VERSIONS_METHOD_STATUS_ERROR
103
+ end
104
+ }
105
+ @@callbacks[id][:get_supported_mip_versions_method] = method_wrapper
106
+ method_wrapper
107
+ end
108
+
109
+ BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_OK = BT_FUNC_STATUS_OK
110
+ BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
111
+ BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_ERROR = BT_FUNC_STATUS_ERROR
112
+ BTComponentClassSinkGraphIsConfiguredMethodStatus =
113
+ enum :bt_component_class_sink_graph_is_configured_method_status,
114
+ [ :BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_OK,
115
+ BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_OK,
116
+ :BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_MEMORY_ERROR,
117
+ BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_MEMORY_ERROR,
118
+ :BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_ERROR,
119
+ BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_ERROR ]
120
+
121
+ callback :bt_component_class_sink_graph_is_configured_method,
122
+ [:bt_self_component_sink_handle],
123
+ :bt_component_class_sink_graph_is_configured_method_status
124
+
125
+ def self._wrap_component_class_sink_graph_is_configured_method(handle, method)
126
+ id = handle.to_i
127
+ method_wrapper = lambda { |self_component|
128
+ begin
129
+ method.call(BTSelfComponentSink.new(self_component,
130
+ retain: false, auto_release: false))
131
+ :BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_OK
132
+ rescue Exception => e
133
+ Babeltrace2.stack_ruby_error(e, source: self_component)
134
+ :BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_ERROR
135
+ end
136
+ }
137
+ @@callbacks[id][:graph_is_configured_method] = method_wrapper
138
+ method_wrapper
139
+ end
140
+
141
+ BT_COMPONENT_CLASS_INITIALIZE_METHOD_STATUS_OK = BT_FUNC_STATUS_OK
142
+ BT_COMPONENT_CLASS_INITIALIZE_METHOD_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
143
+ BT_COMPONENT_CLASS_INITIALIZE_METHOD_STATUS_ERROR = BT_FUNC_STATUS_ERROR
144
+ BTComponentClassInitializeMethodStatus =
145
+ enum :bt_component_class_initialize_method_status,
146
+ [ :BT_COMPONENT_CLASS_INITIALIZE_METHOD_STATUS_OK,
147
+ BT_COMPONENT_CLASS_INITIALIZE_METHOD_STATUS_OK,
148
+ :BT_COMPONENT_CLASS_INITIALIZE_METHOD_STATUS_MEMORY_ERROR,
149
+ BT_COMPONENT_CLASS_INITIALIZE_METHOD_STATUS_MEMORY_ERROR,
150
+ :BT_COMPONENT_CLASS_INITIALIZE_METHOD_STATUS_ERROR,
151
+ BT_COMPONENT_CLASS_INITIALIZE_METHOD_STATUS_ERROR ]
152
+
153
+ callback :bt_component_class_source_initialize_method,
154
+ [ :bt_self_component_source_handle,
155
+ :bt_self_component_source_configuration_handle,
156
+ :bt_value_handle, :pointer],
157
+ :bt_component_class_initialize_method_status
158
+
159
+ callback :bt_component_class_filter_initialize_method,
160
+ [ :bt_self_component_filter_handle,
161
+ :bt_self_component_filter_configuration_handle,
162
+ :bt_value_handle, :pointer],
163
+ :bt_component_class_initialize_method_status
164
+
165
+ callback :bt_component_class_sink_initialize_method,
166
+ [ :bt_self_component_sink_handle,
167
+ :bt_self_component_sink_configuration_handle,
168
+ :bt_value_handle, :pointer],
169
+ :bt_component_class_initialize_method_status
170
+
171
+ def self._wrap_component_class_initialize_method(component_class, component_configuration_class, handle, method)
172
+ id = handle.to_i
173
+ method_wrapper = lambda { |self_component, configuration, params, initialize_method_data|
174
+ begin
175
+ method.call(component_class.new(self_component,
176
+ retain: false, auto_release: false),
177
+ component_configuration_class.new(configuration),
178
+ BTValue.from_handle(params, retain: false, auto_release: false),
179
+ initialize_method_data)
180
+ :BT_COMPONENT_CLASS_INITIALIZE_METHOD_STATUS_OK
181
+ rescue Exception => e
182
+ Babeltrace2.stack_ruby_error(e, source: self_component)
183
+ :BT_COMPONENT_CLASS_INITIALIZE_METHOD_STATUS_ERROR
184
+ end
185
+ }
186
+ @@callbacks[id][:initialize_method] = method_wrapper
187
+ method_wrapper
188
+ end
189
+
190
+ BT_COMPONENT_CLASS_PORT_CONNECTED_METHOD_STATUS_OK = BT_FUNC_STATUS_OK
191
+ BT_COMPONENT_CLASS_PORT_CONNECTED_METHOD_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
192
+ BT_COMPONENT_CLASS_PORT_CONNECTED_METHOD_STATUS_ERROR = BT_FUNC_STATUS_ERROR
193
+ BTComponentClassPortConnectedMethodStatus =
194
+ enum :bt_component_class_port_connected_method_status,
195
+ [ :BT_COMPONENT_CLASS_PORT_CONNECTED_METHOD_STATUS_OK,
196
+ BT_COMPONENT_CLASS_PORT_CONNECTED_METHOD_STATUS_OK,
197
+ :BT_COMPONENT_CLASS_PORT_CONNECTED_METHOD_STATUS_MEMORY_ERROR,
198
+ BT_COMPONENT_CLASS_PORT_CONNECTED_METHOD_STATUS_MEMORY_ERROR,
199
+ :BT_COMPONENT_CLASS_PORT_CONNECTED_METHOD_STATUS_ERROR,
200
+ BT_COMPONENT_CLASS_PORT_CONNECTED_METHOD_STATUS_ERROR ]
201
+
202
+ callback :bt_component_class_source_output_port_connected_method,
203
+ [ :bt_self_component_source_handle,
204
+ :bt_self_component_port_output_handle,
205
+ :bt_port_input_handle ],
206
+ :bt_component_class_port_connected_method_status
207
+
208
+ def self._wrap_component_class_port_connected_method(
209
+ self_component_class, self_component_port_class, port_class,
210
+ category, handle, method)
211
+ id = handle.to_i
212
+ method_wrapper = lambda { |self_component, self_port, other_port|
213
+ begin
214
+ method.call(self_component_class.new(self_component,
215
+ retain: false, auto_release: false),
216
+ self_component_port_class.new(self_port,
217
+ retain: false, auto_release: false),
218
+ port_class.new(other_port,
219
+ retain: false, auto_release: false))
220
+ :BT_COMPONENT_CLASS_PORT_CONNECTED_METHOD_STATUS_OK
221
+ rescue Exception => e
222
+ Babeltrace2.stack_ruby_error(e, source: self_component)
223
+ :BT_COMPONENT_CLASS_PORT_CONNECTED_METHOD_STATUS_ERROR
224
+ end
225
+ }
226
+ @@callbacks[id][category] = method_wrapper
227
+ method_wrapper
228
+ end
229
+
230
+ def self._wrap_component_class_source_output_port_connected_method(handle, method)
231
+ _wrap_component_class_port_connected_method(
232
+ BTSelfComponentSource, BTSelfComponentPortOutput, BTPortInput,
233
+ :output_port_connected_method, handle, method)
234
+ end
235
+
236
+ callback :bt_component_class_filter_input_port_connected_method,
237
+ [ :bt_self_component_filter_handle,
238
+ :bt_self_component_port_input_handle,
239
+ :bt_port_output_handle ],
240
+ :bt_component_class_port_connected_method_status
241
+
242
+ def self._wrap_component_class_filter_input_port_connected_method(handle, method)
243
+ _wrap_component_class_port_connected_method(
244
+ BTSelfComponentFilter, BTSelfComponentPortInput, BTPortOutput,
245
+ :input_port_connected_method, handle, method)
246
+ end
247
+
248
+ callback :bt_component_class_filter_output_port_connected_method,
249
+ [ :bt_self_component_filter_handle,
250
+ :bt_self_component_port_output_handle,
251
+ :bt_port_input_handle ],
252
+ :bt_component_class_port_connected_method_status
253
+
254
+ def self._wrap_component_class_filter_output_port_connected_method(handle, method)
255
+ _wrap_component_class_port_connected_method(
256
+ BTSelfComponentFilter, BTSelfComponentPortOutput, BTPortInput,
257
+ :output_port_connected_method, handle, method)
258
+ end
259
+
260
+ callback :bt_component_class_sink_input_port_connected_method,
261
+ [ :bt_self_component_sink_handle,
262
+ :bt_self_component_port_input_handle,
263
+ :bt_port_output_handle ],
264
+ :bt_component_class_port_connected_method_status
265
+
266
+ def self._wrap_component_class_sink_input_port_connected_method(handle, method)
267
+ _wrap_component_class_port_connected_method(
268
+ BTSelfComponentSink, BTSelfComponentPortInput, BTPortOutput,
269
+ :input_port_connected_method, handle, method)
270
+ end
271
+
272
+ BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_OK = BT_FUNC_STATUS_OK
273
+ BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_UNKNOWN_OBJECT = BT_FUNC_STATUS_UNKNOWN_OBJECT
274
+ BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_AGAIN = BT_FUNC_STATUS_AGAIN
275
+ BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
276
+ BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_ERROR = BT_FUNC_STATUS_ERROR
277
+ BTComponentClassQueryMethodStatus =
278
+ enum :bt_component_class_query_method_status,
279
+ [ :BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_OK,
280
+ BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_OK,
281
+ :BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_UNKNOWN_OBJECT,
282
+ BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_UNKNOWN_OBJECT,
283
+ :BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_AGAIN,
284
+ BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_AGAIN,
285
+ :BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_MEMORY_ERROR,
286
+ BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_MEMORY_ERROR,
287
+ :BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_ERROR,
288
+ BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_ERROR ]
289
+
290
+ def self._wrap_component_class_query_method(component_class_class, handle, method)
291
+ id = handle.to_i
292
+ method_wrapper = lambda { |self_component_class, query_executor, object_name, params, method_data, result|
293
+ begin
294
+ rvalue = method.call(component_class_class.new(self_component_class,
295
+ retain: false, auto_release: false),
296
+ BTPrivateQueryExecutor.new(query_executor,
297
+ retain: false, auto_release: false),
298
+ object_name, BTValue.from_handle(params,
299
+ retain: false, auto_release: false), method_data)
300
+ unless rvalue.nil?
301
+ rvalue = BTValue.from_value(rvalue)
302
+ bt_value_get_ref(rvalue.handle)
303
+ result.write_pointer(rvalue.handle)
304
+ :BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_OK
305
+ else
306
+ :BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_UNKNOWN_OBJECT
307
+ end
308
+ rescue Exception => e
309
+ Babeltrace2.stack_ruby_error(e, source: self_component_class)
310
+ :BT_COMPONENT_CLASS_QUERY_METHOD_STATUS_ERROR
311
+ end
312
+ }
313
+ @@callbacks[id][:query_method] = method_wrapper
314
+ method_wrapper
315
+ end
316
+
317
+ callback :bt_component_class_source_query_method,
318
+ [ :bt_self_component_class_source_handle,
319
+ :bt_private_query_executor_handle,
320
+ :string, :bt_value_handle, :pointer, :pointer ],
321
+ :bt_component_class_query_method_status
322
+
323
+ callback :bt_component_class_filter_query_method,
324
+ [ :bt_self_component_class_filter_handle,
325
+ :bt_private_query_executor_handle,
326
+ :string, :bt_value_handle, :pointer, :pointer ],
327
+ :bt_component_class_query_method_status
328
+
329
+ callback :bt_component_class_sink_query_method,
330
+ [ :bt_self_component_class_sink_handle,
331
+ :bt_private_query_executor_handle,
332
+ :string, :bt_value_handle, :pointer, :pointer ],
333
+ :bt_component_class_query_method_status
334
+
335
+ attach_function :bt_component_class_source_create,
336
+ [ :string, :bt_message_iterator_class_handle ],
337
+ :bt_component_class_source_handle
338
+
339
+ attach_function :bt_component_class_filter_create,
340
+ [ :string, :bt_message_iterator_class_handle ],
341
+ :bt_component_class_filter_handle
342
+
343
+ attach_function :bt_component_class_sink_create,
344
+ [ :string, :bt_component_class_sink_consume_method ],
345
+ :bt_component_class_sink_handle
346
+
347
+ BT_COMPONENT_CLASS_SET_DESCRIPTION_STATUS_OK = BT_FUNC_STATUS_OK
348
+ BT_COMPONENT_CLASS_SET_DESCRIPTION_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
349
+ BTComponentClassSetDescriptionStatus =
350
+ enum :bt_component_class_set_description_status,
351
+ [ :BT_COMPONENT_CLASS_SET_DESCRIPTION_STATUS_OK,
352
+ BT_COMPONENT_CLASS_SET_DESCRIPTION_STATUS_OK,
353
+ :BT_COMPONENT_CLASS_SET_DESCRIPTION_STATUS_MEMORY_ERROR,
354
+ BT_COMPONENT_CLASS_SET_DESCRIPTION_STATUS_MEMORY_ERROR ]
355
+
356
+ attach_function :bt_component_class_set_description,
357
+ [ :bt_component_class_handle, :string ],
358
+ :bt_component_class_set_description_status
359
+
360
+ BT_COMPONENT_CLASS_SET_HELP_STATUS_OK = BT_FUNC_STATUS_OK
361
+ BT_COMPONENT_CLASS_SET_HELP_STATUS_MEMORY_ERROR = BT_FUNC_STATUS_MEMORY_ERROR
362
+ BTComponentClassSetHelpStatus =
363
+ enum :bt_component_class_set_help_status,
364
+ [ :BT_COMPONENT_CLASS_SET_HELP_STATUS_OK,
365
+ BT_COMPONENT_CLASS_SET_HELP_STATUS_OK,
366
+ :BT_COMPONENT_CLASS_SET_HELP_STATUS_MEMORY_ERROR,
367
+ BT_COMPONENT_CLASS_SET_HELP_STATUS_MEMORY_ERROR ]
368
+
369
+ attach_function :bt_component_class_set_help,
370
+ [ :bt_component_class_handle, :string ],
371
+ :bt_component_class_set_help_status
372
+
373
+ BT_COMPONENT_CLASS_SET_METHOD_STATUS_OK = BT_FUNC_STATUS_OK
374
+ BTComponentClassSetMethodStatus =
375
+ enum :bt_component_class_set_method_status,
376
+ [ :BT_COMPONENT_CLASS_SET_METHOD_STATUS_OK,
377
+ BT_COMPONENT_CLASS_SET_METHOD_STATUS_OK ]
378
+
379
+ class BTComponentClass
380
+ SinkConsumeMethodStatus = BTComponentClassSinkConsumeMethodStatus
381
+ GetSupportedMipVersionsMethodStatus =
382
+ BTComponentClassGetSupportedMipVersionsMethodStatus
383
+ SinkGraphIsConfiguredMethodStatus = BTComponentClassSinkGraphIsConfiguredMethodStatus
384
+ PortConnectedMethodStatus = BTComponentClassPortConnectedMethodStatus
385
+ QueryMethodStatus = BTComponentClassQueryMethodStatus
386
+ SetMethodStatus = BTComponentClassSetMethodStatus
387
+ SetDescriptionStatus = BTComponentClassSetDescriptionStatus
388
+ SetHelpStatus = BTComponentClassSetHelpStatus
389
+
390
+ def set_description(description)
391
+ raise ArgumentError, "description is nil" unless description
392
+ res = Babeltrace2.bt_component_class_set_description(@handle, description)
393
+ raise Babeltrace2.process_error(res) if res != :BT_COMPONENT_CLASS_SET_DESCRIPTION_STATUS_OK
394
+ self
395
+ end
396
+
397
+ def description=(description)
398
+ set_description(description)
399
+ description
400
+ end
401
+
402
+ def set_help(help_text)
403
+ raise ArgumentError, "help_text is nil" unless help_text
404
+ res = Babeltrace2.bt_component_class_set_help(@handle, help_text)
405
+ raise Babeltrace2.process_error(res) if res != :BT_COMPONENT_CLASS_SET_HELP_STATUS_OK
406
+ self
407
+ end
408
+
409
+ def help=(help_text)
410
+ set_help(help_text)
411
+ help_text
412
+ end
413
+
414
+ def set_finalize_method(method = nil, &block)
415
+ if method.nil?
416
+ raise ArgumentError, "method or block must be provided" unless block_given?
417
+ method = block
418
+ end
419
+ method = _wrap_finalize_method(method)
420
+ res = _set_finalize_method(method)
421
+ raise Babeltrace2.process_error(res) if res != :BT_COMPONENT_CLASS_SET_METHOD_STATUS_OK
422
+ self
423
+ end
424
+
425
+ def finalize_method=(method)
426
+ set_finalize_method(method)
427
+ method
428
+ end
429
+
430
+ def set_get_supported_mip_versions_method(method = nil, &block)
431
+ if method.nil?
432
+ raise ArgumentError, "method or block must be provided" unless block_given?
433
+ method = block
434
+ end
435
+ method = _wrap_get_supported_mip_versions_method(method)
436
+ res = _set_get_supported_mip_versions_method(method)
437
+ raise Babeltrace2.process_error(res) if res != :BT_COMPONENT_CLASS_SET_METHOD_STATUS_OK
438
+ self
439
+ end
440
+
441
+ def get_supported_mip_versions_method=(method)
442
+ set_get_supported_mip_versions_method(method)
443
+ method
444
+ end
445
+
446
+ def set_initialize_method(method = nil, &block)
447
+ if method.nil?
448
+ raise ArgumentError, "method or block must be provided" unless block_given?
449
+ method = block
450
+ end
451
+ method = _wrap_initialize_method(method)
452
+ res = _set_initialize_method(method)
453
+ raise Babeltrace2.process_error(res) if res != :BT_COMPONENT_CLASS_SET_METHOD_STATUS_OK
454
+ self
455
+ end
456
+
457
+ def initialize_method=(method)
458
+ set_initialize_method(method)
459
+ method
460
+ end
461
+
462
+ def set_query_method(method = nil, &block)
463
+ if method.nil?
464
+ raise ArgumentError, "method or block must be provided" unless block_given?
465
+ method = block
466
+ end
467
+ method = _wrap_query_method(method)
468
+ res = _set_query_method(method)
469
+ raise Babeltrace2.process_error(res) if res != :BT_COMPONENT_CLASS_SET_METHOD_STATUS_OK
470
+ self
471
+ end
472
+
473
+ def query_method=(method)
474
+ set_query_method(method)
475
+ method
476
+ end
477
+ end
478
+
479
+ attach_function :bt_component_class_source_set_finalize_method,
480
+ [ :bt_component_class_source_handle,
481
+ :bt_component_class_source_finalize_method ],
482
+ :bt_component_class_set_method_status
483
+
484
+ attach_function :bt_component_class_source_set_get_supported_mip_versions_method,
485
+ [ :bt_component_class_source_handle,
486
+ :bt_component_class_source_get_supported_mip_versions_method ],
487
+ :bt_component_class_set_method_status
488
+
489
+ attach_function :bt_component_class_source_set_initialize_method,
490
+ [ :bt_component_class_source_handle,
491
+ :bt_component_class_source_initialize_method ],
492
+ :bt_component_class_set_method_status
493
+
494
+ attach_function :bt_component_class_source_set_output_port_connected_method,
495
+ [ :bt_component_class_source_handle,
496
+ :bt_component_class_source_output_port_connected_method ],
497
+ :bt_component_class_set_method_status
498
+
499
+ attach_function :bt_component_class_source_set_query_method,
500
+ [ :bt_component_class_source_handle,
501
+ :bt_component_class_source_query_method ],
502
+ :bt_component_class_set_method_status
503
+
504
+ class BTComponentClass::Source
505
+
506
+ def initialize(handle = nil, retain: true, auto_release: true,
507
+ name: nil, message_iterator_class: nil)
508
+ if handle
509
+ super(handle, retain: retain, auto_release: auto_release)
510
+ else
511
+ raise ArgumentError, "invalid value for name" unless name
512
+ raise ArgumentError, "invalid value for message_iterator_class" unless message_iterator_class
513
+ handle = Babeltrace2.bt_component_class_source_create(
514
+ name, message_iterator_class)
515
+ raise Babeltrace2.process_error if handle.null?
516
+ super(handle, retain: false)
517
+ end
518
+ end
519
+
520
+ private
521
+ def _wrap_finalize_method(method)
522
+ Babeltrace2._wrap_component_class_finalize_method(BTSelfComponentSource, @handle, method)
523
+ end
524
+
525
+ def _set_finalize_method(method)
526
+ Babeltrace2.bt_component_class_source_set_finalize_method(@handle, method)
527
+ end
528
+
529
+ def _wrap_get_supported_mip_versions_method(method)
530
+ Babeltrace2._wrap_component_class_get_supported_mip_versions_method(BTSelfComponentClassSource, @handle, method)
531
+ end
532
+
533
+ def _set_get_supported_mip_versions_method(method)
534
+ Babeltrace2.bt_component_class_source_set_get_supported_mip_versions_method(@handle, method)
535
+ end
536
+
537
+ def _wrap_initialize_method(method)
538
+ Babeltrace2._wrap_component_class_initialize_method(BTSelfComponentSource, BTSelfComponentSourceConfiguration, @handle, method)
539
+ end
540
+
541
+ def _set_initialize_method(method)
542
+ Babeltrace2.bt_component_class_source_set_initialize_method(@handle, method)
543
+ end
544
+
545
+ def _wrap_query_method(method)
546
+ Babeltrace2._wrap_component_class_query_method(BTSelfComponentClassSource, @handle, method)
547
+ end
548
+
549
+ def _set_query_method(method)
550
+ Babeltrace2.bt_component_class_source_set_query_method(@handle, method)
551
+ end
552
+
553
+ public
554
+ def set_output_port_connected_method(method, &block)
555
+ if method.nil?
556
+ raise ArgumentError, "method or block must be provided" unless block_given?
557
+ method = block
558
+ end
559
+ method = Babeltrace2._wrap_component_class_source_output_port_connected_method(@handle, method)
560
+ res = Babeltrace2.bt_component_class_source_set_output_port_connected_method(@handle, method)
561
+ raise Babeltrace2.process_error(res) if res != :BT_COMPONENT_CLASS_SET_METHOD_STATUS_OK
562
+ self
563
+ end
564
+
565
+ def output_port_connected_method=(method)
566
+ set_output_port_connected_method(method)
567
+ method
568
+ end
569
+ end
570
+
571
+
572
+ attach_function :bt_component_class_filter_set_finalize_method,
573
+ [ :bt_component_class_filter_handle,
574
+ :bt_component_class_filter_finalize_method ],
575
+ :bt_component_class_set_method_status
576
+
577
+ attach_function :bt_component_class_filter_set_get_supported_mip_versions_method,
578
+ [ :bt_component_class_filter_handle,
579
+ :bt_component_class_filter_get_supported_mip_versions_method ],
580
+ :bt_component_class_set_method_status
581
+
582
+ attach_function :bt_component_class_filter_set_initialize_method,
583
+ [ :bt_component_class_filter_handle,
584
+ :bt_component_class_filter_initialize_method ],
585
+ :bt_component_class_set_method_status
586
+
587
+ attach_function :bt_component_class_filter_set_input_port_connected_method,
588
+ [ :bt_component_class_filter_handle,
589
+ :bt_component_class_filter_input_port_connected_method ],
590
+ :bt_component_class_set_method_status
591
+
592
+ attach_function :bt_component_class_filter_set_output_port_connected_method,
593
+ [ :bt_component_class_filter_handle,
594
+ :bt_component_class_filter_output_port_connected_method ],
595
+ :bt_component_class_set_method_status
596
+
597
+ attach_function :bt_component_class_filter_set_query_method,
598
+ [ :bt_component_class_filter_handle,
599
+ :bt_component_class_filter_query_method ],
600
+ :bt_component_class_set_method_status
601
+
602
+ class BTComponentClass::Filter
603
+
604
+ def initialize(handle = nil, retain: true, auto_release: true,
605
+ name: nil, message_iterator_class: nil)
606
+ if handle
607
+ super(handle, retain: retain, auto_release: auto_release)
608
+ else
609
+ raise ArgumentError, "invalid value for name" unless name
610
+ raise ArgumentError, "invalid value for message_iterator_class" unless message_iterator_class
611
+ handle = Babeltrace2.bt_component_class_filter_create(
612
+ name, message_iterator_class)
613
+ raise Babeltrace2.process_error if handle.null?
614
+ super(handle, retain: false)
615
+ end
616
+ end
617
+
618
+ private
619
+ def _wrap_finalize_method(method)
620
+ Babeltrace2._wrap_component_class_finalize_method(BTSelfComponentFilter, @handle, method)
621
+ end
622
+
623
+ def _set_finalize_method(method)
624
+ Babeltrace2.bt_component_class_filter_set_finalize_method(@handle, method)
625
+ end
626
+
627
+ def _wrap_get_supported_mip_versions_method(method)
628
+ Babeltrace2._wrap_component_class_get_supported_mip_versions_method(BTSelfComponentClassFilter, @handle, method)
629
+ end
630
+
631
+ def _set_get_supported_mip_versions_method(method)
632
+ Babeltrace2.bt_component_class_filter_set_get_supported_mip_versions_method(@handle, method)
633
+ end
634
+
635
+ def _wrap_initialize_method(method)
636
+ Babeltrace2._wrap_component_class_initialize_method(BTSelfComponentFilter, BTSelfComponentFilterConfiguration, @handle, method)
637
+ end
638
+
639
+ def _set_initialize_method(method)
640
+ Babeltrace2.bt_component_class_filter_set_initialize_method(@handle, method)
641
+ end
642
+
643
+ def _wrap_query_method(method)
644
+ Babeltrace2._wrap_component_class_query_method(BTSelfComponentClassFilter, @handle, method)
645
+ end
646
+
647
+ def _set_query_method(method)
648
+ Babeltrace2.bt_component_class_filter_set_query_method(@handle, method)
649
+ end
650
+
651
+ public
652
+ def set_input_port_connected_method(method, &block)
653
+ if method.nil?
654
+ raise ArgumentError, "method or block must be provided" unless block_given?
655
+ method = block
656
+ end
657
+ method = Babeltrace2._wrap_component_class_filter_input_port_connected_method(@handle, method)
658
+ res = Babeltrace2.bt_component_class_filter_set_input_port_connected_method(@handle, method)
659
+ raise Babeltrace2.process_error(res) if res != :BT_COMPONENT_CLASS_SET_METHOD_STATUS_OK
660
+ self
661
+ end
662
+
663
+ def input_port_connected_method=(method)
664
+ set_input_port_connected_method(method)
665
+ method
666
+ end
667
+
668
+ def set_output_port_connected_method(method, &block)
669
+ if method.nil?
670
+ raise ArgumentError, "method or block must be provided" unless block_given?
671
+ method = block
672
+ end
673
+ method = Babeltrace2._wrap_component_class_filter_output_port_connected_method(@handle, method)
674
+ res = Babeltrace2.bt_component_class_filter_set_output_port_connected_method(@handle, method)
675
+ raise Babeltrace2.process_error(res) if res != :BT_COMPONENT_CLASS_SET_METHOD_STATUS_OK
676
+ self
677
+ end
678
+
679
+ def output_port_connected_method=(method)
680
+ set_output_port_connected_method(method)
681
+ method
682
+ end
683
+ end
684
+
685
+ attach_function :bt_component_class_sink_set_finalize_method,
686
+ [ :bt_component_class_sink_handle,
687
+ :bt_component_class_sink_finalize_method ],
688
+ :bt_component_class_set_method_status
689
+
690
+ attach_function :bt_component_class_sink_set_get_supported_mip_versions_method,
691
+ [ :bt_component_class_sink_handle,
692
+ :bt_component_class_sink_get_supported_mip_versions_method ],
693
+ :bt_component_class_set_method_status
694
+
695
+ attach_function :bt_component_class_sink_set_graph_is_configured_method,
696
+ [ :bt_component_class_sink_handle,
697
+ :bt_component_class_sink_graph_is_configured_method ],
698
+ :bt_component_class_set_method_status
699
+
700
+ attach_function :bt_component_class_sink_set_initialize_method,
701
+ [ :bt_component_class_sink_handle,
702
+ :bt_component_class_sink_initialize_method ],
703
+ :bt_component_class_set_method_status
704
+
705
+ attach_function :bt_component_class_sink_set_input_port_connected_method,
706
+ [ :bt_component_class_sink_handle,
707
+ :bt_component_class_sink_input_port_connected_method ],
708
+ :bt_component_class_set_method_status
709
+
710
+ attach_function :bt_component_class_sink_set_query_method,
711
+ [ :bt_component_class_sink_handle,
712
+ :bt_component_class_sink_query_method ],
713
+ :bt_component_class_set_method_status
714
+
715
+ class BTComponentClass::Sink
716
+ ConsumeMethodStatus = BTComponentClassSinkConsumeMethodStatus
717
+ GraphIsConfiguredMethodStatus = BTComponentClassSinkGraphIsConfiguredMethodStatus
718
+
719
+ def initialize(handle = nil, retain: true, auto_release: true,
720
+ name: nil, consume_method: nil)
721
+ if handle
722
+ super(handle, retain: retain, auto_release: auto_release)
723
+ else
724
+ raise ArgumentError, "invalid value for name" unless name
725
+ raise ArgumentError, "invalid value for consume_method" unless consume_method
726
+ consume_method = Babeltrace2._wrap_component_class_sink_consume_method(consume_method)
727
+ handle = Babeltrace2.bt_component_class_sink_create(
728
+ name, consume_method)
729
+ raise Babeltrace2.process_error if handle.null?
730
+ Babeltrace2._callbacks[handle.to_i][:consume_method] = consume_method
731
+ super(handle, retain: false)
732
+ end
733
+ end
734
+
735
+ private
736
+ def _wrap_finalize_method(method)
737
+ Babeltrace2._wrap_component_class_finalize_method(BTSelfComponentSink, @handle, method)
738
+ end
739
+
740
+ def _set_finalize_method(method)
741
+ Babeltrace2.bt_component_class_sink_set_finalize_method(@handle, method)
742
+ end
743
+
744
+ def _wrap_get_supported_mip_versions_method(method)
745
+ Babeltrace2._wrap_component_class_get_supported_mip_versions_method(BTSelfComponentClassSink, @handle, method)
746
+ end
747
+
748
+ def _set_get_supported_mip_versions_method(method)
749
+ Babeltrace2.bt_component_class_sink_set_get_supported_mip_versions_method(@handle, method)
750
+ end
751
+
752
+ def _wrap_initialize_method(method)
753
+ Babeltrace2._wrap_component_class_initialize_method(BTSelfComponentSink, BTSelfComponentSinkConfiguration, @handle, method)
754
+ end
755
+
756
+ def _set_initialize_method(method)
757
+ Babeltrace2.bt_component_class_sink_set_initialize_method(@handle, method)
758
+ end
759
+
760
+ def _wrap_query_method(method)
761
+ Babeltrace2._wrap_component_class_query_method(BTSelfComponentClassSink, @handle, method)
762
+ end
763
+
764
+ def _set_query_method(method)
765
+ Babeltrace2.bt_component_class_sink_set_query_method(@handle, method)
766
+ end
767
+
768
+ public
769
+ def set_graph_is_configured_method(method, &block)
770
+ if method.nil?
771
+ raise ArgumentError, "method or block must be provided" unless block_given?
772
+ method = block
773
+ end
774
+ method = Babeltrace2._wrap_component_class_sink_graph_is_configured_method(@handle, method)
775
+ res = Babeltrace2.bt_component_class_sink_set_graph_is_configured_method(@handle, method)
776
+ raise Babeltrace2.process_error(res) if res != :BT_COMPONENT_CLASS_SET_METHOD_STATUS_OK
777
+ self
778
+ end
779
+
780
+ def graph_is_configured_method=(method)
781
+ set_graph_is_configured_method(method)
782
+ method
783
+ end
784
+
785
+ def set_input_port_connected_method(method, &block)
786
+ if method.nil?
787
+ raise ArgumentError, "method or block must be provided" unless block_given?
788
+ method = block
789
+ end
790
+ method = Babeltrace2._wrap_component_class_sink_input_port_connected_method(@handle, method)
791
+ res = Babeltrace2.bt_component_class_sink_set_input_port_connected_method(@handle, method)
792
+ raise Babeltrace2.process_error(res) if res != :BT_COMPONENT_CLASS_SET_METHOD_STATUS_OK
793
+ self
794
+ end
795
+
796
+ def input_port_connected_method=(method)
797
+ set_input_port_connected_method(method)
798
+ method
799
+ end
800
+ end
801
+ end