lib: add non-const FC borrow functions for container FCs
[babeltrace.git] / src / lib / trace-ir / field-class.c
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.023605 seconds and 4 git commands to generate.