+const struct bt_value *bt_field_class_borrow_user_attributes_const(
+ const struct bt_field_class *fc)
+{
+ BT_ASSERT_PRE_DEV_NON_NULL(fc, "Field class");
+ return fc->user_attributes;
+}
+
+struct bt_value *bt_field_class_borrow_user_attributes(
+ struct bt_field_class *field_class)
+{
+ return (void *) bt_field_class_borrow_user_attributes_const(
+ (void *) field_class);
+}
+
+
+void bt_field_class_set_user_attributes(
+ struct bt_field_class *fc,
+ const struct bt_value *user_attributes)
+{
+ BT_ASSERT_PRE_NON_NULL(fc, "Field class");
+ BT_ASSERT_PRE_NON_NULL(user_attributes, "User attributes");
+ BT_ASSERT_PRE(user_attributes->type == BT_VALUE_TYPE_MAP,
+ "User attributes object is not a map value object.");
+ BT_ASSERT_PRE_DEV_FC_HOT(fc, "Field class");
+ bt_object_put_no_null_check(fc->user_attributes);
+ fc->user_attributes = (void *) user_attributes;
+ bt_object_get_no_null_check(fc->user_attributes);
+}
+
+static
+const struct bt_value *bt_named_field_class_borrow_user_attributes_const(
+ const struct bt_named_field_class *named_fc)
+{
+ return named_fc->user_attributes;
+}
+
+static
+void bt_named_field_class_set_user_attributes(
+ struct bt_named_field_class *named_fc,
+ const struct bt_value *user_attributes)
+{
+ BT_ASSERT_PRE_NON_NULL(user_attributes, "User attributes");
+ BT_ASSERT_PRE(user_attributes->type == BT_VALUE_TYPE_MAP,
+ "User attributes object is not a map value object.");
+ BT_ASSERT_PRE_DEV_HOT(named_fc,
+ "Structure field class member or variant field class option",
+ ".");
+ bt_object_put_no_null_check(named_fc->user_attributes);
+ named_fc->user_attributes = (void *) user_attributes;
+ bt_object_get_no_null_check(named_fc->user_attributes);
+}
+
+const struct bt_value *
+bt_field_class_structure_member_borrow_user_attributes_const(
+ const struct bt_field_class_structure_member *member)
+{
+ BT_ASSERT_PRE_NON_NULL(member, "Structure field class member");
+ return bt_named_field_class_borrow_user_attributes_const(
+ (const void *) member);
+}
+
+struct bt_value *
+bt_field_class_structure_member_borrow_user_attributes(
+ struct bt_field_class_structure_member *member)
+{
+ BT_ASSERT_PRE_NON_NULL(member, "Structure field class member");
+ return (void *) bt_named_field_class_borrow_user_attributes_const(
+ (void *) member);
+}
+
+void bt_field_class_structure_member_set_user_attributes(
+ struct bt_field_class_structure_member *member,
+ const struct bt_value *user_attributes)
+{
+ BT_ASSERT_PRE_NON_NULL(member, "Structure field class member");
+ bt_named_field_class_set_user_attributes((void *) member,
+ user_attributes);
+}
+
+const struct bt_value *bt_field_class_variant_option_borrow_user_attributes_const(
+ const struct bt_field_class_variant_option *option)
+{
+ BT_ASSERT_PRE_NON_NULL(option, "Variant field class option");
+ return bt_named_field_class_borrow_user_attributes_const(
+ (const void *) option);
+}
+
+struct bt_value *bt_field_class_variant_option_borrow_user_attributes(
+ struct bt_field_class_variant_option *option)
+{
+ BT_ASSERT_PRE_NON_NULL(option, "Variant field class option");
+ return (void *) bt_named_field_class_borrow_user_attributes_const(
+ (void *) option);
+}
+
+void bt_field_class_variant_option_set_user_attributes(
+ struct bt_field_class_variant_option *option,
+ const struct bt_value *user_attributes)
+{
+ BT_ASSERT_PRE_NON_NULL(option, "Variant field class option");
+ bt_named_field_class_set_user_attributes((void *) option,
+ user_attributes);
+}
+