+#define BT_ASSERT_PRE_FIELD_HAS_TYPE_ID(_field, _type_id, _name) \
+ BT_ASSERT_PRE(((struct bt_field *) (_field))->type->id == (_type_id), \
+ _name " has the wrong type ID: expected-type-id=%s, " \
+ "%![field-]+f", \
+ bt_common_field_type_id_string(_type_id), (_field))
+
+#define BT_ASSERT_PRE_FIELD_IS_UNSIGNED_INT(_field, _name) \
+ BT_ASSERT_PRE( \
+ ((struct bt_field *) (_field))->type->id == BT_FIELD_TYPE_ID_UNSIGNED_INTEGER || \
+ ((struct bt_field *) (_field))->type->id == BT_FIELD_TYPE_ID_UNSIGNED_ENUMERATION, \
+ _name " is not an unsigned integer field: %![field-]+f", \
+ (_field))
+
+#define BT_ASSERT_PRE_FIELD_IS_SIGNED_INT(_field, _name) \
+ BT_ASSERT_PRE( \
+ ((struct bt_field *) (_field))->type->id == BT_FIELD_TYPE_ID_SIGNED_INTEGER || \
+ ((struct bt_field *) (_field))->type->id == BT_FIELD_TYPE_ID_SIGNED_ENUMERATION, \
+ _name " is not a signed integer field: %![field-]+f", \
+ (_field))
+
+#define BT_ASSERT_PRE_FIELD_IS_ARRAY(_field, _name) \
+ BT_ASSERT_PRE( \
+ ((struct bt_field *) (_field))->type->id == BT_FIELD_TYPE_ID_STATIC_ARRAY || \
+ ((struct bt_field *) (_field))->type->id == BT_FIELD_TYPE_ID_DYNAMIC_ARRAY, \
+ _name " is not an array field: %![field-]+f", (_field))
+
+#define BT_ASSERT_PRE_FIELD_IS_SET(_field, _name) \
+ BT_ASSERT_PRE(bt_field_is_set(_field), \
+ _name " is not set: %!+f", (_field))
+
+#define BT_ASSERT_PRE_FIELD_HOT(_field, _name) \
+ BT_ASSERT_PRE_HOT((struct bt_field *) (_field), (_name), \
+ ": %!+f", (_field))
+
+struct bt_field;
+
+typedef struct bt_field *(* bt_field_create_func)(struct bt_field_type *);
+typedef void (*bt_field_method_set_is_frozen)(struct bt_field *, bool);
+typedef bool (*bt_field_method_is_set)(struct bt_field *);
+typedef void (*bt_field_method_reset)(struct bt_field *);
+
+struct bt_field_methods {
+ bt_field_method_set_is_frozen set_is_frozen;
+ bt_field_method_is_set is_set;
+ bt_field_method_reset reset;
+};