lib: add option field classes with integer selectors
[babeltrace.git] / src / lib / trace-ir / field.h
index ce595f9726a100c263c38db2aac6dfb161b1a8e9..7bc83b3d679760d8572d4c9856eede9a825623a2 100644 (file)
                ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY, \
                _name " is not an array field: %![field-]+f", (_field))
 
+#define BT_ASSERT_PRE_DEV_FIELD_IS_OPTION(_field, _name)               \
+       BT_ASSERT_PRE_DEV(                                              \
+               ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_OPTION_WITHOUT_SELECTOR || \
+               ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_BOOL_SELECTOR || \
+               ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_UNSIGNED_INTEGER_SELECTOR || \
+               ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_SIGNED_INTEGER_SELECTOR, \
+               _name " is not an option field: %![field-]+f", (_field))
+
 #define BT_ASSERT_PRE_DEV_FIELD_IS_VARIANT(_field, _name)              \
        BT_ASSERT_PRE_DEV(                                              \
                ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR || \
@@ -105,6 +113,16 @@ struct bt_field {
        bool frozen;
 };
 
+struct bt_field_bool {
+       struct bt_field common;
+       bool value;
+};
+
+struct bt_field_bit_array {
+       struct bt_field common;
+       uint64_t value_as_int;
+};
+
 struct bt_field_integer {
        struct bt_field common;
 
@@ -126,6 +144,16 @@ struct bt_field_structure {
        GPtrArray *fields;
 };
 
+struct bt_field_option {
+       struct bt_field common;
+
+       /* Owned by this */
+       struct bt_field *content_field;
+
+       /* Weak: equal to `content_field` above or `NULL` */
+       struct bt_field *selected_field;
+};
+
 struct bt_field_variant {
        struct bt_field common;
 
This page took 0.023872 seconds and 4 git commands to generate.