module Babeltrace2::BTSelfComponent::Class

Public Class Methods

from_handle(handle, retain: true, auto_release: true) click to toggle source
# File lib/babeltrace2/graph/self-component-class.rb, line 4
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 = BTSelfComponentClassSourceHandle.new(handle)
    BTSelfComponentClassSource
  when :BT_COMPONENT_CLASS_TYPE_FILTER
    handle = BTSelfComponentClassFilterHandle.new(handle)
    BTSelfComponentClassFilter
  when :BT_COMPONENT_CLASS_TYPE_SINK
    handle = BTSelfComponentClassSinkHandle.new(handle)
    BTSelfComponentClassSink
  else
    raise Error.new("Unknown component class type")
  end.new(handle, retain: retain, auto_release: auto_release)
end