Class: Babeltrace2::BTComponentClass

Inherits:
BTSharedObject show all
Defined in:
lib/babeltrace2/graph/component-class.rb,
lib/babeltrace2/graph/component-class.rb,
lib/babeltrace2/graph/component-class.rb,
lib/babeltrace2/graph/component-class.rb,
lib/babeltrace2/graph/component-class-dev.rb

Direct Known Subclasses

Filter, Sink, Source

Defined Under Namespace

Classes: Filter, Sink, Source

Constant Summary collapse

Type =
BTComponentClassType
SinkConsumeMethodStatus =
BTComponentClassSinkConsumeMethodStatus
GetSupportedMipVersionsMethodStatus =
BTComponentClassGetSupportedMipVersionsMethodStatus
SinkGraphIsConfiguredMethodStatus =
BTComponentClassSinkGraphIsConfiguredMethodStatus
PortConnectedMethodStatus =
BTComponentClassPortConnectedMethodStatus
QueryMethodStatus =
BTComponentClassQueryMethodStatus
SetMethodStatus =
BTComponentClassSetMethodStatus
SetDescriptionStatus =
BTComponentClassSetDescriptionStatus
SetHelpStatus =
BTComponentClassSetHelpStatus

Instance Attribute Summary

Attributes inherited from BTObject

#handle

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BTSharedObject

inherited, #initialize

Methods inherited from BTObject

#==, #initialize, #to_ptr

Constructor Details

This class inherits a constructor from Babeltrace2::BTSharedObject

Class Method Details

.from_handle(handle, retain: true, auto_release: true) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/babeltrace2/graph/component-class.rb', line 38

def self.from_handle(handle, retain: true, auto_release: true)
  case Babeltrace2.bt_component_class_get_type(handle)
  when :BT_COMPONENT_CLASS_TYPE_SOURCE
    handle = BTComponentClassSourceHandle.new(handle)
    BTComponentClassSource
  when :BT_COMPONENT_CLASS_TYPE_FILTER
    handle = BTComponentClassFilterHandle.new(handle)
    BTComponentClassFilter
  when :BT_COMPONENT_CLASS_TYPE_SINK
    handle = BTComponentClassSinkHandle.new(handle)
    BTComponentClassSink
  else
    raise Error.new("Unknown component class type")
  end.new(handle, retain: retain, auto_release: auto_release)
end

Instance Method Details

#description=(description) ⇒ Object



397
398
399
400
# File 'lib/babeltrace2/graph/component-class-dev.rb', line 397

def description=(description)
  set_description(description)
  description
end

#finalize_method=(method) ⇒ Object



425
426
427
428
# File 'lib/babeltrace2/graph/component-class-dev.rb', line 425

def finalize_method=(method)
  set_finalize_method(method)
  method
end

#get_descriptionObject Also known as: description



79
80
81
# File 'lib/babeltrace2/graph/component-class.rb', line 79

def get_description
  Babeltrace2.bt_component_class_get_description(@handle)
end

#get_helpObject Also known as: help



84
85
86
# File 'lib/babeltrace2/graph/component-class.rb', line 84

def get_help
  Babeltrace2.bt_component_class_get_help(@handle)
end

#get_nameObject Also known as: name



74
75
76
# File 'lib/babeltrace2/graph/component-class.rb', line 74

def get_name
  Babeltrace2.bt_component_class_get_name(@handle)
end

#get_supported_mip_versions_method=(method) ⇒ Object



441
442
443
444
# File 'lib/babeltrace2/graph/component-class-dev.rb', line 441

def get_supported_mip_versions_method=(method)
  set_get_supported_mip_versions_method(method)
  method
end

#get_typeObject Also known as: type



54
55
56
# File 'lib/babeltrace2/graph/component-class.rb', line 54

def get_type
  Babeltrace2.bt_component_class_get_type(@handle)
end

#help=(help_text) ⇒ Object



409
410
411
412
# File 'lib/babeltrace2/graph/component-class-dev.rb', line 409

def help=(help_text)
  set_help(help_text)
  help_text
end

#initialize_method=(method) ⇒ Object



457
458
459
460
# File 'lib/babeltrace2/graph/component-class-dev.rb', line 457

def initialize_method=(method)
  set_initialize_method(method)
  method
end

#is_filterObject Also known as: filter?



64
65
66
# File 'lib/babeltrace2/graph/component-class.rb', line 64

def is_filter
  get_type == :BT_COMPONENT_CLASS_TYPE_FILTER
end

#is_sinkObject Also known as: sink?



69
70
71
# File 'lib/babeltrace2/graph/component-class.rb', line 69

def is_sink
  get_type == :BT_COMPONENT_CLASS_TYPE_SINK
end

#is_sourceObject Also known as: source?



59
60
61
# File 'lib/babeltrace2/graph/component-class.rb', line 59

def is_source
  get_type == :BT_COMPONENT_CLASS_TYPE_SOURCE
end

#query_method=(method) ⇒ Object



473
474
475
476
# File 'lib/babeltrace2/graph/component-class-dev.rb', line 473

def query_method=(method)
  set_query_method(method)
  method
end

#set_description(description) ⇒ Object

Raises:

  • (ArgumentError)


390
391
392
393
394
395
# File 'lib/babeltrace2/graph/component-class-dev.rb', line 390

def set_description(description)
  raise ArgumentError, "description is nil" unless description
  res = Babeltrace2.bt_component_class_set_description(@handle, description)
  raise Babeltrace2.process_error(res) if res != :BT_COMPONENT_CLASS_SET_DESCRIPTION_STATUS_OK
  self
end

#set_finalize_method(method = nil, &block) ⇒ Object



414
415
416
417
418
419
420
421
422
423
# File 'lib/babeltrace2/graph/component-class-dev.rb', line 414

def set_finalize_method(method = nil, &block)
  if method.nil?
    raise ArgumentError, "method or block must be provided" unless block_given?
    method = block
  end
  method = _wrap_finalize_method(method)
  res = _set_finalize_method(method)
  raise Babeltrace2.process_error(res) if res != :BT_COMPONENT_CLASS_SET_METHOD_STATUS_OK
  self
end

#set_get_supported_mip_versions_method(method = nil, &block) ⇒ Object



430
431
432
433
434
435
436
437
438
439
# File 'lib/babeltrace2/graph/component-class-dev.rb', line 430

def set_get_supported_mip_versions_method(method = nil, &block)
  if method.nil?
    raise ArgumentError, "method or block must be provided" unless block_given?
    method = block
  end
  method = _wrap_get_supported_mip_versions_method(method)
  res = _set_get_supported_mip_versions_method(method)
  raise Babeltrace2.process_error(res) if res != :BT_COMPONENT_CLASS_SET_METHOD_STATUS_OK
  self
end

#set_help(help_text) ⇒ Object

Raises:

  • (ArgumentError)


402
403
404
405
406
407
# File 'lib/babeltrace2/graph/component-class-dev.rb', line 402

def set_help(help_text)
  raise ArgumentError, "help_text is nil" unless help_text
  res = Babeltrace2.bt_component_class_set_help(@handle, help_text)
  raise Babeltrace2.process_error(res) if res != :BT_COMPONENT_CLASS_SET_HELP_STATUS_OK
  self
end

#set_initialize_method(method = nil, &block) ⇒ Object



446
447
448
449
450
451
452
453
454
455
# File 'lib/babeltrace2/graph/component-class-dev.rb', line 446

def set_initialize_method(method = nil, &block)
  if method.nil?
    raise ArgumentError, "method or block must be provided" unless block_given?
    method = block
  end
  method = _wrap_initialize_method(method)
  res = _set_initialize_method(method)
  raise Babeltrace2.process_error(res) if res != :BT_COMPONENT_CLASS_SET_METHOD_STATUS_OK
  self
end

#set_query_method(method = nil, &block) ⇒ Object



462
463
464
465
466
467
468
469
470
471
# File 'lib/babeltrace2/graph/component-class-dev.rb', line 462

def set_query_method(method = nil, &block)
  if method.nil?
    raise ArgumentError, "method or block must be provided" unless block_given?
    method = block
  end
  method = _wrap_query_method(method)
  res = _set_query_method(method)
  raise Babeltrace2.process_error(res) if res != :BT_COMPONENT_CLASS_SET_METHOD_STATUS_OK
  self
end