Class: Babeltrace2::BTPlugin
- Inherits:
-
BTSharedObject
show all
- Defined in:
- lib/babeltrace2/plugin/plugin-loading.rb,
lib/babeltrace2/plugin/plugin-loading.rb
Defined Under Namespace
Classes: Set
Constant Summary
collapse
- FindStatus =
BTPluginFindStatus
- FindAllStatus =
BTPluginFindAllStatus
- FindAllFromFileStatus =
BTPluginFindAllFromFileStatus
- FindAllFromDirStatus =
BTPluginFindAllFromDirStatus
- FindAllFromStaticStatus =
BTPluginFindAllFromStaticStatus
Instance Attribute Summary
Attributes inherited from BTObject
#handle
Class Method Summary
collapse
-
.find(name, find_in_std_env_var: true, find_in_user_dir: true, find_in_sys_dir: true, find_in_static: false, fail_on_load_error: true) ⇒ Object
-
.find_all(find_in_std_env_var: true, find_in_user_dir: true, find_in_sys_dir: true, find_in_static: false, fail_on_load_error: true) ⇒ Object
-
.find_all_from_dir(path, recurse: false, fail_on_load_error: true) ⇒ Object
-
.find_all_from_file(path, fail_on_load_error: true) ⇒ Object
-
.find_all_from_static(recurse: false, fail_on_load_error: true) ⇒ Object
Instance Method Summary
collapse
inherited, #initialize
Methods inherited from BTObject
#==, #initialize, #to_ptr
Class Method Details
.find(name, find_in_std_env_var: true, find_in_user_dir: true, find_in_sys_dir: true, find_in_static: false, fail_on_load_error: true) ⇒ Object
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 170
def self.find(name,
find_in_std_env_var: true,
find_in_user_dir: true,
find_in_sys_dir: true,
find_in_static: false,
fail_on_load_error: true)
ptr = FFI::MemoryPointer.new(:pointer)
res = Babeltrace2.bt_plugin_find(
name,
find_in_std_env_var ? BT_TRUE : BT_FALSE,
find_in_user_dir ? BT_TRUE : BT_FALSE,
find_in_sys_dir ? BT_TRUE : BT_FALSE,
find_in_static ? BT_TRUE : BT_FALSE,
fail_on_load_error ? BT_TRUE : BT_FALSE,
ptr)
return nil if res == :BT_PLUGIN_FIND_STATUS_NOT_FOUND
raise Babeltrace2.process_error(res) if res != :BT_PLUGIN_FIND_STATUS_OK
handle = BTPluginHandle.new(ptr.read_pointer)
BTPlugin.new(handle, retain: false)
end
|
.find_all(find_in_std_env_var: true, find_in_user_dir: true, find_in_sys_dir: true, find_in_static: false, fail_on_load_error: true) ⇒ Object
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 191
def self.find_all(find_in_std_env_var: true,
find_in_user_dir: true,
find_in_sys_dir: true,
find_in_static: false,
fail_on_load_error: true)
ptr = FFI::MemoryPointer.new(:pointer)
res = Babeltrace2.bt_plugin_find_all(
find_in_std_env_var ? BT_TRUE : BT_FALSE,
find_in_user_dir ? BT_TRUE : BT_FALSE,
find_in_sys_dir ? BT_TRUE : BT_FALSE,
find_in_static ? BT_TRUE : BT_FALSE,
fail_on_load_error ? BT_TRUE : BT_FALSE,
ptr)
return [] if res == :BT_PLUGIN_FIND_ALL_STATUS_NOT_FOUND
raise Babeltrace2.process_error(res) if res != :BT_PLUGIN_FIND_ALL_STATUS_OK
handle = BTPluginSetHandle.new(ptr.read_pointer)
BTPluginSet.new(handle, retain: false).plugins
end
|
.find_all_from_dir(path, recurse: false, fail_on_load_error: true) ⇒ Object
222
223
224
225
226
227
228
229
230
231
232
233
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 222
def self.find_all_from_dir(path, recurse: false, fail_on_load_error: true)
ptr = FFI::MemoryPointer.new(:pointer)
res = Babeltrace2.bt_plugin_find_all_from_dir(
path,
recurse ? BT_TRUE : BT_FALSE,
fail_on_load_error ? BT_TRUE : BT_FALSE,
ptr)
return [] if res == :BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_NOT_FOUND
raise Babeltrace2.process_error(res) if res != :BT_PLUGIN_FIND_ALL_FROM_DIR_STATUS_OK
handle = BTPluginSetHandle.new(ptr.read_pointer)
BTPluginSet.new(handle, retain: false).plugins
end
|
.find_all_from_file(path, fail_on_load_error: true) ⇒ Object
210
211
212
213
214
215
216
217
218
219
220
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 210
def self.find_all_from_file(path, fail_on_load_error: true)
ptr = FFI::MemoryPointer.new(:pointer)
res = Babeltrace2.bt_plugin_find_all_from_file(
path,
fail_on_load_error ? BT_TRUE : BT_FALSE,
ptr)
return [] if res == :BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_NOT_FOUND
raise Babeltrace2.process_error(res) if res != :BT_PLUGIN_FIND_ALL_FROM_FILE_STATUS_OK
handle = BTPluginSetHandle.new(ptr.read_pointer)
BTPluginSet.new(handle, retain: false).plugins
end
|
.find_all_from_static(recurse: false, fail_on_load_error: true) ⇒ Object
235
236
237
238
239
240
241
242
243
244
245
246
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 235
def self.find_all_from_static(recurse: false, fail_on_load_error: true)
ptr = FFI::MemoryPointer.new(:pointer)
res = Babeltrace2.bt_plugin_find_all_from_static(
path,
recurse ? BT_TRUE : BT_FALSE,
fail_on_load_error ? BT_TRUE : BT_FALSE,
ptr)
return [] if res == :BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_NOT_FOUND
raise Babeltrace2.process_error(res) if res != :BT_PLUGIN_FIND_ALL_FROM_STATIC_STATUS_OK
handle = BTPluginSetHandle.new(ptr.read_pointer)
BTPluginSet.new(handle, retain: false).plugins
end
|
Instance Method Details
#get_author ⇒ Object
Also known as:
author
258
259
260
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 258
def get_author
Babeltrace2.bt_plugin_get_author(@handle)
end
|
#get_description ⇒ Object
Also known as:
description
253
254
255
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 253
def get_description
Babeltrace2.bt_plugin_get_description(@handle)
end
|
#get_filter_component_class(filter_component_class) ⇒ Object
356
357
358
359
360
361
362
363
364
365
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 356
def get_filter_component_class(filter_component_class)
case filter_component_class
when String
get_filter_component_class_by_name(filter_component_class)
when Integer
get_filter_component_class_by_index(filter_component_class)
else
raise TypeError, "wrong type for filter component class query"
end
end
|
#get_filter_component_class_by_index(index) ⇒ Object
340
341
342
343
344
345
346
347
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 340
def get_filter_component_class_by_index(index)
count = get_filter_component_class_count
index += count if index < 0
return nil if index >= count || index < 0
handle = Babeltrace2.bt_plugin_borrow_filter_component_class_by_index_const(
@handle, index)
BTComponentClassFilter.new(handle, retain: true)
end
|
#get_filter_component_class_by_name(name) ⇒ Object
349
350
351
352
353
354
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 349
def get_filter_component_class_by_name(name)
handle = Babeltrace2.bt_plugin_borrow_filter_component_class_by_name_const(
@handle, name)
return nil if handle.null?
BTComponentClassFilter.new(handle, retain: true)
end
|
#get_filter_component_class_count ⇒ Object
Also known as:
filter_component_class_count
294
295
296
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 294
def get_filter_component_class_count
Babeltrace2.bt_plugin_get_filter_component_class_count(@handle)
end
|
#get_filter_component_classes ⇒ Object
Also known as:
filter_component_classes
367
368
369
370
371
372
373
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 367
def get_filter_component_classes
filter_component_class_count.times.collect { |index|
handle = Babeltrace2.bt_plugin_borrow_filter_component_class_by_index_const(
@handle, index)
BTComponentClassFilter.new(handle, retain: true)
}
end
|
#get_license ⇒ Object
Also known as:
license
263
264
265
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 263
def get_license
Babeltrace2.bt_plugin_get_license(@handle)
end
|
#get_name ⇒ Object
Also known as:
name
248
249
250
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 248
def get_name
Babeltrace2.bt_plugin_get_name(@handle)
end
|
#get_path ⇒ Object
Also known as:
path
268
269
270
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 268
def get_path
Babeltrace2.bt_plugin_get_path(@handle)
end
|
#get_sink_component_class(sink_component_class) ⇒ Object
392
393
394
395
396
397
398
399
400
401
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 392
def get_sink_component_class(sink_component_class)
case sink_component_class
when String
get_sink_component_class_by_name(sink_component_class)
when Integer
get_sink_component_class_by_index(sink_component_class)
else
raise TypeError, "wrong type for sink component class query"
end
end
|
#get_sink_component_class_by_index(index) ⇒ Object
376
377
378
379
380
381
382
383
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 376
def get_sink_component_class_by_index(index)
count = get_sink_component_class_count
index += count if index < 0
return nil if index >= count || index < 0
handle = Babeltrace2.bt_plugin_borrow_sink_component_class_by_index_const(
@handle, index)
BTComponentClassSink.new(handle, retain: true)
end
|
#get_sink_component_class_by_name(name) ⇒ Object
385
386
387
388
389
390
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 385
def get_sink_component_class_by_name(name)
handle = Babeltrace2.bt_plugin_borrow_sink_component_class_by_name_const(
@handle, name)
return nil if handle.null?
BTComponentClassSink.new(handle, retain: true)
end
|
#get_sink_component_class_count ⇒ Object
Also known as:
sink_component_class_count
299
300
301
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 299
def get_sink_component_class_count
Babeltrace2.bt_plugin_get_sink_component_class_count(@handle)
end
|
#get_sink_component_classes ⇒ Object
Also known as:
sink_component_classes
403
404
405
406
407
408
409
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 403
def get_sink_component_classes
sink_component_class_count.times.collect { |index|
handle = Babeltrace2.bt_plugin_borrow_sink_component_class_by_index_const(
@handle, index)
BTComponentClassSink.new(handle, retain: true)
}
end
|
#get_source_component_class(source_component_class) ⇒ Object
320
321
322
323
324
325
326
327
328
329
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 320
def get_source_component_class(source_component_class)
case source_component_class
when String
get_source_component_class_by_name(source_component_class)
when Integer
get_source_component_class_by_index(source_component_class)
else
raise TypeError, "wrong type for source component class query"
end
end
|
#get_source_component_class_by_index(index) ⇒ Object
304
305
306
307
308
309
310
311
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 304
def get_source_component_class_by_index(index)
count = get_source_component_class_count
index += count if index < 0
return nil if index >= count || index < 0
handle = Babeltrace2.bt_plugin_borrow_source_component_class_by_index_const(
@handle, index)
BTComponentClassSource.new(handle, retain: true)
end
|
#get_source_component_class_by_name(name) ⇒ Object
313
314
315
316
317
318
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 313
def get_source_component_class_by_name(name)
handle = Babeltrace2.bt_plugin_borrow_source_component_class_by_name_const(
@handle, name)
return nil if handle.null?
BTComponentClassSource.new(handle, retain: true)
end
|
#get_source_component_class_count ⇒ Object
Also known as:
source_component_class_count
289
290
291
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 289
def get_source_component_class_count
Babeltrace2.bt_plugin_get_source_component_class_count(@handle)
end
|
#get_source_component_classes ⇒ Object
Also known as:
source_component_classes
331
332
333
334
335
336
337
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 331
def get_source_component_classes
source_component_class_count.times.collect { |index|
handle = Babeltrace2.bt_plugin_borrow_source_component_class_by_index_const(
@handle, index)
BTComponentClassSource.new(handle, retain: true)
}
end
|
#get_version ⇒ Object
Also known as:
version
273
274
275
276
277
278
279
280
281
282
283
284
285
286
|
# File 'lib/babeltrace2/plugin/plugin-loading.rb', line 273
def get_version
major = FFI::MemoryPointer.new(:uint)
minor = FFI::MemoryPointer.new(:uint)
patch = FFI::MemoryPointer.new(:uint)
= FFI::MemoryPointer.new(:pointer)
res = Babeltrace2.bt_plugin_get_version(@handle, major, minor, patch, )
if res == :BT_PROPERTY_AVAILABILITY_AVAILABLE
= .read_pointer
BTVersion::Number.new(major.read_uint, minor.read_uint, patch.read_uint,
.null? ? nil : .read_string)
else
nil
end
end
|