Class: Babeltrace2::BTFieldClass::Option::WithSelectorField::IntegerUnsigned
- Inherits:
-
Babeltrace2::BTFieldClass::Option::WithSelectorField
- Object
- Babeltrace2::BTObject
- Babeltrace2::BTSharedObject
- Babeltrace2::BTFieldClass
- Babeltrace2::BTFieldClass::Option
- Babeltrace2::BTFieldClass::Option::WithSelectorField
- Babeltrace2::BTFieldClass::Option::WithSelectorField::IntegerUnsigned
- Defined in:
- lib/babeltrace2/trace-ir/field-class.rb
Constant Summary
Constants inherited from Babeltrace2::BTFieldClass
IntegerSigned, IntegerUnsigned, RealDoublePrecision, RealSinglePrecision, TYPE_MAP
Instance Attribute Summary
Attributes inherited from Babeltrace2::BTObject
Class Method Summary collapse
Instance Method Summary collapse
- #get_selector_ranges ⇒ Object (also: #selector_ranges)
-
#initialize(handle = nil, retain: true, auto_release: true, trace_class: nil, optional_field_class: nil, selector_field_class: nil, ranges: nil) ⇒ IntegerUnsigned
constructor
A new instance of IntegerUnsigned.
- #to_h ⇒ Object
Methods inherited from Babeltrace2::BTFieldClass::Option::WithSelectorField
Methods inherited from Babeltrace2::BTFieldClass::Option
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
Methods inherited from Babeltrace2::BTObject
Constructor Details
#initialize(handle = nil, retain: true, auto_release: true, trace_class: nil, optional_field_class: nil, selector_field_class: nil, ranges: nil) ⇒ IntegerUnsigned
Returns a new instance of IntegerUnsigned.
1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 |
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 1276 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 = BTIntegerRangeSetUnsigned.from_value(ranges) handle = Babeltrace2.bt_field_class_option_with_selector_field_integer_unsigned_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
1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 |
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 1303 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_ranges ⇒ Object Also known as: selector_ranges
1290 1291 1292 1293 1294 |
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 1290 def get_selector_ranges BTIntegerRangeSetUnsigned.new( Babeltrace2.bt_field_class_option_with_selector_field_integer_unsigned_borrow_selector_ranges_const( @handle), retain: true) end |
#to_h ⇒ Object
1297 1298 1299 1300 1301 |
# File 'lib/babeltrace2/trace-ir/field-class.rb', line 1297 def to_h res = super res[:selector_ranges] = selector_ranges.each.collect { |r| [r.lower, r.upper] } res end |