X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Flib%2Ftrace-ir%2Ffield-class.h;h=3fe793249216a922c24205b711f38276e36aa236;hb=b8ddb4f036272e30030202637201d11baf5f20a5;hp=77eece7bbe8fa2a12ece112178fde1c87f36484e;hpb=6943da6ac9da92ceccfbcfc9858105ecc94a62fb;p=babeltrace.git diff --git a/src/lib/trace-ir/field-class.h b/src/lib/trace-ir/field-class.h index 77eece7b..3fe79324 100644 --- a/src/lib/trace-ir/field-class.h +++ b/src/lib/trace-ir/field-class.h @@ -67,22 +67,47 @@ #define _BT_ASSERT_PRE_FC_IS_ARRAY_COND(_fc) \ (((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_STATIC_ARRAY || \ - ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY) + ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITHOUT_LENGTH_FIELD || \ + ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITH_LENGTH_FIELD) #define _BT_ASSERT_PRE_FC_IS_ARRAY_FMT(_name) \ _name " is not an array field class: %![fc-]+F" +#define _BT_ASSERT_PRE_FC_IS_OPTION_COND(_fc) \ + (((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_OPTION_WITHOUT_SELECTOR || \ + ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_BOOL_SELECTOR || \ + ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_UNSIGNED_INTEGER_SELECTOR || \ + ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_SIGNED_INTEGER_SELECTOR) + +#define _BT_ASSERT_PRE_FC_IS_OPTION_FMT(_name) \ + _name " is not an option field class: %![fc-]+F" + +#define _BT_ASSERT_PRE_FC_IS_OPTION_WITH_SEL_COND(_fc) \ + (((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_BOOL_SELECTOR || \ + ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_UNSIGNED_INTEGER_SELECTOR || \ + ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_SIGNED_INTEGER_SELECTOR) + +#define _BT_ASSERT_PRE_FC_IS_OPTION_WITH_SEL_FMT(_name) \ + _name " is not an option field class with a selector: %![fc-]+F" + +#define _BT_ASSERT_PRE_FC_IS_OPTION_WITH_INT_SEL_COND(_fc) \ + (((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_UNSIGNED_INTEGER_SELECTOR || \ + ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_OPTION_WITH_SIGNED_INTEGER_SELECTOR) + +#define _BT_ASSERT_PRE_FC_IS_OPTION_WITH_INT_SEL_FMT(_name) \ + _name " is not an option field class with an integer selector: %![fc-]+F" + #define _BT_ASSERT_PRE_FC_IS_VARIANT_COND(_fc) \ (((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR || \ - ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_SELECTOR || \ - ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_SELECTOR) + ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_INTEGER_SELECTOR || \ + ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_INTEGER_SELECTOR) #define _BT_ASSERT_PRE_FC_IS_VARIANT_FMT(_name) \ _name " is not a variant field class: %![fc-]+F" #define _BT_ASSERT_PRE_FC_IS_VARIANT_WITH_SEL_COND(_fc) \ - (((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_SELECTOR || \ - ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_SELECTOR) + (((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_INTEGER_SELECTOR || \ + ((const struct bt_field_class *) (_fc))->type == BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_INTEGER_SELECTOR) #define _BT_ASSERT_PRE_FC_IS_VARIANT_WITH_SEL_FMT(_name) \ _name " is not a variant field class with a selector: %![fc-]+F" @@ -113,6 +138,18 @@ BT_ASSERT_PRE(_BT_ASSERT_PRE_FC_IS_ARRAY_COND(_fc), \ _BT_ASSERT_PRE_FC_IS_ARRAY_FMT(_name), (_fc)) +#define BT_ASSERT_PRE_FC_IS_OPTION(_fc, _name) \ + BT_ASSERT_PRE(_BT_ASSERT_PRE_FC_IS_OPTION_COND(_fc), \ + _BT_ASSERT_PRE_FC_IS_OPTION_FMT(_name), (_fc)) + +#define BT_ASSERT_PRE_FC_IS_OPTION_WITH_SEL(_fc, _name) \ + BT_ASSERT_PRE(_BT_ASSERT_PRE_FC_IS_OPTION_WITH_SEL_COND(_fc), \ + _BT_ASSERT_PRE_FC_IS_OPTION_WITH_SEL_FMT(_name), (_fc)) + +#define BT_ASSERT_PRE_FC_IS_OPTION_WITH_INT_SEL(_fc, _name) \ + BT_ASSERT_PRE(_BT_ASSERT_PRE_FC_IS_OPTION_WITH_INT_SEL_COND(_fc), \ + _BT_ASSERT_PRE_FC_IS_OPTION_WITH_INT_SEL_FMT(_name), (_fc)) + #define BT_ASSERT_PRE_FC_IS_VARIANT(_fc, _name) \ BT_ASSERT_PRE(_BT_ASSERT_PRE_FC_IS_VARIANT_COND(_fc), \ _BT_ASSERT_PRE_FC_IS_VARIANT_FMT(_name), (_fc)) @@ -146,6 +183,18 @@ BT_ASSERT_PRE_DEV(_BT_ASSERT_PRE_FC_IS_ARRAY_COND(_fc), \ _BT_ASSERT_PRE_FC_IS_ARRAY_FMT(_name), (_fc)) +#define BT_ASSERT_PRE_DEV_FC_IS_OPTION(_fc, _name) \ + BT_ASSERT_PRE_DEV(_BT_ASSERT_PRE_FC_IS_OPTION_COND(_fc), \ + _BT_ASSERT_PRE_FC_IS_OPTION_FMT(_name), (_fc)) + +#define BT_ASSERT_PRE_DEV_FC_IS_OPTION_WITH_SEL(_fc, _name) \ + BT_ASSERT_PRE_DEV(_BT_ASSERT_PRE_FC_IS_OPTION_WITH_SEL_COND(_fc), \ + _BT_ASSERT_PRE_FC_IS_OPTION_WITH_SEL_FMT(_name), (_fc)) + +#define BT_ASSERT_PRE_DEV_FC_IS_OPTION_WITH_INT_SEL(_fc, _name) \ + BT_ASSERT_PRE_DEV(_BT_ASSERT_PRE_FC_IS_OPTION_WITH_INT_SEL_COND(_fc), \ + _BT_ASSERT_PRE_FC_IS_OPTION_WITH_INT_SEL_FMT(_name), (_fc)) + #define BT_ASSERT_PRE_DEV_FC_IS_VARIANT(_fc, _name) \ BT_ASSERT_PRE_DEV(_BT_ASSERT_PRE_FC_IS_VARIANT_COND(_fc), \ _BT_ASSERT_PRE_FC_IS_VARIANT_FMT(_name), (_fc)) @@ -179,6 +228,9 @@ struct bt_field_class { enum bt_field_class_type type; bool frozen; + /* Owned by this */ + struct bt_value *user_attributes; + /* * This flag indicates whether or not this field class is part * of a trace class. @@ -241,7 +293,6 @@ struct bt_field_class_enumeration { struct bt_field_class_real { struct bt_field_class common; - bool is_single_precision; }; struct bt_field_class_string { @@ -252,6 +303,9 @@ struct bt_field_class_string { struct bt_named_field_class { GString *name; + /* Owned by this */ + struct bt_value *user_attributes; + /* Owned by this */ struct bt_field_class *fc; @@ -260,8 +314,8 @@ struct bt_named_field_class { struct bt_field_class_structure_member; struct bt_field_class_variant_option; -struct bt_field_class_variant_with_selector_unsigned_option; -struct bt_field_class_variant_with_selector_signed_option; +struct bt_field_class_variant_with_selector_integer_unsigned_option; +struct bt_field_class_variant_with_selector_integer_signed_option; struct bt_field_class_named_field_class_container { struct bt_field_class common; @@ -307,6 +361,10 @@ struct bt_field_class_option { /* Owned by this */ struct bt_field_class *content_fc; +}; + +struct bt_field_class_option_with_selector { + struct bt_field_class_option common; /* Owned by this */ struct bt_field_class *selector_fc; @@ -315,6 +373,20 @@ struct bt_field_class_option { struct bt_field_path *selector_field_path; }; +struct bt_field_class_option_with_selector_bool { + struct bt_field_class_option_with_selector common; + + /* Owned by this */ + bool sel_is_reversed; +}; + +struct bt_field_class_option_with_selector_integer { + struct bt_field_class_option_with_selector common; + + /* Owned by this */ + const struct bt_integer_range_set *range_set; +}; + /* Variant FC (with selector) option: named field class + range set */ struct bt_field_class_variant_with_selector_option { struct bt_named_field_class common;