class Babeltrace2::BTFieldClass::Enumeration::Unsigned
Public Class Methods
from_h(trace_class, h, stream_class_h = nil)
click to toggle source
# File lib/babeltrace2/trace-ir/field-class.rb, line 619 def self.from_h(trace_class, h, stream_class_h = nil) o = self.new(trace_class: trace_class).from_h(h) h[:bt_field_class] = o o end
new(handle = nil, retain: true, auto_release: true, trace_class: nil)
click to toggle source
Calls superclass method
Babeltrace2::BTFieldClass::Integer::Unsigned::new
# File lib/babeltrace2/trace-ir/field-class.rb, line 608 def initialize(handle = nil, retain: true, auto_release: true, trace_class: nil) if handle super(handle, retain: retain, auto_release: auto_release) else handle = Babeltrace2.bt_field_class_enumeration_unsigned_create(trace_class) raise Babeltrace2.process_error if handle.null? super(handle, retain: false) end end
Public Instance Methods
add_mapping(label, ranges)
click to toggle source
# File lib/babeltrace2/trace-ir/field-class.rb, line 625 def add_mapping(label, ranges) label = label.inspect if label.kind_of?(Symbol) ranges = BTIntegerRangeSetUnsigned.from_value(ranges) res = Babeltrace2.bt_field_class_enumeration_unsigned_add_mapping( @handle, label, ranges) raise Babeltrace2.process_error(res) if res != :BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_OK self end
get_mapping_by_index(index)
click to toggle source
# File lib/babeltrace2/trace-ir/field-class.rb, line 634 def get_mapping_by_index(index) count = get_mapping_count index += count if index < 0 return nil if index >= count || index < 0 handle = Babeltrace2.bt_field_class_enumeration_unsigned_borrow_mapping_by_index_const( @handle, index) BTFieldClassEnumerationUnsignedMapping.new(handle) end
get_mapping_by_label(label)
click to toggle source
# File lib/babeltrace2/trace-ir/field-class.rb, line 644 def get_mapping_by_label(label) label = label.inspect if label.kind_of?(Symbol) handle = Babeltrace2.bt_field_class_enumeration_unsigned_borrow_mapping_by_label_const( @handle, label) BTFieldClassEnumerationUnsignedMapping.new(handle) end
get_mapping_labels_for_value(value)
click to toggle source
# File lib/babeltrace2/trace-ir/field-class.rb, line 652 def get_mapping_labels_for_value(value) ptr1 = FFI::MemoryPointer.new(:pointer) ptr2 = FFI::MemoryPointer.new(:uint64) res = Babeltrace2.bt_field_class_enumeration_unsigned_get_mapping_labels_for_value( @handle, value, ptr1, ptr2) raise Babeltrace2.process_error(res) if res != :BT_FIELD_CLASS_ENUMERATION_GET_MAPPING_LABELS_BY_VALUE_STATUS_OK count = ptr2.read_uint64 return [] if count == 0 ptr1 = ptr1.read_pointer ptr1.read_array_of_pointer(count).collect.collect { |v| v = v.read_string v[0] == ':' ? v[1..-1].to_sym : v } end
Also aliased as: mapping_labels_for_value