module Babeltrace2::BTFieldClass::Enumeration

Constants

AddMappingStatus
GetMappingLabelsForValueStatus

Public Instance Methods

from_h(h) click to toggle source
Calls superclass method
# File lib/babeltrace2/trace-ir/field-class.rb, line 546
def from_h(h)
  super
  if h[:mappings]
    h[:mappings].each { |name, ranges|
      add_mapping(name, ranges)
    }
  end
  self
end
get_mapping(map) click to toggle source
# File lib/babeltrace2/trace-ir/field-class.rb, line 525
def get_mapping(map)
  case map
  when Integer
    get_mapping_by_index(map)
  when String, Symbol
    get_mapping_by_label(map)
  else
    raise "unsupported mapping query"
  end
end
Also aliased as: mapping
get_mapping_count() click to toggle source
# File lib/babeltrace2/trace-ir/field-class.rb, line 519
def get_mapping_count
  Babeltrace2.bt_field_class_enumeration_get_mapping_count(@handle)
end
Also aliased as: mapping_count, size
mapping(map)
Alias for: get_mapping
mapping_count()
Alias for: get_mapping_count
size()
Alias for: get_mapping_count
to_h() click to toggle source
Calls superclass method
# File lib/babeltrace2/trace-ir/field-class.rb, line 537
def to_h
  res = super
  res[:mappings] = get_mapping_count.times.collect { |i|
    mapping = get_mapping_by_index(i)
    [mapping.label, mapping.ranges.each.collect { |r| [r.lower, r.upper] }]
  }.to_h
  res
end