X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fbabeltrace2%2Ftrace-ir%2Ffield-class-const.h;h=2a5c88d64ee28b5cfeefb14685dcab8fab6510bc;hb=901f0ce8eca409028109888889ddeafb08d7dd69;hp=2dfade9fa899c6b8c389ea1d652e8cd8a5620c83;hpb=247fa9e352fc697e4bc6439f5a38f1029daea448;p=babeltrace.git diff --git a/include/babeltrace2/trace-ir/field-class-const.h b/include/babeltrace2/trace-ir/field-class-const.h index 2dfade9f..2a5c88d6 100644 --- a/include/babeltrace2/trace-ir/field-class-const.h +++ b/include/babeltrace2/trace-ir/field-class-const.h @@ -37,32 +37,70 @@ extern "C" { #endif typedef enum bt_field_class_type { - BT_FIELD_CLASS_TYPE_BOOL, - BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER, - BT_FIELD_CLASS_TYPE_SIGNED_INTEGER, - BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION, - BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION, - BT_FIELD_CLASS_TYPE_REAL, - BT_FIELD_CLASS_TYPE_STRING, - BT_FIELD_CLASS_TYPE_STRUCTURE, - BT_FIELD_CLASS_TYPE_STATIC_ARRAY, - BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY, - BT_FIELD_CLASS_TYPE_OPTION, - BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR, - BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_SELECTOR, - BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_SELECTOR, + BT_FIELD_CLASS_TYPE_BOOL = 1ULL << 0, + BT_FIELD_CLASS_TYPE_BIT_ARRAY = 1ULL << 1, + BT_FIELD_CLASS_TYPE_INTEGER = 1ULL << 2, + BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER = (1ULL << 3) | BT_FIELD_CLASS_TYPE_INTEGER, + BT_FIELD_CLASS_TYPE_SIGNED_INTEGER = (1ULL << 4) | BT_FIELD_CLASS_TYPE_INTEGER, + BT_FIELD_CLASS_TYPE_ENUMERATION = 1ULL << 5, + BT_FIELD_CLASS_TYPE_UNSIGNED_ENUMERATION = BT_FIELD_CLASS_TYPE_ENUMERATION | BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER, + BT_FIELD_CLASS_TYPE_SIGNED_ENUMERATION = BT_FIELD_CLASS_TYPE_ENUMERATION | BT_FIELD_CLASS_TYPE_SIGNED_INTEGER, + BT_FIELD_CLASS_TYPE_REAL = 1ULL << 6, + BT_FIELD_CLASS_TYPE_SINGLE_PRECISION_REAL = (1ULL << 7) | BT_FIELD_CLASS_TYPE_REAL, + BT_FIELD_CLASS_TYPE_DOUBLE_PRECISION_REAL = (1ULL << 8) | BT_FIELD_CLASS_TYPE_REAL, + BT_FIELD_CLASS_TYPE_STRING = 1ULL << 9, + BT_FIELD_CLASS_TYPE_STRUCTURE = 1ULL << 10, + BT_FIELD_CLASS_TYPE_ARRAY = 1ULL << 11, + BT_FIELD_CLASS_TYPE_STATIC_ARRAY = (1ULL << 12) | BT_FIELD_CLASS_TYPE_ARRAY, + BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY = (1ULL << 13) | BT_FIELD_CLASS_TYPE_ARRAY, + BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITHOUT_LENGTH_FIELD = (1ULL << 14) | BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY, + BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY_WITH_LENGTH_FIELD = (1ULL << 15) | BT_FIELD_CLASS_TYPE_DYNAMIC_ARRAY, + BT_FIELD_CLASS_TYPE_OPTION = 1ULL << 16, + BT_FIELD_CLASS_TYPE_OPTION_WITHOUT_SELECTOR_FIELD = (1ULL << 17) | BT_FIELD_CLASS_TYPE_OPTION, + BT_FIELD_CLASS_TYPE_OPTION_WITH_SELECTOR_FIELD = (1ULL << 18) | BT_FIELD_CLASS_TYPE_OPTION, + BT_FIELD_CLASS_TYPE_OPTION_WITH_BOOL_SELECTOR_FIELD = (1ULL << 19) | BT_FIELD_CLASS_TYPE_OPTION_WITH_SELECTOR_FIELD, + BT_FIELD_CLASS_TYPE_OPTION_WITH_INTEGER_SELECTOR_FIELD = (1ULL << 20) | BT_FIELD_CLASS_TYPE_OPTION_WITH_SELECTOR_FIELD, + BT_FIELD_CLASS_TYPE_OPTION_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD = (1ULL << 21) | BT_FIELD_CLASS_TYPE_OPTION_WITH_INTEGER_SELECTOR_FIELD, + BT_FIELD_CLASS_TYPE_OPTION_WITH_SIGNED_INTEGER_SELECTOR_FIELD = (1ULL << 22) | BT_FIELD_CLASS_TYPE_OPTION_WITH_INTEGER_SELECTOR_FIELD, + BT_FIELD_CLASS_TYPE_VARIANT = 1ULL << 23, + BT_FIELD_CLASS_TYPE_VARIANT_WITHOUT_SELECTOR_FIELD = (1ULL << 24) | BT_FIELD_CLASS_TYPE_VARIANT, + BT_FIELD_CLASS_TYPE_VARIANT_WITH_SELECTOR_FIELD = (1ULL << 25) | BT_FIELD_CLASS_TYPE_VARIANT, + BT_FIELD_CLASS_TYPE_VARIANT_WITH_INTEGER_SELECTOR_FIELD = (1ULL << 26) | BT_FIELD_CLASS_TYPE_VARIANT_WITH_SELECTOR_FIELD, + BT_FIELD_CLASS_TYPE_VARIANT_WITH_UNSIGNED_INTEGER_SELECTOR_FIELD = (1ULL << 27) | BT_FIELD_CLASS_TYPE_VARIANT_WITH_INTEGER_SELECTOR_FIELD, + BT_FIELD_CLASS_TYPE_VARIANT_WITH_SIGNED_INTEGER_SELECTOR_FIELD = (1ULL << 28) | BT_FIELD_CLASS_TYPE_VARIANT_WITH_INTEGER_SELECTOR_FIELD, + + /* + * Make sure the enumeration type is a 64-bit integer in case + * the project needs field class types in the future. + * + * This is not part of the API. + */ + __BT_FIELD_CLASS_TYPE_BIG_VALUE = 1ULL << 62, } bt_field_class_type; typedef enum bt_field_class_integer_preferred_display_base { - BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_BINARY, - BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_OCTAL, - BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL, - BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL, + BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_BINARY = 2, + BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_OCTAL = 8, + BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_DECIMAL = 10, + BT_FIELD_CLASS_INTEGER_PREFERRED_DISPLAY_BASE_HEXADECIMAL = 16, } bt_field_class_integer_preferred_display_base; extern bt_field_class_type bt_field_class_get_type( const bt_field_class *field_class); +static inline +bt_bool bt_field_class_type_is(const bt_field_class_type type, + const bt_field_class_type type_to_check) +{ + return (type & type_to_check) == type_to_check; +} + +extern const bt_value *bt_field_class_borrow_user_attributes_const( + const bt_field_class *field_class); + +extern uint64_t bt_field_class_bit_array_get_length( + const bt_field_class *field_class); + extern uint64_t bt_field_class_integer_get_field_value_range( const bt_field_class *field_class); @@ -70,9 +108,6 @@ extern bt_field_class_integer_preferred_display_base bt_field_class_integer_get_preferred_display_base( const bt_field_class *field_class); -extern bt_bool bt_field_class_real_is_single_precision( - const bt_field_class *field_class); - extern uint64_t bt_field_class_enumeration_get_mapping_count( const bt_field_class *field_class); @@ -154,6 +189,9 @@ extern const bt_field_class * bt_field_class_structure_member_borrow_field_class_const( const bt_field_class_structure_member *member); +extern const bt_value *bt_field_class_structure_member_borrow_user_attributes_const( + const bt_field_class_structure_member *member); + extern const bt_field_class * bt_field_class_array_borrow_element_field_class_const( const bt_field_class *field_class); @@ -162,7 +200,7 @@ extern uint64_t bt_field_class_array_static_get_length( const bt_field_class *field_class); extern const bt_field_path * -bt_field_class_array_dynamic_borrow_length_field_path_const( +bt_field_class_array_dynamic_with_length_field_borrow_length_field_path_const( const bt_field_class *field_class); extern const bt_field_class * @@ -170,7 +208,19 @@ bt_field_class_option_borrow_field_class_const( const bt_field_class *field_class); extern const bt_field_path * -bt_field_class_option_borrow_selector_field_path_const( +bt_field_class_option_with_selector_field_borrow_selector_field_path_const( + const bt_field_class *field_class); + +extern bt_bool +bt_field_class_option_with_selector_field_bool_selector_is_reversed( + const bt_field_class *field_class); + +extern const bt_integer_range_set_unsigned * +bt_field_class_option_with_selector_field_integer_unsigned_borrow_selector_ranges_const( + const bt_field_class *field_class); + +extern const bt_integer_range_set_signed * +bt_field_class_option_with_selector_field_integer_signed_borrow_selector_ranges_const( const bt_field_class *field_class); extern uint64_t bt_field_class_variant_get_option_count( @@ -184,20 +234,20 @@ extern const bt_field_class_variant_option * bt_field_class_variant_borrow_option_by_name_const( const bt_field_class *field_class, const char *name); -extern const bt_field_class_variant_with_selector_unsigned_option * -bt_field_class_variant_with_selector_unsigned_borrow_option_by_index_const( +extern const bt_field_class_variant_with_selector_field_integer_unsigned_option * +bt_field_class_variant_with_selector_field_integer_unsigned_borrow_option_by_index_const( const bt_field_class *field_class, uint64_t index); -extern const bt_field_class_variant_with_selector_unsigned_option * -bt_field_class_variant_with_selector_unsigned_borrow_option_by_name_const( +extern const bt_field_class_variant_with_selector_field_integer_unsigned_option * +bt_field_class_variant_with_selector_field_integer_unsigned_borrow_option_by_name_const( const bt_field_class *field_class, const char *name); -extern const bt_field_class_variant_with_selector_signed_option * -bt_field_class_variant_with_selector_signed_borrow_option_by_index_const( +extern const bt_field_class_variant_with_selector_field_integer_signed_option * +bt_field_class_variant_with_selector_field_integer_signed_borrow_option_by_index_const( const bt_field_class *field_class, uint64_t index); -extern const bt_field_class_variant_with_selector_signed_option * -bt_field_class_variant_with_selector_signed_borrow_option_by_name_const( +extern const bt_field_class_variant_with_selector_field_integer_signed_option * +bt_field_class_variant_with_selector_field_integer_signed_borrow_option_by_name_const( const bt_field_class *field_class, const char *name); extern const char *bt_field_class_variant_option_get_name( @@ -207,30 +257,33 @@ extern const bt_field_class * bt_field_class_variant_option_borrow_field_class_const( const bt_field_class_variant_option *option); +extern const bt_value *bt_field_class_variant_option_borrow_user_attributes_const( + const bt_field_class_variant_option *option); + extern const bt_field_path * -bt_field_class_variant_with_selector_borrow_selector_field_path_const( +bt_field_class_variant_with_selector_field_borrow_selector_field_path_const( const bt_field_class *field_class); extern const bt_integer_range_set_unsigned * -bt_field_class_variant_with_selector_unsigned_option_borrow_ranges_const( - const bt_field_class_variant_with_selector_unsigned_option *option); +bt_field_class_variant_with_selector_field_integer_unsigned_option_borrow_ranges_const( + const bt_field_class_variant_with_selector_field_integer_unsigned_option *option); static inline const bt_field_class_variant_option * -bt_field_class_variant_with_selector_unsigned_option_as_option_const( - const bt_field_class_variant_with_selector_unsigned_option *option) +bt_field_class_variant_with_selector_field_integer_unsigned_option_as_option_const( + const bt_field_class_variant_with_selector_field_integer_unsigned_option *option) { return __BT_UPCAST_CONST(bt_field_class_variant_option, option); } extern const bt_integer_range_set_signed * -bt_field_class_variant_with_selector_signed_option_borrow_ranges_const( - const bt_field_class_variant_with_selector_signed_option *option); +bt_field_class_variant_with_selector_field_integer_signed_option_borrow_ranges_const( + const bt_field_class_variant_with_selector_field_integer_signed_option *option); static inline const bt_field_class_variant_option * -bt_field_class_variant_with_selector_signed_option_as_option_const( - const bt_field_class_variant_with_selector_signed_option *option) +bt_field_class_variant_with_selector_field_integer_signed_option_as_option_const( + const bt_field_class_variant_with_selector_field_integer_signed_option *option) { return __BT_UPCAST_CONST(bt_field_class_variant_option, option); }