Class: Babeltrace2::BTSelfComponent::Filter

Inherits:
Babeltrace2::BTComponent::Filter show all
Includes:
Babeltrace2::BTSelfComponent
Defined in:
lib/babeltrace2/graph/self-component.rb

Defined Under Namespace

Classes: Configuration

Constant Summary

Constants included from Babeltrace2::BTSelfComponent

AddPortStatus

Constants inherited from Babeltrace2::BTComponent

Babeltrace2::BTComponent::ClassType, Babeltrace2::BTComponent::DescriptorSetAddDescriptorStatus

Instance Attribute Summary

Attributes inherited from Babeltrace2::BTObject

#handle

Instance Method Summary collapse

Methods included from Babeltrace2::BTSelfComponent

#create_clock_class, #create_trace_class, #data=, from_handle, #get_data, #get_graph_mip_version, #set_data

Methods inherited from Babeltrace2::BTComponent::Filter

#get_class, #get_input_port, #get_input_port_count, #get_output_port, #get_output_port_count, #input_ports, #output_ports

Methods inherited from Babeltrace2::BTComponent

from_handle, #get_class, #get_class_type, #get_logging_level, #get_name, #is_filter, #is_sink, #is_source

Methods inherited from Babeltrace2::BTSharedObject

inherited, #initialize

Methods inherited from Babeltrace2::BTObject

#==, #initialize, #to_ptr

Constructor Details

This class inherits a constructor from Babeltrace2::BTSharedObject

Instance Method Details

#add_input_port(name, user_data: nil) ⇒ Object



166
167
168
169
170
171
172
# File 'lib/babeltrace2/graph/self-component.rb', line 166

def add_input_port(name, user_data: nil)
  ptr = FFI::MemoryPointer.new(:pointer)
  res = Babeltrace2.bt_self_component_filter_add_input_port(@handle, name, user_data, ptr)
  raise Babeltrace2.process_error(res) if res != :BT_SELF_COMPONENT_ADD_PORT_STATUS_OK
  BTSelfComponentPortInput.new(BTSelfComponentPortInputHandle.new(ptr.read_pointer),
                               retain: false, auto_release: false)
end

#add_output_port(name, user_data: nil) ⇒ Object



158
159
160
161
162
163
164
# File 'lib/babeltrace2/graph/self-component.rb', line 158

def add_output_port(name, user_data: nil)
  ptr = FFI::MemoryPointer.new(:pointer)
  res = Babeltrace2.bt_self_component_filter_add_output_port(@handle, name, user_data, ptr)
  raise Babeltrace2.process_error(res) if res != :BT_SELF_COMPONENT_ADD_PORT_STATUS_OK
  BTSelfComponentPortOutput.new(BTSelfComponentPortOutputHandle.new(ptr.read_pointer),
                                retain: false, auto_release: false)
end

#get_input_port_by_index(index) ⇒ Object



188
189
190
191
192
193
194
# File 'lib/babeltrace2/graph/self-component.rb', line 188

def get_input_port_by_index(index)
  count = get_input_port_count
  index += count if index < 0
  return nil if index >= count || index < 0
  handle = Babeltrace2.bt_self_component_filter_borrow_input_port_by_index(@handle, index)
  BTSelfComponentPortInput.new(handle, retain: false, auto_release: false)
end

#get_input_port_by_name(name) ⇒ Object



196
197
198
199
200
# File 'lib/babeltrace2/graph/self-component.rb', line 196

def get_input_port_by_name(name)
  handle = Babeltrace2.bt_self_component_filter_borrow_input_port_by_name(@handle, name)
  return nil if handle.null?
  BTSelfComponentPortInput.new(handle, retain: false, auto_release: false)
end

#get_output_port_by_index(index) ⇒ Object



174
175
176
177
178
179
180
# File 'lib/babeltrace2/graph/self-component.rb', line 174

def get_output_port_by_index(index)
  count = get_output_port_count
  index += count if index < 0
  return nil if index >= count || index < 0
  handle = Babeltrace2.bt_self_component_filter_borrow_output_port_by_index(@handle, index)
  BTSelfComponentPortOutput.new(handle, retain: false, auto_release: false)
end

#get_output_port_by_name(name) ⇒ Object



182
183
184
185
186
# File 'lib/babeltrace2/graph/self-component.rb', line 182

def get_output_port_by_name(name)
  handle = Babeltrace2.bt_self_component_filter_borrow_output_port_by_name(@handle, name)
  return nil if handle.null?
  BTSelfComponentPortOutput.new(handle, retain: false, auto_release: false)
end