bt2: add option field class and field support
This patch adds option field class and field support to the Python
bindings.
You can create an option field class with
_TraceClass.create_option_field_class(). This method requires the
optional field class and also accepts an optional selector field class
(just like the library's equivalent bt_field_class_option_create()
function).
An option field class only has the `field_class` (the optional field
class) and `selector_field_path` (can be `None`) properties.
An option field is similar to a variant field:
* You can use the `has_field` property to set whether or not the option
field has an optional field.
* You can access the optional field with the `field` property, which
returns `None` when the option field has no field.
* The __bool__() operator of an option field is the equivalent of the
`has_field` property.
* You can use the `value` property (write only, like
`_VariantField.value`) to assign a value to the optional field. This
property also sets `has_field` to `True` so it's always safe to use.
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I90aa9ef2dbcb7422ee25aaeb191a18fd9fa4998b
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1902
Tested-by: jenkins <jenkins@lttng.org>
This page took 0.025721 seconds and 4 git commands to generate.