+static
+struct bt_field_class_variant_with_selector_option *
+create_variant_with_selector_option(
+ const char *name, struct bt_field_class *fc,
+ const struct bt_integer_range_set *range_set)
+{
+ struct bt_field_class_variant_with_selector_option *opt = g_new0(
+ struct bt_field_class_variant_with_selector_option, 1);
+
+ BT_ASSERT(range_set);
+
+ if (!opt) {
+ BT_LIB_LOGE_APPEND_CAUSE(
+ "Failed to allocate a named field class.");
+ goto error;
+ }
+
+ if (init_named_field_class(&opt->common, name, fc)) {
+ goto error;
+ }
+
+ opt->range_set = range_set;
+ bt_object_get_no_null_check(opt->range_set);
+ bt_integer_range_set_freeze(range_set);
+ goto end;
+
+error:
+ destroy_variant_with_selector_option(opt);
+ opt = NULL;
+
+end:
+ return opt;
+}
+
+static
+int append_named_field_class_to_container_field_class(
+ struct bt_field_class_named_field_class_container *container_fc,
+ struct bt_named_field_class *named_fc)
+{
+ BT_ASSERT(container_fc);
+ BT_ASSERT(named_fc);
+ BT_ASSERT_PRE_DEV_FC_HOT(container_fc, "Field class");
+ BT_ASSERT_PRE(!bt_g_hash_table_contains(container_fc->name_to_index,
+ named_fc->name->str),
+ "Duplicate member/option name in structure/variant field class: "
+ "%![container-fc-]+F, name=\"%s\"", container_fc,
+ named_fc->name->str);
+ g_ptr_array_add(container_fc->named_fcs, named_fc);
+ g_hash_table_insert(container_fc->name_to_index, named_fc->name->str,
+ GUINT_TO_POINTER(container_fc->named_fcs->len - 1));
+ return BT_FUNC_STATUS_OK;
+}
+
+enum bt_field_class_structure_append_member_status
+bt_field_class_structure_append_member(