Class: Babeltrace2::BTComponentClass::Source

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

Constant Summary

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, message_iterator_class: nil) ⇒ Source

Returns a new instance of Source.



506
507
508
509
510
511
512
513
514
515
516
517
518
# File 'lib/babeltrace2/graph/component-class-dev.rb', line 506

def initialize(handle = nil, retain: true, auto_release: true,
               name: nil, message_iterator_class: 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 message_iterator_class" unless message_iterator_class
    handle = Babeltrace2.bt_component_class_source_create(
      name, message_iterator_class)
    raise Babeltrace2.process_error if handle.null?
    super(handle, retain: false)
  end
end

Instance Method Details

#output_port_connected_method=(method) ⇒ Object



565
566
567
568
# File 'lib/babeltrace2/graph/component-class-dev.rb', line 565

def output_port_connected_method=(method)
  set_output_port_connected_method(method)
  method
end

#set_output_port_connected_method(method, &block) ⇒ Object



554
555
556
557
558
559
560
561
562
563
# File 'lib/babeltrace2/graph/component-class-dev.rb', line 554

def set_output_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_source_output_port_connected_method(@handle, method)
  res = Babeltrace2.bt_component_class_source_set_output_port_connected_method(@handle, method)
  raise Babeltrace2.process_error(res) if res != :BT_COMPONENT_CLASS_SET_METHOD_STATUS_OK
  self
end