+ if ptr is None:
+ return
+
+ return bt2_field_path._FieldPathConst._create_from_ptr_and_get_ref(ptr)
+
+
+class _OptionWithBoolSelectorFieldClassConst(_OptionWithSelectorFieldClassConst):
+ _NAME = "Const option (with boolean selector)"
+
+ @property
+ def selector_is_reversed(self):
+ return bool(
+ native_bt.field_class_option_with_selector_field_bool_selector_is_reversed(
+ self._ptr
+ )
+ )
+
+
+class _OptionWithIntegerSelectorFieldClassConst(_OptionWithSelectorFieldClassConst):
+ _NAME = "Const option (with integer selector)"
+
+ @property
+ def ranges(self):
+ range_set_ptr = self._borrow_selector_ranges_ptr(self._ptr)
+ assert range_set_ptr is not None
+ return self._range_set_pycls._create_from_ptr_and_get_ref(range_set_ptr)
+
+
+class _OptionWithUnsignedIntegerSelectorFieldClassConst(
+ _OptionWithIntegerSelectorFieldClassConst
+):
+ _NAME = "Const option (with unsigned integer selector)"
+ _range_set_pycls = bt2_integer_range_set._UnsignedIntegerRangeSetConst
+ _borrow_selector_ranges_ptr = staticmethod(
+ native_bt.field_class_option_with_selector_field_integer_unsigned_borrow_selector_ranges_const
+ )
+
+
+class _OptionWithSignedIntegerSelectorFieldClassConst(
+ _OptionWithIntegerSelectorFieldClassConst
+):
+ _NAME = "Const option (with signed integer selector)"
+ _range_set_pycls = bt2_integer_range_set._SignedIntegerRangeSetConst
+ _borrow_selector_ranges_ptr = staticmethod(
+ native_bt.field_class_option_with_selector_field_integer_signed_borrow_selector_ranges_const
+ )
+
+
+class _OptionFieldClass(_OptionFieldClassConst, _FieldClass):
+ _NAME = "Option"
+ _borrow_field_class_ptr = staticmethod(
+ native_bt.field_class_option_borrow_field_class
+ )
+ _create_field_class_from_ptr_and_get_ref = staticmethod(
+ _create_field_class_from_ptr_and_get_ref
+ )
+
+
+class _OptionWithSelectorFieldClass(
+ _OptionWithSelectorFieldClassConst, _OptionFieldClass
+):
+ _NAME = "Option (with selector)"
+
+
+class _OptionWithBoolSelectorFieldClass(
+ _OptionWithBoolSelectorFieldClassConst, _OptionWithSelectorFieldClass
+):
+ _NAME = "Option (with boolean selector)"
+
+ def _selector_is_reversed(self, selector_is_reversed):
+ utils._check_bool(selector_is_reversed)
+ native_bt.field_class_option_with_selector_field_bool_set_selector_is_reversed(
+ self._ptr, selector_is_reversed
+ )
+
+ _selector_is_reversed = property(fset=_selector_is_reversed)
+
+
+class _OptionWithIntegerSelectorFieldClass(
+ _OptionWithIntegerSelectorFieldClassConst, _OptionWithSelectorFieldClass
+):
+ _NAME = "Option (with integer selector)"
+
+
+class _OptionWithUnsignedIntegerSelectorFieldClass(
+ _OptionWithUnsignedIntegerSelectorFieldClassConst,
+ _OptionWithIntegerSelectorFieldClass,
+):
+ _NAME = "Option (with unsigned integer selector)"
+