Class: Babeltrace2::BTComponentClass::Sink

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

Constant Summary collapse

ConsumeMethodStatus =
BTComponentClassSinkConsumeMethodStatus
GraphIsConfiguredMethodStatus =
BTComponentClassSinkGraphIsConfiguredMethodStatus

Constants inherited from Babeltrace2::BTComponentClass

GetSupportedMipVersionsMethodStatus, PortConnectedMethodStatus, QueryMethodStatus, SetDescriptionStatus, SetHelpStatus, SetMethodStatus, SinkConsumeMethodStatus, SinkGraphIsConfiguredMethodStatus, Type

Instance Attribute Summary

Attributes inherited from Babeltrace2::BTObject

#handle

Instance Method Summary collapse

Methods inherited from Babeltrace2::BTComponentClass

#description=, #finalize_method=, from_handle, #get_description, #get_help, #get_name, #get_supported_mip_versions_method=, #get_type, #help=, #initialize_method=, #is_filter, #is_sink, #is_source, #query_method=, #set_description, #set_finalize_method, #set_get_supported_mip_versions_method, #set_help, #set_initialize_method, #set_query_method

Methods inherited from Babeltrace2::BTSharedObject

inherited

Methods inherited from Babeltrace2::BTObject

#==, #to_ptr

Constructor Details

#initialize(handle = nil, retain: true, auto_release: true, name: nil, consume_method: nil) ⇒ Sink

Returns a new instance of Sink.



719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
# File 'lib/babeltrace2/graph/component-class-dev.rb', line 719

def initialize(handle = nil, retain: true, auto_release: true,
               name: nil, consume_method: nil)
  if handle
    super(handle, retain: retain, auto_release: auto_release)
  else
    raise ArgumentError, "invalid value for name" unless name
    raise ArgumentError, "invalid value for consume_method" unless consume_method
    consume_method = Babeltrace2._wrap_component_class_sink_consume_method(consume_method)
    handle = Babeltrace2.bt_component_class_sink_create(
      name, consume_method)
    raise Babeltrace2.process_error if handle.null?
    Babeltrace2._callbacks[handle.to_i][:consume_method] = consume_method
    super(handle, retain: false)
  end
end

Instance Method Details

#graph_is_configured_method=(method) ⇒ Object



780
781
782
783
# File 'lib/babeltrace2/graph/component-class-dev.rb', line 780

def graph_is_configured_method=(method)
  set_graph_is_configured_method(method)
  method
end

#input_port_connected_method=(method) ⇒ Object



796
797
798
799
# File 'lib/babeltrace2/graph/component-class-dev.rb', line 796

def input_port_connected_method=(method)
  set_input_port_connected_method(method)
  method
end

#set_graph_is_configured_method(method, &block) ⇒ Object



769
770
771
772
773
774
775
776
777
778
# File 'lib/babeltrace2/graph/component-class-dev.rb', line 769

def set_graph_is_configured_method(method, &block)
  if method.nil?
    raise ArgumentError, "method or block must be provided" unless block_given?
    method = block
  end
  method = Babeltrace2._wrap_component_class_sink_graph_is_configured_method(@handle, method)
  res = Babeltrace2.bt_component_class_sink_set_graph_is_configured_method(@handle, method)
  raise Babeltrace2.process_error(res) if res != :BT_COMPONENT_CLASS_SET_METHOD_STATUS_OK
  self
end

#set_input_port_connected_method(method, &block) ⇒ Object



785
786
787
788
789
790
791
792
793
794
# File 'lib/babeltrace2/graph/component-class-dev.rb', line 785

def set_input_port_connected_method(method, &block)
  if method.nil?
    raise ArgumentError, "method or block must be provided" unless block_given?
    method = block
  end
  method = Babeltrace2._wrap_component_class_sink_input_port_connected_method(@handle, method)
  res = Babeltrace2.bt_component_class_sink_set_input_port_connected_method(@handle, method)
  raise Babeltrace2.process_error(res) if res != :BT_COMPONENT_CLASS_SET_METHOD_STATUS_OK
  self
end