lib: add support for bit array flags
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 22 Jan 2024 21:20:58 +0000 (21:20 +0000)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 4 Sep 2024 19:05:14 +0000 (15:05 -0400)
commite52d2ed9ff78516f9fdb3e7d508b833b1973fdf4
tree80281f4c57210424e4bca22331fe2f598e045887
parentc33d46d29c33a9fe675cc333199098a4e3c51513
lib: add support for bit array flags

Implement support for flags on bit array field classes, in order to
be able to add support for the fixed-length bit map field class (as
specified by CTF2-SPEC-2.0 [1]) in the CTF component classes.

A flag is a mapping between bit positions in a fixed-length bit map
field and a textual label.  A flag is considered active for a given
field if any of the bits in the flag's bit positions is set in the
field.  Flags may have overlapping bit positions, meaning that a single
bit can activate multiple flags.

Add the following public functions operating on bit array field classes:

 ðŸ¥‘ bt_field_class_bit_array_add_flag
 ðŸ¥‘ bt_field_class_bit_array_get_flag_count
 ðŸ¥‘ bt_field_class_bit_array_borrow_flag_by_index_const
 ðŸ¥‘ bt_field_class_bit_array_borrow_flag_by_label_const
 ðŸ¥‘ bt_field_class_bit_array_get_active_flag_labels_for_value_as_integer

Add the bt_field_class_bit_array_flag type.  Then, add the following
public functions operating on it:

 ðŸ¥‘ bt_field_class_bit_array_flag_get_label
 ðŸ¥‘ bt_field_class_bit_array_flag_borrow_index_ranges_const

Add the following public function operating on a bit array field:

 ðŸ¥‘ bt_field_bit_array_get_active_flag_labels

The
`bt_field_class_bit_array_get_active_flag_labels_for_value_as_integer`
function returns an array of label through an output parameter of type
`bt_field_class_bit_array_flag_label_array`.  The storage for it is
owned by the field class, so the result is only valid until the next
call to the function (or until the field class gets destroyed).  This
behavior is copied from the enum field class.

Philippe updated the documentation.

[1]: https://diamon.org/ctf/CTF2-SPEC-2.0.html

Change-Id: Ib88f3aecf692ea8b6453c0308fa7735fd40e55a9
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12727
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
include/babeltrace2/trace-ir/field-class.h
include/babeltrace2/trace-ir/field.h
include/babeltrace2/types.h
src/lib/lib-logging.c
src/lib/trace-ir/field-class.c
src/lib/trace-ir/field-class.h
src/lib/trace-ir/field.c
This page took 0.024775 seconds and 4 git commands to generate.