X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fbabeltrace%2Ftrace-ir%2Ffields-internal.h;h=957293b760e24940d7d25237d4912d635bd35b27;hb=40f4ba76dd6f9508ca51b6220eaed57632281a07;hp=c8a1dcf9ae910b5561d5c0daa661fa1bd090f064;hpb=56e18c4ce186892c36d7f2cb5078087425e60134;p=babeltrace.git diff --git a/include/babeltrace/trace-ir/fields-internal.h b/include/babeltrace/trace-ir/fields-internal.h index c8a1dcf9..957293b7 100644 --- a/include/babeltrace/trace-ir/fields-internal.h +++ b/include/babeltrace/trace-ir/fields-internal.h @@ -2,8 +2,6 @@ #define BABELTRACE_TRACE_IR_FIELDS_INTERNAL_H /* - * Babeltrace - Trace IR: Event Fields internal - * * Copyright 2013, 2014 Jérémie Galarneau * * Author: Jérémie Galarneau @@ -29,7 +27,7 @@ #include #include -#include +#include #include #include #include @@ -40,30 +38,30 @@ #include #include -#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, " \ +#define BT_ASSERT_PRE_FIELD_HAS_CLASS_TYPE(_field, _cls_type, _name) \ + BT_ASSERT_PRE(((const struct bt_field *) (_field))->class->type == (_cls_type), \ + _name " has the wrong class type: expected-class-type=%s, " \ "%![field-]+f", \ - bt_common_field_type_id_string(_type_id), (_field)) + bt_common_field_class_type_string(_cls_type), (_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, \ + ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_UNSIGNED_INTEGER || \ + ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_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, \ + ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_SIGNED_INTEGER || \ + ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_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, \ + ((const struct bt_field *) (_field))->class->type == BT_FIELD_CLASS_TYPE_STATIC_ARRAY || \ + ((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_FIELD_IS_SET(_field, _name) \ @@ -71,14 +69,14 @@ _name " is not set: %!+f", (_field)) #define BT_ASSERT_PRE_FIELD_HOT(_field, _name) \ - BT_ASSERT_PRE_HOT((struct bt_field *) (_field), (_name), \ + BT_ASSERT_PRE_HOT((const struct bt_field *) (_field), (_name), \ ": %!+f", (_field)) struct bt_field; -typedef struct bt_field *(* bt_field_create_func)(struct bt_field_type *); +typedef struct bt_field *(* bt_field_create_func)(struct bt_field_class *); typedef void (*bt_field_method_set_is_frozen)(struct bt_field *, bool); -typedef bool (*bt_field_method_is_set)(struct bt_field *); +typedef bool (*bt_field_method_is_set)(const struct bt_field *); typedef void (*bt_field_method_reset)(struct bt_field *); struct bt_field_methods { @@ -91,7 +89,7 @@ struct bt_field { struct bt_object base; /* Owned by this */ - struct bt_field_type *type; + struct bt_field_class *class; /* Virtual table for slow path (dev mode) operations */ struct bt_field_methods *methods; @@ -163,14 +161,14 @@ struct bt_field_string { #endif BT_HIDDEN -void _bt_field_set_is_frozen(struct bt_field *field, bool is_frozen); +void _bt_field_set_is_frozen(const struct bt_field *field, bool is_frozen); static inline -void _bt_field_reset(struct bt_field *field) +void _bt_field_reset(const struct bt_field *field) { BT_ASSERT(field); BT_ASSERT(field->methods->reset); - field->methods->reset(field); + field->methods->reset((void *) field); } static inline @@ -181,7 +179,7 @@ void _bt_field_set_single(struct bt_field *field, bool value) } static inline -bt_bool _bt_field_is_set(struct bt_field *field) +bt_bool _bt_field_is_set(const struct bt_field *field) { bt_bool is_set = BT_FALSE; @@ -189,7 +187,7 @@ bt_bool _bt_field_is_set(struct bt_field *field) goto end; } - BT_ASSERT(bt_field_type_has_known_id(field->type)); + BT_ASSERT(bt_field_class_has_known_type(field->class)); BT_ASSERT(field->methods->is_set); is_set = field->methods->is_set(field); @@ -198,7 +196,7 @@ end: } BT_HIDDEN -struct bt_field *bt_field_create(struct bt_field_type *type); +struct bt_field *bt_field_create(struct bt_field_class *class); BT_HIDDEN void bt_field_destroy(struct bt_field *field);