class Babeltrace2::BTField::Variant
Public Instance Methods
get_option_count()
click to toggle source
# File lib/babeltrace2/trace-ir/field.rb, line 798 def get_option_count @option_count ||= get_class.get_option_count end
Also aliased as: option_count
get_selected_option_class()
click to toggle source
# File lib/babeltrace2/trace-ir/field.rb, line 824 def get_selected_option_class handle = Babeltrace2.bt_field_variant_borrow_selected_option_class_const(@handle) return nil if handle.null? BTFieldClassVariantOption.new(handle) end
Also aliased as: selected_option_class
get_selected_option_field()
click to toggle source
# File lib/babeltrace2/trace-ir/field.rb, line 812 def get_selected_option_field handle = Babeltrace2.bt_field_variant_borrow_selected_option_field(@handle) return nil if handle.null? BTField.from_handle(handle) end
Also aliased as: selected_option_field
get_selected_option_index()
click to toggle source
# File lib/babeltrace2/trace-ir/field.rb, line 819 def get_selected_option_index Babeltrace2.bt_field_variant_get_selected_option_index(@handle) end
Also aliased as: selected_option_index
select_option_by_index(index)
click to toggle source
# File lib/babeltrace2/trace-ir/field.rb, line 803 def select_option_by_index(index) count = get_option_count index += count if index < 0 raise "invalid index" if index >= count || index < 0 res = Babeltrace2.bt_field_variant_select_option_by_index(@handle, index) raise Babeltrace2.process_error(res) if res != :BT_FIELD_VARIANT_SELECT_OPTION_STATUS_OK self end
to_s()
click to toggle source
# File lib/babeltrace2/trace-ir/field.rb, line 837 def to_s s = "{" opt = get_selected_option_field if opt name = selected_option_class.name name = name.inspect if name.kind_of?(Symbol) s << "#{name}: #{opt.to_s}" end s << "}" end
value()
click to toggle source
# File lib/babeltrace2/trace-ir/field.rb, line 831 def value f = get_selected_option_field return nil unless f { selected_option_class.name => f.value } end