lib: add bt_field_class_variant_borrow_option_by_{index,name}()
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 14 Aug 2019 02:01:03 +0000 (22:01 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 15 Aug 2019 15:41:44 +0000 (11:41 -0400)
Those are non-const versions of the existing
bt_field_class_variant_borrow_option_by_index_const() and
bt_field_class_variant_borrow_option_by_name_const().

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I322c202c35d815012d2f6de494dce76a161692e4
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1920
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
include/babeltrace2/trace-ir/field-class.h
src/lib/trace-ir/field-class.c

index f4f722c38055d72f8e84792e1693afaf6415ecc2..083facbe7b3d6fa79313bb2e6b4d428a6ce224a4 100644 (file)
@@ -155,6 +155,14 @@ bt_field_class_variant_with_selector_signed_append_option(
                bt_field_class *field_class,
                const bt_integer_range_set_signed *range_set);
 
                bt_field_class *field_class,
                const bt_integer_range_set_signed *range_set);
 
+extern bt_field_class_variant_option *
+bt_field_class_variant_borrow_option_by_index(
+               bt_field_class *field_class, uint64_t index);
+
+extern bt_field_class_variant_option *
+bt_field_class_variant_borrow_option_by_name(
+               bt_field_class *field_class, const char *name);
+
 #ifdef __cplusplus
 }
 #endif
 #ifdef __cplusplus
 }
 #endif
index 259a32fe62e36112b13d293ac6df73127d9a57d8..78e30f4dc0109e916a921b5f24e07e2832418c2e 100644 (file)
@@ -1478,6 +1478,28 @@ bt_field_class_variant_borrow_option_by_index_const(
                        (void *) fc, index);
 }
 
                        (void *) fc, index);
 }
 
+struct bt_field_class_variant_option *
+bt_field_class_variant_borrow_option_by_name(
+               struct bt_field_class *fc, const char *name)
+{
+       BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+       BT_ASSERT_PRE_DEV_FC_IS_VARIANT(fc, "Field class");
+       return (void *)
+               borrow_named_field_class_from_container_field_class_by_name(
+                       (void *) fc, name);
+}
+
+struct bt_field_class_variant_option *
+bt_field_class_variant_borrow_option_by_index(
+               struct bt_field_class *fc, uint64_t index)
+{
+       BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+       BT_ASSERT_PRE_DEV_FC_IS_VARIANT(fc, "Field class");
+       return (void *)
+               borrow_named_field_class_from_container_field_class_at_index(
+                       (void *) fc, index);
+}
+
 const struct bt_field_class_variant_with_selector_unsigned_option *
 bt_field_class_variant_with_selector_unsigned_borrow_option_by_name_const(
                const struct bt_field_class *fc, const char *name)
 const struct bt_field_class_variant_with_selector_unsigned_option *
 bt_field_class_variant_with_selector_unsigned_borrow_option_by_name_const(
                const struct bt_field_class *fc, const char *name)
This page took 0.027294 seconds and 4 git commands to generate.