lib: add non-const FC borrow functions for container FCs
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 5 Sep 2019 16:48:32 +0000 (12:48 -0400)
committerFrancis Deslauriers <francis.deslauriers@efficios.com>
Tue, 10 Sep 2019 01:05:12 +0000 (21:05 -0400)
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I015c3038d505873cf0bdf2ce0673f92d757aeb19
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2002
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
include/babeltrace2/trace-ir/field-class.h
src/lib/trace-ir/field-class.c

index 847064b924b046769c1cf453d928ab36f458bb23..2881000480fd7dc9ef22b54419d25809513cdc79 100644 (file)
@@ -113,6 +113,10 @@ extern bt_field_class_structure_member *
 bt_field_class_structure_borrow_member_by_name(
                bt_field_class *field_class, const char *name);
 
+extern bt_field_class *
+bt_field_class_structure_member_borrow_field_class(
+               bt_field_class_structure_member *member);
+
 extern bt_value *bt_field_class_structure_member_borrow_user_attributes(
                bt_field_class_structure_member *member);
 
@@ -137,6 +141,9 @@ extern bt_field_class *bt_field_class_option_create(
                bt_field_class *content_field_class,
                bt_field_class *selector_field_class);
 
+extern bt_field_class *bt_field_class_option_borrow_field_class(
+               bt_field_class *field_class);
+
 extern bt_field_class *bt_field_class_variant_create(
                bt_trace_class *trace_class,
                bt_field_class *selector_field_class);
@@ -176,6 +183,9 @@ extern bt_field_class_variant_option *
 bt_field_class_variant_borrow_option_by_name(
                bt_field_class *field_class, const char *name);
 
+extern bt_field_class *bt_field_class_variant_option_borrow_field_class(
+               bt_field_class_variant_option *option);
+
 extern bt_value *bt_field_class_variant_option_borrow_user_attributes(
                bt_field_class_variant_option *option);
 
index 610f8f7515b26f187af04d613b2cab49251842e0..4dfed4929317822c26734a21906ce146b65d1f3f 100644 (file)
@@ -1139,6 +1139,16 @@ bt_field_class_structure_member_borrow_field_class_const(
        return named_fc->fc;
 }
 
+struct bt_field_class *
+bt_field_class_structure_member_borrow_field_class(
+               struct bt_field_class_structure_member *member)
+{
+       struct bt_named_field_class *named_fc = (void *) member;
+
+       BT_ASSERT_PRE_DEV_NON_NULL(member, "Structure field class member");
+       return named_fc->fc;
+}
+
 static
 void destroy_option_field_class(struct bt_object *obj)
 {
@@ -1211,6 +1221,17 @@ const struct bt_field_class *bt_field_class_option_borrow_field_class_const(
        return opt_fc->content_fc;
 }
 
+struct bt_field_class *bt_field_class_option_borrow_field_class(
+                       struct bt_field_class *fc)
+{
+       struct bt_field_class_option *opt_fc = (void *) fc;
+
+       BT_ASSERT_PRE_NON_NULL(fc, "Field class");
+       BT_ASSERT_PRE_DEV_FC_HAS_ID(fc, BT_FIELD_CLASS_TYPE_OPTION,
+               "Field class");
+       return opt_fc->content_fc;
+}
+
 const struct bt_field_path *
 bt_field_class_option_borrow_selector_field_path_const(
                const struct bt_field_class *fc)
@@ -1648,6 +1669,16 @@ bt_field_class_variant_option_borrow_field_class_const(
        return named_fc->fc;
 }
 
+struct bt_field_class *
+bt_field_class_variant_option_borrow_field_class(
+               struct bt_field_class_variant_option *option)
+{
+       struct bt_named_field_class *named_fc = (void *) option;
+
+       BT_ASSERT_PRE_DEV_NON_NULL(option, "Variant field class option");
+       return named_fc->fc;
+}
+
 const struct bt_integer_range_set_unsigned *
 bt_field_class_variant_with_selector_unsigned_option_borrow_ranges_const(
                const struct bt_field_class_variant_with_selector_unsigned_option *option)
This page took 0.031968 seconds and 4 git commands to generate.