Class: Babeltrace2::BTFieldClass::Option::WithSelectorField::IntegerSigned

Constant Summary

Constants inherited from Babeltrace2::BTFieldClass

IntegerSigned, IntegerUnsigned, RealDoublePrecision, RealSinglePrecision, TYPE_MAP

Instance Attribute Summary

Attributes inherited from Babeltrace2::BTObject

#handle

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Babeltrace2::BTFieldClass::Option::WithSelectorField

#get_selector_field_path

Methods inherited from Babeltrace2::BTFieldClass::Option

#get_field_class

Methods inherited from Babeltrace2::BTFieldClass

#from_h, from_handle, #get_type, #get_user_attributes, #set_user_attributes, #type_is, #user_attributes=

Methods inherited from Babeltrace2::BTSharedObject

inherited

Methods inherited from Babeltrace2::BTObject

#==, #to_ptr

Constructor Details

#initialize(handle = nil, retain: true, auto_release: true, trace_class: nil, optional_field_class: nil, selector_field_class: nil, ranges: nil) ⇒ IntegerSigned

Returns a new instance of IntegerSigned.



1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 1334

def initialize(handle = nil, retain: true, auto_release: true,
               trace_class: nil, optional_field_class: nil, selector_field_class: nil,
               ranges: nil)
  if handle
    super(handle, retain: retain, auto_release: auto_release)
  else
    ranges = BTIntegerRangeSetSigned.from_value(ranges)
    handle = Babeltrace2.bt_field_class_option_with_selector_field_integer_signed_create(
               trace_class, optional_field_class, selector_field_class, ranges)
    raise Babeltrace2.process_error if handle.null?
    super(handle, retain: false)
  end
end

Class Method Details

.from_h(trace_class, h, stream_class_h = nil) ⇒ Object



1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 1361

def self.from_h(trace_class, h, stream_class_h = nil)
  if (stream_class_h && h[:selector_field_path])
    selector_field_class = BTStreamClass.locate_field_class( 
      BTFieldPath.path_from_s_to_h(h[:selector_field_path]), stream_class_h)
  else
    selector_field_class = nil
  end
  o = self.new(trace_class: trace_class,
    optional_field_class: BTFieldClass.from_h(trace_class,
                                              h[:field_class],
                                              stream_class_h),
    selector_field_class: selector_field_class,
    ranges: h[:selector_ranges]).from_h(h)
  h[:bt_field_class] = o
  o
end

Instance Method Details

#get_selector_rangesObject Also known as: selector_ranges



1348
1349
1350
1351
1352
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 1348

def get_selector_ranges
  BTIntegerRangeSetSigned.new(
    Babeltrace2.bt_field_class_option_with_selector_field_integer_signed_borrow_selector_ranges_const(
      @handle), retain: true)
end

#to_hObject



1355
1356
1357
1358
1359
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 1355

def to_h
  res = super
  res[:selector_ranges] = selector_ranges.each.collect { |r| [r.lower, r.upper] }
  res
end