lib: have dedicated, unique unsigned and signed enum FC mapping objects
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 24 Apr 2019 05:00:45 +0000 (01:00 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 26 Apr 2019 03:25:15 +0000 (03:25 +0000)
commit2d97b62eea05c08e6e276f70af538ec49ef7a680
tree91d818f24be59c5608f86e8bf2afbe82a1a0c6b2
parente08b7753aaaf817c9dac73cb6d68175737b6c8a4
lib: have dedicated, unique unsigned and signed enum FC mapping objects

This patch makes the enumeration field class mapping API aligned with
the structure field class member and variant field class option APIs. In
other words, a signed or an unsigned enumeration field class mapping is
now a dedicated type. An enumeration field class mapping object is
unique and always belongs to its parent field class.

bt_field_class_unsigned_enumeration_borrow_mapping_by_index_const() and
bt_field_class_signed_enumeration_borrow_mapping_by_index_const() now
return borrowed enumeration field class mapping objects.

You can use
bt_field_class_unsigned_enumeration_mapping_as_mapping_const() to change
a signed or unsigned enumeration field class mapping into a generic
enumeration field class mapping. The API for a generic enumeration field
class mapping is:

    const char *bt_field_class_enumeration_mapping_get_label(
        const bt_field_class_enumeration_mapping *mapping);

    uint64_t bt_field_class_enumeration_mapping_get_range_count(
        const bt_field_class_enumeration_mapping *mapping);

You cannot create an enumeration field class mapping object: you still
map a name to a specific range with
bt_field_class_unsigned_enumeration_map_range() and
bt_field_class_signed_enumeration_map_range().

This patch also makes the `flt.lttng-utils.debug-info` and `sink.ctf.fs`
component classes use the updated API.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Iba5da648ca69ec0ca0c5df09a9f383dd4b1e3972
Reviewed-on: https://review.gerrithub.io/c/eepp/babeltrace/+/451996
include/babeltrace/trace-ir/field-class-const.h
include/babeltrace/trace-ir/field-class-internal.h
include/babeltrace/types.h
lib/trace-ir/field-class.c
plugins/ctf/fs-sink/translate-ctf-ir-to-tsdl.c
plugins/lttng-utils/debug-info/trace-ir-metadata-field-class-copy.c
This page took 0.033806 seconds and 5 git commands to generate.