Class: Babeltrace2::BTComponent

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

Direct Known Subclasses

Filter, Sink, Source

Defined Under Namespace

Classes: DescriptorSet, Filter, Sink, Source

Constant Summary collapse

ClassType =
BTComponentClassType
DescriptorSetAddDescriptorStatus =
BTComponentDescriptorSetAddDescriptorStatus

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



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/babeltrace2/graph/component.rb', line 32

def self.from_handle(handle, retain: true, auto_release: true)
  case Babeltrace2.bt_component_get_class_type(handle)
  when :BT_COMPONENT_CLASS_TYPE_SOURCE
    handle = BTComponentSourceHandle.new(handle)
    BTComponentSource
  when :BT_COMPONENT_CLASS_TYPE_FILTER
    handle = BTComponentFilterHandle.new(handle)
    BTComponentFilter
  when :BT_COMPONENT_CLASS_TYPE_SINK
    handle = BTComponentSinkHandle.new(handle)
    BTComponentSink
  else
    raise Error.new("unknown component class type")
  end.new(handle, retain: retain, auto_release: auto_release)
end

Instance Method Details

#get_classObject



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

def get_class
  handle = Babeltrace2.bt_component_borrow_class_const(@handle)
  BTComponentClass.from_handle(handle)
end

#get_class_typeObject Also known as: class_type



48
49
50
# File 'lib/babeltrace2/graph/component.rb', line 48

def get_class_type
  Babeltrace2.bt_component_get_class_type(@handle)
end

#get_logging_levelObject Also known as: logging_level



78
79
80
# File 'lib/babeltrace2/graph/component.rb', line 78

def get_logging_level
  Babeltrace2.bt_component_get_logging_level(@handle)
end

#get_nameObject Also known as: name



73
74
75
# File 'lib/babeltrace2/graph/component.rb', line 73

def get_name
  Babeltrace2.bt_component_get_name(@handle)
end

#is_filterObject Also known as: filter?



58
59
60
# File 'lib/babeltrace2/graph/component.rb', line 58

def is_filter
  get_class_type == :BT_COMPONENT_CLASS_TYPE_FILTER
end

#is_sinkObject Also known as: sink?



63
64
65
# File 'lib/babeltrace2/graph/component.rb', line 63

def is_sink
  get_class_type == :BT_COMPONENT_CLASS_TYPE_SINK
end

#is_sourceObject Also known as: source?



53
54
55
# File 'lib/babeltrace2/graph/component.rb', line 53

def is_source
  get_class_type == :BT_COMPONENT_CLASS_TYPE_SOURCE
end