#include <babeltrace/ctf-ir/field-types-internal.h>
#include <babeltrace/ctf-ir/field-path-internal.h>
+#include <babeltrace/ctf-ir/fields-internal.h>
#include <babeltrace/ctf-ir/utils.h>
#include <babeltrace/ref.h>
#include <babeltrace/ctf-ir/clock.h>
static
void (* const type_destroy_funcs[])(struct bt_ctf_field_type *) = {
- [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_destroy,
- [BT_CTF_TYPE_ID_ENUM] =
+ [CTF_TYPE_INTEGER] = bt_ctf_field_type_integer_destroy,
+ [CTF_TYPE_ENUM] =
bt_ctf_field_type_enumeration_destroy,
- [BT_CTF_TYPE_ID_FLOAT] =
+ [CTF_TYPE_FLOAT] =
bt_ctf_field_type_floating_point_destroy,
- [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_destroy,
- [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_destroy,
- [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_type_array_destroy,
- [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_destroy,
- [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_type_string_destroy,
+ [CTF_TYPE_STRUCT] = bt_ctf_field_type_structure_destroy,
+ [CTF_TYPE_VARIANT] = bt_ctf_field_type_variant_destroy,
+ [CTF_TYPE_ARRAY] = bt_ctf_field_type_array_destroy,
+ [CTF_TYPE_SEQUENCE] = bt_ctf_field_type_sequence_destroy,
+ [CTF_TYPE_STRING] = bt_ctf_field_type_string_destroy,
};
static
static
type_freeze_func const type_freeze_funcs[] = {
- [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_freeze,
- [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_type_enumeration_freeze,
- [BT_CTF_TYPE_ID_FLOAT] = generic_field_type_freeze,
- [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_freeze,
- [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_freeze,
- [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_type_array_freeze,
- [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_freeze,
- [BT_CTF_TYPE_ID_STRING] = generic_field_type_freeze,
+ [CTF_TYPE_INTEGER] = bt_ctf_field_type_integer_freeze,
+ [CTF_TYPE_ENUM] = bt_ctf_field_type_enumeration_freeze,
+ [CTF_TYPE_FLOAT] = generic_field_type_freeze,
+ [CTF_TYPE_STRUCT] = bt_ctf_field_type_structure_freeze,
+ [CTF_TYPE_VARIANT] = bt_ctf_field_type_variant_freeze,
+ [CTF_TYPE_ARRAY] = bt_ctf_field_type_array_freeze,
+ [CTF_TYPE_SEQUENCE] = bt_ctf_field_type_sequence_freeze,
+ [CTF_TYPE_STRING] = generic_field_type_freeze,
};
static
static
type_serialize_func const type_serialize_funcs[] = {
- [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_serialize,
- [BT_CTF_TYPE_ID_ENUM] =
+ [CTF_TYPE_INTEGER] = bt_ctf_field_type_integer_serialize,
+ [CTF_TYPE_ENUM] =
bt_ctf_field_type_enumeration_serialize,
- [BT_CTF_TYPE_ID_FLOAT] =
+ [CTF_TYPE_FLOAT] =
bt_ctf_field_type_floating_point_serialize,
- [BT_CTF_TYPE_ID_STRUCT] =
+ [CTF_TYPE_STRUCT] =
bt_ctf_field_type_structure_serialize,
- [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_serialize,
- [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_type_array_serialize,
- [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_serialize,
- [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_type_string_serialize,
+ [CTF_TYPE_VARIANT] = bt_ctf_field_type_variant_serialize,
+ [CTF_TYPE_ARRAY] = bt_ctf_field_type_array_serialize,
+ [CTF_TYPE_SEQUENCE] = bt_ctf_field_type_sequence_serialize,
+ [CTF_TYPE_STRING] = bt_ctf_field_type_string_serialize,
};
static
static
void (* const set_byte_order_funcs[])(struct bt_ctf_field_type *,
int byte_order, int set_native) = {
- [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_set_byte_order,
- [BT_CTF_TYPE_ID_ENUM] =
+ [CTF_TYPE_INTEGER] = bt_ctf_field_type_integer_set_byte_order,
+ [CTF_TYPE_ENUM] =
bt_ctf_field_type_enumeration_set_byte_order,
- [BT_CTF_TYPE_ID_FLOAT] =
+ [CTF_TYPE_FLOAT] =
bt_ctf_field_type_floating_point_set_byte_order,
- [BT_CTF_TYPE_ID_STRUCT] =
+ [CTF_TYPE_STRUCT] =
bt_ctf_field_type_structure_set_byte_order,
- [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_set_byte_order,
- [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_type_array_set_byte_order,
- [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_set_byte_order,
- [BT_CTF_TYPE_ID_STRING] = NULL,
+ [CTF_TYPE_VARIANT] = bt_ctf_field_type_variant_set_byte_order,
+ [CTF_TYPE_ARRAY] = bt_ctf_field_type_array_set_byte_order,
+ [CTF_TYPE_SEQUENCE] = bt_ctf_field_type_sequence_set_byte_order,
+ [CTF_TYPE_STRING] = NULL,
};
static
static
struct bt_ctf_field_type *(* const type_copy_funcs[])(
struct bt_ctf_field_type *) = {
- [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_copy,
- [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_type_enumeration_copy,
- [BT_CTF_TYPE_ID_FLOAT] = bt_ctf_field_type_floating_point_copy,
- [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_copy,
- [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_copy,
- [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_type_array_copy,
- [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_copy,
- [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_type_string_copy,
+ [CTF_TYPE_INTEGER] = bt_ctf_field_type_integer_copy,
+ [CTF_TYPE_ENUM] = bt_ctf_field_type_enumeration_copy,
+ [CTF_TYPE_FLOAT] = bt_ctf_field_type_floating_point_copy,
+ [CTF_TYPE_STRUCT] = bt_ctf_field_type_structure_copy,
+ [CTF_TYPE_VARIANT] = bt_ctf_field_type_variant_copy,
+ [CTF_TYPE_ARRAY] = bt_ctf_field_type_array_copy,
+ [CTF_TYPE_SEQUENCE] = bt_ctf_field_type_sequence_copy,
+ [CTF_TYPE_STRING] = bt_ctf_field_type_string_copy,
};
static
static
int (* const type_compare_funcs[])(struct bt_ctf_field_type *,
struct bt_ctf_field_type *) = {
- [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_compare,
- [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_type_enumeration_compare,
- [BT_CTF_TYPE_ID_FLOAT] = bt_ctf_field_type_floating_point_compare,
- [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_compare,
- [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_compare,
- [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_type_array_compare,
- [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_compare,
- [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_type_string_compare,
+ [CTF_TYPE_INTEGER] = bt_ctf_field_type_integer_compare,
+ [CTF_TYPE_ENUM] = bt_ctf_field_type_enumeration_compare,
+ [CTF_TYPE_FLOAT] = bt_ctf_field_type_floating_point_compare,
+ [CTF_TYPE_STRUCT] = bt_ctf_field_type_structure_compare,
+ [CTF_TYPE_VARIANT] = bt_ctf_field_type_variant_compare,
+ [CTF_TYPE_ARRAY] = bt_ctf_field_type_array_compare,
+ [CTF_TYPE_SEQUENCE] = bt_ctf_field_type_sequence_compare,
+ [CTF_TYPE_STRING] = bt_ctf_field_type_string_compare,
};
static
static
int (* const type_validate_funcs[])(struct bt_ctf_field_type *) = {
- [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_type_integer_validate,
- [BT_CTF_TYPE_ID_FLOAT] = NULL,
- [BT_CTF_TYPE_ID_STRING] = NULL,
- [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_type_enumeration_validate,
- [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_type_structure_validate,
- [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_type_variant_validate,
- [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_type_array_validate,
- [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_type_sequence_validate,
+ [CTF_TYPE_INTEGER] = bt_ctf_field_type_integer_validate,
+ [CTF_TYPE_FLOAT] = NULL,
+ [CTF_TYPE_STRING] = NULL,
+ [CTF_TYPE_ENUM] = bt_ctf_field_type_enumeration_validate,
+ [CTF_TYPE_STRUCT] = bt_ctf_field_type_structure_validate,
+ [CTF_TYPE_VARIANT] = bt_ctf_field_type_variant_validate,
+ [CTF_TYPE_ARRAY] = bt_ctf_field_type_array_validate,
+ [CTF_TYPE_SEQUENCE] = bt_ctf_field_type_sequence_validate,
};
static
static
void bt_ctf_field_type_init(struct bt_ctf_field_type *type, int init_bo)
{
- enum bt_ctf_type_id type_id = type->declaration->id;
+ enum ctf_type_id type_id = type->declaration->id;
- assert(type && (type_id > BT_CTF_TYPE_ID_UNKNOWN) &&
- (type_id < BT_CTF_NR_TYPE_IDS));
+ assert(type && (type_id > CTF_TYPE_UNKNOWN) &&
+ (type_id < NR_CTF_TYPES));
bt_object_init(type, bt_ctf_field_type_destroy);
type->freeze = type_freeze_funcs[type_id];
void bt_ctf_field_type_destroy(struct bt_object *obj)
{
struct bt_ctf_field_type *type;
- enum bt_ctf_type_id type_id;
+ enum ctf_type_id type_id;
type = container_of(obj, struct bt_ctf_field_type, base);
type_id = type->declaration->id;
- if (type_id <= BT_CTF_TYPE_ID_UNKNOWN ||
- type_id >= BT_CTF_NR_TYPE_IDS) {
+ if (type_id <= CTF_TYPE_UNKNOWN ||
+ type_id >= NR_CTF_TYPES) {
return;
}
int bt_ctf_field_type_validate(struct bt_ctf_field_type *type)
{
int ret = 0;
- enum bt_ctf_type_id id = bt_ctf_field_type_get_type_id(type);
+ enum ctf_type_id id = bt_ctf_field_type_get_type_id(type);
if (!type) {
ret = -1;
}
integer->parent.declaration = &integer->declaration.p;
- integer->parent.declaration->id = BT_CTF_TYPE_ID_INTEGER;
+ integer->parent.declaration->id = CTF_TYPE_INTEGER;
integer->declaration.len = size;
integer->declaration.base = BT_CTF_INTEGER_BASE_DECIMAL;
integer->declaration.encoding = BT_CTF_STRING_ENCODING_NONE;
int ret = 0;
struct bt_ctf_field_type_integer *integer;
- if (!type || type->declaration->id != BT_CTF_TYPE_ID_INTEGER) {
+ if (!type || type->declaration->id != CTF_TYPE_INTEGER) {
ret = -1;
goto end;
}
int ret = 0;
struct bt_ctf_field_type_integer *integer;
- if (!type || type->declaration->id != BT_CTF_TYPE_ID_INTEGER) {
+ if (!type || type->declaration->id != CTF_TYPE_INTEGER) {
ret = -1;
goto end;
}
struct bt_ctf_field_type_integer *integer;
if (!type || type->frozen ||
- type->declaration->id != BT_CTF_TYPE_ID_INTEGER) {
+ type->declaration->id != CTF_TYPE_INTEGER) {
ret = -1;
goto end;
}
enum bt_ctf_integer_base ret = BT_CTF_INTEGER_BASE_UNKNOWN;
struct bt_ctf_field_type_integer *integer;
- if (!type || type->declaration->id != BT_CTF_TYPE_ID_INTEGER) {
+ if (!type || type->declaration->id != CTF_TYPE_INTEGER) {
goto end;
}
int ret = 0;
if (!type || type->frozen ||
- type->declaration->id != BT_CTF_TYPE_ID_INTEGER) {
+ type->declaration->id != CTF_TYPE_INTEGER) {
ret = -1;
goto end;
}
enum bt_ctf_string_encoding ret = BT_CTF_STRING_ENCODING_UNKNOWN;
struct bt_ctf_field_type_integer *integer;
- if (!type || type->declaration->id != BT_CTF_TYPE_ID_INTEGER) {
+ if (!type || type->declaration->id != CTF_TYPE_INTEGER) {
goto end;
}
struct bt_ctf_field_type_integer *integer;
if (!type || type->frozen ||
- (type->declaration->id != BT_CTF_TYPE_ID_INTEGER) ||
+ (type->declaration->id != CTF_TYPE_INTEGER) ||
(encoding < BT_CTF_STRING_ENCODING_NONE) ||
(encoding >= BT_CTF_STRING_ENCODING_UNKNOWN)) {
ret = -1;
goto error;
}
- if (integer_container_type->declaration->id != BT_CTF_TYPE_ID_INTEGER) {
+ if (integer_container_type->declaration->id != CTF_TYPE_INTEGER) {
goto error;
}
}
enumeration->parent.declaration = &enumeration->declaration.p;
- enumeration->parent.declaration->id = BT_CTF_TYPE_ID_ENUM;
+ enumeration->parent.declaration->id = CTF_TYPE_ENUM;
bt_get(integer_container_type);
enumeration->container = integer_container_type;
enumeration->entries = g_ptr_array_new_with_free_func(
goto end;
}
- if (type->declaration->id != BT_CTF_TYPE_ID_ENUM) {
+ if (type->declaration->id != CTF_TYPE_ENUM) {
goto end;
}
struct range_overlap_query query;
char *escaped_string;
- if (!type || (type->declaration->id != BT_CTF_TYPE_ID_ENUM) ||
+ if (!type || (type->declaration->id != CTF_TYPE_ENUM) ||
type->frozen ||
(range_end < range_start)) {
ret = -1;
struct range_overlap_query query;
char *escaped_string;
- if (!type || (type->declaration->id != BT_CTF_TYPE_ID_ENUM) ||
+ if (!type || (type->declaration->id != CTF_TYPE_ENUM) ||
type->frozen ||
(range_end < range_start)) {
ret = -1;
int ret = 0;
struct bt_ctf_field_type_enumeration *enumeration;
- if (!type || (type->declaration->id != BT_CTF_TYPE_ID_ENUM)) {
+ if (!type || (type->declaration->id != CTF_TYPE_ENUM)) {
ret = -1;
goto end;
}
int ret = 0;
if (!type || index < 0 || !string || !range_start || !range_end ||
- (type->declaration->id != BT_CTF_TYPE_ID_ENUM)) {
+ (type->declaration->id != CTF_TYPE_ENUM)) {
ret = -1;
goto end;
}
int ret = 0;
if (!type || index < 0 || !string || !range_start || !range_end ||
- (type->declaration->id != BT_CTF_TYPE_ID_ENUM)) {
+ (type->declaration->id != CTF_TYPE_ENUM)) {
ret = -1;
goto end;
}
int i, ret = 0;
if (!type || !name ||
- (type->declaration->id != BT_CTF_TYPE_ID_ENUM)) {
+ (type->declaration->id != CTF_TYPE_ENUM)) {
ret = -1;
goto end;
}
struct bt_ctf_field_type_enumeration *enumeration;
int i, ret = 0;
- if (!type || (type->declaration->id != BT_CTF_TYPE_ID_ENUM)) {
+ if (!type || (type->declaration->id != CTF_TYPE_ENUM)) {
ret = -1;
goto end;
}
struct bt_ctf_field_type_enumeration *enumeration;
int i, ret = 0;
- if (!type || (type->declaration->id != BT_CTF_TYPE_ID_ENUM)) {
+ if (!type || (type->declaration->id != CTF_TYPE_ENUM)) {
ret = -1;
goto end;
}
floating_point->declaration.exp = &floating_point->exp;
floating_point->sign.len = 1;
floating_point->parent.declaration = &floating_point->declaration.p;
- floating_point->parent.declaration->id = BT_CTF_TYPE_ID_FLOAT;
+ floating_point->parent.declaration->id = CTF_TYPE_FLOAT;
floating_point->declaration.exp->len =
sizeof(float) * CHAR_BIT - FLT_MANT_DIG;
floating_point->declaration.mantissa->len = FLT_MANT_DIG - 1;
int ret = 0;
struct bt_ctf_field_type_floating_point *floating_point;
- if (!type || (type->declaration->id != BT_CTF_TYPE_ID_FLOAT)) {
+ if (!type || (type->declaration->id != CTF_TYPE_FLOAT)) {
ret = -1;
goto end;
}
struct bt_ctf_field_type_floating_point *floating_point;
if (!type || type->frozen ||
- (type->declaration->id != BT_CTF_TYPE_ID_FLOAT)) {
+ (type->declaration->id != CTF_TYPE_FLOAT)) {
ret = -1;
goto end;
}
int ret = 0;
struct bt_ctf_field_type_floating_point *floating_point;
- if (!type || (type->declaration->id != BT_CTF_TYPE_ID_FLOAT)) {
+ if (!type || (type->declaration->id != CTF_TYPE_FLOAT)) {
ret = -1;
goto end;
}
struct bt_ctf_field_type_floating_point *floating_point;
if (!type || type->frozen ||
- (type->declaration->id != BT_CTF_TYPE_ID_FLOAT)) {
+ (type->declaration->id != CTF_TYPE_FLOAT)) {
ret = -1;
goto end;
}
}
structure->parent.declaration = &structure->declaration.p;
- structure->parent.declaration->id = BT_CTF_TYPE_ID_STRUCT;
+ structure->parent.declaration->id = CTF_TYPE_STRUCT;
structure->fields = g_ptr_array_new_with_free_func(
(GDestroyNotify)destroy_structure_field);
structure->field_name_to_index = g_hash_table_new(NULL, NULL);
if (!type || !field_type || type->frozen ||
bt_ctf_validate_identifier(field_name) ||
- (type->declaration->id != BT_CTF_TYPE_ID_STRUCT)) {
+ (type->declaration->id != CTF_TYPE_STRUCT)) {
ret = -1;
goto end;
}
int ret = 0;
struct bt_ctf_field_type_structure *structure;
- if (!type || (type->declaration->id != BT_CTF_TYPE_ID_STRUCT)) {
+ if (!type || (type->declaration->id != CTF_TYPE_STRUCT)) {
ret = -1;
goto end;
}
int ret = 0;
if (!type || index < 0 ||
- (type->declaration->id != BT_CTF_TYPE_ID_STRUCT)) {
+ (type->declaration->id != CTF_TYPE_STRUCT)) {
ret = -1;
goto end;
}
}
variant->parent.declaration = &variant->declaration.p;
- variant->parent.declaration->id = BT_CTF_TYPE_ID_VARIANT;
+ variant->parent.declaration->id = CTF_TYPE_VARIANT;
variant->tag_name = g_string_new(tag_name);
variant->field_name_to_index = g_hash_table_new(NULL, NULL);
variant->fields = g_ptr_array_new_with_free_func(
struct bt_ctf_field_type_variant *variant;
struct bt_ctf_field_type *tag_type = NULL;
- if (!type || (type->declaration->id != BT_CTF_TYPE_ID_VARIANT)) {
+ if (!type || (type->declaration->id != CTF_TYPE_VARIANT)) {
goto end;
}
struct bt_ctf_field_type_variant *variant;
const char *tag_name = NULL;
- if (!type || (type->declaration->id != BT_CTF_TYPE_ID_VARIANT)) {
+ if (!type || (type->declaration->id != CTF_TYPE_VARIANT)) {
goto end;
}
struct bt_ctf_field_type_variant *variant;
if (!type || type->frozen ||
- (type->declaration->id != BT_CTF_TYPE_ID_VARIANT) ||
+ (type->declaration->id != CTF_TYPE_VARIANT) ||
bt_ctf_validate_identifier(name)) {
ret = -1;
goto end;
if (!type || !field_type || type->frozen ||
bt_ctf_validate_identifier(field_name) ||
- (type->declaration->id != BT_CTF_TYPE_ID_VARIANT)) {
+ (type->declaration->id != CTF_TYPE_VARIANT)) {
ret = -1;
goto end;
}
const char *enum_value;
struct bt_ctf_field_type *field_type = NULL;
- if (!type || !tag || type->declaration->id != BT_CTF_TYPE_ID_VARIANT) {
+ if (!type || !tag || type->declaration->id != CTF_TYPE_VARIANT) {
goto end;
}
int ret = 0;
struct bt_ctf_field_type_variant *variant;
- if (!type || (type->declaration->id != BT_CTF_TYPE_ID_VARIANT)) {
+ if (!type || (type->declaration->id != CTF_TYPE_VARIANT)) {
ret = -1;
goto end;
}
int ret = 0;
if (!type || index < 0 ||
- (type->declaration->id != BT_CTF_TYPE_ID_VARIANT)) {
+ (type->declaration->id != CTF_TYPE_VARIANT)) {
ret = -1;
goto end;
}
}
array->parent.declaration = &array->declaration.p;
- array->parent.declaration->id = BT_CTF_TYPE_ID_ARRAY;
+ array->parent.declaration->id = CTF_TYPE_ARRAY;
bt_get(element_type);
array->element_type = element_type;
struct bt_ctf_field_type *ret = NULL;
struct bt_ctf_field_type_array *array;
- if (!type || (type->declaration->id != BT_CTF_TYPE_ID_ARRAY)) {
+ if (!type || (type->declaration->id != CTF_TYPE_ARRAY)) {
goto end;
}
struct bt_ctf_field_type_array *array;
if (!type || !element_type ||
- (type->declaration->id != BT_CTF_TYPE_ID_ARRAY)) {
+ (type->declaration->id != CTF_TYPE_ARRAY)) {
ret = -1;
goto end;
}
int64_t ret;
struct bt_ctf_field_type_array *array;
- if (!type || (type->declaration->id != BT_CTF_TYPE_ID_ARRAY)) {
+ if (!type || (type->declaration->id != CTF_TYPE_ARRAY)) {
ret = -1;
goto end;
}
}
sequence->parent.declaration = &sequence->declaration.p;
- sequence->parent.declaration->id = BT_CTF_TYPE_ID_SEQUENCE;
+ sequence->parent.declaration->id = CTF_TYPE_SEQUENCE;
bt_get(element_type);
sequence->element_type = element_type;
sequence->length_field_name = g_string_new(length_field_name);
struct bt_ctf_field_type *ret = NULL;
struct bt_ctf_field_type_sequence *sequence;
- if (!type || (type->declaration->id != BT_CTF_TYPE_ID_SEQUENCE)) {
+ if (!type || (type->declaration->id != CTF_TYPE_SEQUENCE)) {
goto end;
}
struct bt_ctf_field_type_sequence *sequence;
if (!type || !element_type ||
- (type->declaration->id != BT_CTF_TYPE_ID_SEQUENCE)) {
+ (type->declaration->id != CTF_TYPE_SEQUENCE)) {
ret = -1;
goto end;
}
const char *ret = NULL;
struct bt_ctf_field_type_sequence *sequence;
- if (!type || (type->declaration->id != BT_CTF_TYPE_ID_SEQUENCE)) {
+ if (!type || (type->declaration->id != CTF_TYPE_SEQUENCE)) {
goto end;
}
}
string->parent.declaration = &string->declaration.p;
- string->parent.declaration->id = BT_CTF_TYPE_ID_STRING;
+ string->parent.declaration->id = CTF_TYPE_STRING;
bt_ctf_field_type_init(&string->parent, TRUE);
string->declaration.encoding = BT_CTF_STRING_ENCODING_UTF8;
string->parent.declaration->alignment = CHAR_BIT;
struct bt_ctf_field_type_string *string;
enum bt_ctf_string_encoding ret = BT_CTF_STRING_ENCODING_UNKNOWN;
- if (!type || (type->declaration->id != BT_CTF_TYPE_ID_STRING)) {
+ if (!type || (type->declaration->id != CTF_TYPE_STRING)) {
goto end;
}
int ret = 0;
struct bt_ctf_field_type_string *string;
- if (!type || type->declaration->id != BT_CTF_TYPE_ID_STRING ||
+ if (!type || type->declaration->id != CTF_TYPE_STRING ||
(encoding != BT_CTF_STRING_ENCODING_UTF8 &&
encoding != BT_CTF_STRING_ENCODING_ASCII)) {
ret = -1;
int bt_ctf_field_type_get_alignment(struct bt_ctf_field_type *type)
{
int ret;
- enum bt_ctf_type_id type_id;
+ enum ctf_type_id type_id;
if (!type) {
ret = -1;
type_id = bt_ctf_field_type_get_type_id(type);
switch (type_id) {
- case BT_CTF_TYPE_ID_SEQUENCE:
+ case CTF_TYPE_SEQUENCE:
{
struct bt_ctf_field_type *element =
bt_ctf_field_type_sequence_get_element_type(type);
bt_put(element);
break;
}
- case BT_CTF_TYPE_ID_ARRAY:
+ case CTF_TYPE_ARRAY:
{
struct bt_ctf_field_type *element =
bt_ctf_field_type_array_get_element_type(type);
bt_put(element);
break;
}
- case BT_CTF_TYPE_ID_STRUCT:
+ case CTF_TYPE_STRUCT:
{
int i, element_count;
ret = (int) type->declaration->alignment;
break;
}
- case BT_CTF_TYPE_ID_UNKNOWN:
+ case CTF_TYPE_UNKNOWN:
ret = -1;
break;
default:
unsigned int alignment)
{
int ret = 0;
- enum bt_ctf_type_id type_id;
+ enum ctf_type_id type_id;
/* Alignment must be a power of two */
if (!type || type->frozen || !is_power_of_two(alignment)) {
}
type_id = bt_ctf_field_type_get_type_id(type);
- if (type_id == BT_CTF_TYPE_ID_UNKNOWN) {
+ if (type_id == CTF_TYPE_UNKNOWN) {
ret = -1;
goto end;
}
- if (type->declaration->id == BT_CTF_TYPE_ID_STRING &&
+ if (type->declaration->id == CTF_TYPE_STRING &&
alignment != CHAR_BIT) {
ret = -1;
goto end;
}
- if (type_id == BT_CTF_TYPE_ID_VARIANT ||
- type_id == BT_CTF_TYPE_ID_SEQUENCE ||
- type_id == BT_CTF_TYPE_ID_ARRAY) {
+ if (type_id == CTF_TYPE_VARIANT ||
+ type_id == CTF_TYPE_SEQUENCE ||
+ type_id == CTF_TYPE_ARRAY) {
/* Setting an alignment on these types makes no sense */
ret = -1;
goto end;
}
switch (type->declaration->id) {
- case BT_CTF_TYPE_ID_INTEGER:
+ case CTF_TYPE_INTEGER:
{
struct bt_ctf_field_type_integer *integer = container_of(
type, struct bt_ctf_field_type_integer, parent);
ret = integer->user_byte_order;
break;
}
- case BT_CTF_TYPE_ID_FLOAT:
+ case CTF_TYPE_FLOAT:
{
struct bt_ctf_field_type_floating_point *floating_point =
container_of(type,
{
int ret = 0;
int internal_byte_order;
- enum bt_ctf_type_id type_id;
+ enum ctf_type_id type_id;
if (!type || type->frozen) {
ret = -1;
}
BT_HIDDEN
-enum bt_ctf_type_id bt_ctf_field_type_get_type_id(
+enum ctf_type_id bt_ctf_field_type_get_type_id(
struct bt_ctf_field_type *type)
{
if (!type) {
- return BT_CTF_TYPE_ID_UNKNOWN;
+ return CTF_TYPE_UNKNOWN;
}
return type->declaration->id;
BT_HIDDEN
int bt_ctf_field_type_is_integer(struct bt_ctf_field_type *type)
{
- return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_INTEGER;
+ return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_INTEGER;
}
BT_HIDDEN
int bt_ctf_field_type_is_floating_point(struct bt_ctf_field_type *type)
{
- return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_FLOAT;
+ return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_FLOAT;
}
BT_HIDDEN
int bt_ctf_field_type_is_enumeration(struct bt_ctf_field_type *type)
{
- return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_ENUM;
+ return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_ENUM;
}
BT_HIDDEN
int bt_ctf_field_type_is_string(struct bt_ctf_field_type *type)
{
- return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_STRING;
+ return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_STRING;
}
BT_HIDDEN
int bt_ctf_field_type_is_structure(struct bt_ctf_field_type *type)
{
- return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_STRUCT;
+ return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_STRUCT;
}
BT_HIDDEN
int bt_ctf_field_type_is_array(struct bt_ctf_field_type *type)
{
- return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_ARRAY;
+ return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_ARRAY;
}
BT_HIDDEN
int bt_ctf_field_type_is_sequence(struct bt_ctf_field_type *type)
{
- return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_SEQUENCE;
+ return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_SEQUENCE;
}
BT_HIDDEN
int bt_ctf_field_type_is_variant(struct bt_ctf_field_type *type)
{
- return bt_ctf_field_type_get_type_id(type) == BT_CTF_TYPE_ID_VARIANT;
+ return bt_ctf_field_type_get_type_id(type) == CTF_TYPE_VARIANT;
}
void bt_ctf_field_type_get(struct bt_ctf_field_type *type)
struct bt_ctf_field_type_structure *structure;
if (!type || !name ||
- bt_ctf_field_type_get_type_id(type) != BT_CTF_TYPE_ID_STRUCT) {
+ bt_ctf_field_type_get_type_id(type) != CTF_TYPE_STRUCT) {
ret = -1;
goto end;
}
struct bt_ctf_field_type_structure *structure;
if (!type || !field ||
- bt_ctf_field_type_get_type_id(type) != BT_CTF_TYPE_ID_STRUCT) {
+ bt_ctf_field_type_get_type_id(type) != CTF_TYPE_STRUCT) {
ret = -1;
goto end;
}
struct bt_ctf_field_type_variant *variant;
if (!type || !name ||
- bt_ctf_field_type_get_type_id(type) != BT_CTF_TYPE_ID_VARIANT) {
+ bt_ctf_field_type_get_type_id(type) != CTF_TYPE_VARIANT) {
ret = -1;
goto end;
}
struct bt_ctf_field_type_sequence *sequence;
if (!type || bt_ctf_field_type_get_type_id(type) !=
- BT_CTF_TYPE_ID_SEQUENCE) {
+ CTF_TYPE_SEQUENCE) {
ret = -1;
goto end;
}
struct bt_ctf_field_type_variant *variant;
if (!type || bt_ctf_field_type_get_type_id(type) !=
- BT_CTF_TYPE_ID_VARIANT) {
+ CTF_TYPE_VARIANT) {
ret = -1;
goto end;
}
if (!type || !tag ||
bt_ctf_field_type_get_type_id(tag) !=
- BT_CTF_TYPE_ID_ENUM) {
+ CTF_TYPE_ENUM) {
ret = -1;
goto end;
}
struct bt_ctf_field_type_variant *variant;
if (!type || !field ||
- bt_ctf_field_type_get_type_id(type) != BT_CTF_TYPE_ID_VARIANT) {
+ bt_ctf_field_type_get_type_id(type) != CTF_TYPE_VARIANT) {
ret = -1;
goto end;
}
goto end;
}
- if (type_a->declaration->id == BT_CTF_TYPE_ID_UNKNOWN) {
+ if (type_a->declaration->id == CTF_TYPE_UNKNOWN) {
/* Both have unknown type IDs */
goto end;
}
static
struct bt_ctf_field *(* const field_create_funcs[])(
struct bt_ctf_field_type *) = {
- [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_integer_create,
- [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_enumeration_create,
- [BT_CTF_TYPE_ID_FLOAT] =
+ [CTF_TYPE_INTEGER] = bt_ctf_field_integer_create,
+ [CTF_TYPE_ENUM] = bt_ctf_field_enumeration_create,
+ [CTF_TYPE_FLOAT] =
bt_ctf_field_floating_point_create,
- [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_structure_create,
- [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_variant_create,
- [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_array_create,
- [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_create,
- [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_string_create,
+ [CTF_TYPE_STRUCT] = bt_ctf_field_structure_create,
+ [CTF_TYPE_VARIANT] = bt_ctf_field_variant_create,
+ [CTF_TYPE_ARRAY] = bt_ctf_field_array_create,
+ [CTF_TYPE_SEQUENCE] = bt_ctf_field_sequence_create,
+ [CTF_TYPE_STRING] = bt_ctf_field_string_create,
};
static
void (* const field_destroy_funcs[])(struct bt_ctf_field *) = {
- [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_integer_destroy,
- [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_enumeration_destroy,
- [BT_CTF_TYPE_ID_FLOAT] =
+ [CTF_TYPE_INTEGER] = bt_ctf_field_integer_destroy,
+ [CTF_TYPE_ENUM] = bt_ctf_field_enumeration_destroy,
+ [CTF_TYPE_FLOAT] =
bt_ctf_field_floating_point_destroy,
- [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_structure_destroy,
- [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_variant_destroy,
- [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_array_destroy,
- [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_destroy,
- [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_string_destroy,
+ [CTF_TYPE_STRUCT] = bt_ctf_field_structure_destroy,
+ [CTF_TYPE_VARIANT] = bt_ctf_field_variant_destroy,
+ [CTF_TYPE_ARRAY] = bt_ctf_field_array_destroy,
+ [CTF_TYPE_SEQUENCE] = bt_ctf_field_sequence_destroy,
+ [CTF_TYPE_STRING] = bt_ctf_field_string_destroy,
};
static
int (* const field_validate_funcs[])(struct bt_ctf_field *) = {
- [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_generic_validate,
- [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_enumeration_validate,
- [BT_CTF_TYPE_ID_FLOAT] = bt_ctf_field_generic_validate,
- [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_structure_validate,
- [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_variant_validate,
- [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_array_validate,
- [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_validate,
- [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_generic_validate,
+ [CTF_TYPE_INTEGER] = bt_ctf_field_generic_validate,
+ [CTF_TYPE_ENUM] = bt_ctf_field_enumeration_validate,
+ [CTF_TYPE_FLOAT] = bt_ctf_field_generic_validate,
+ [CTF_TYPE_STRUCT] = bt_ctf_field_structure_validate,
+ [CTF_TYPE_VARIANT] = bt_ctf_field_variant_validate,
+ [CTF_TYPE_ARRAY] = bt_ctf_field_array_validate,
+ [CTF_TYPE_SEQUENCE] = bt_ctf_field_sequence_validate,
+ [CTF_TYPE_STRING] = bt_ctf_field_generic_validate,
};
static
int (* const field_reset_funcs[])(struct bt_ctf_field *) = {
- [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_generic_reset,
- [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_enumeration_reset,
- [BT_CTF_TYPE_ID_FLOAT] = bt_ctf_field_generic_reset,
- [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_structure_reset,
- [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_variant_reset,
- [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_array_reset,
- [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_reset,
- [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_string_reset,
+ [CTF_TYPE_INTEGER] = bt_ctf_field_generic_reset,
+ [CTF_TYPE_ENUM] = bt_ctf_field_enumeration_reset,
+ [CTF_TYPE_FLOAT] = bt_ctf_field_generic_reset,
+ [CTF_TYPE_STRUCT] = bt_ctf_field_structure_reset,
+ [CTF_TYPE_VARIANT] = bt_ctf_field_variant_reset,
+ [CTF_TYPE_ARRAY] = bt_ctf_field_array_reset,
+ [CTF_TYPE_SEQUENCE] = bt_ctf_field_sequence_reset,
+ [CTF_TYPE_STRING] = bt_ctf_field_string_reset,
};
static
int (* const field_serialize_funcs[])(struct bt_ctf_field *,
struct ctf_stream_pos *) = {
- [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_integer_serialize,
- [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_enumeration_serialize,
- [BT_CTF_TYPE_ID_FLOAT] =
+ [CTF_TYPE_INTEGER] = bt_ctf_field_integer_serialize,
+ [CTF_TYPE_ENUM] = bt_ctf_field_enumeration_serialize,
+ [CTF_TYPE_FLOAT] =
bt_ctf_field_floating_point_serialize,
- [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_structure_serialize,
- [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_variant_serialize,
- [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_array_serialize,
- [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_serialize,
- [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_string_serialize,
+ [CTF_TYPE_STRUCT] = bt_ctf_field_structure_serialize,
+ [CTF_TYPE_VARIANT] = bt_ctf_field_variant_serialize,
+ [CTF_TYPE_ARRAY] = bt_ctf_field_array_serialize,
+ [CTF_TYPE_SEQUENCE] = bt_ctf_field_sequence_serialize,
+ [CTF_TYPE_STRING] = bt_ctf_field_string_serialize,
};
static
int (* const field_copy_funcs[])(struct bt_ctf_field *,
struct bt_ctf_field *) = {
- [BT_CTF_TYPE_ID_INTEGER] = bt_ctf_field_integer_copy,
- [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_enumeration_copy,
- [BT_CTF_TYPE_ID_FLOAT] = bt_ctf_field_floating_point_copy,
- [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_structure_copy,
- [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_variant_copy,
- [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_array_copy,
- [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_copy,
- [BT_CTF_TYPE_ID_STRING] = bt_ctf_field_string_copy,
+ [CTF_TYPE_INTEGER] = bt_ctf_field_integer_copy,
+ [CTF_TYPE_ENUM] = bt_ctf_field_enumeration_copy,
+ [CTF_TYPE_FLOAT] = bt_ctf_field_floating_point_copy,
+ [CTF_TYPE_STRUCT] = bt_ctf_field_structure_copy,
+ [CTF_TYPE_VARIANT] = bt_ctf_field_variant_copy,
+ [CTF_TYPE_ARRAY] = bt_ctf_field_array_copy,
+ [CTF_TYPE_SEQUENCE] = bt_ctf_field_sequence_copy,
+ [CTF_TYPE_STRING] = bt_ctf_field_string_copy,
};
static
void (* const field_freeze_funcs[])(struct bt_ctf_field *) = {
- [BT_CTF_TYPE_ID_INTEGER] = generic_field_freeze,
- [BT_CTF_TYPE_ID_FLOAT] = generic_field_freeze,
- [BT_CTF_TYPE_ID_STRING] = generic_field_freeze,
- [BT_CTF_TYPE_ID_ENUM] = bt_ctf_field_enumeration_freeze,
- [BT_CTF_TYPE_ID_STRUCT] = bt_ctf_field_structure_freeze,
- [BT_CTF_TYPE_ID_VARIANT] = bt_ctf_field_variant_freeze,
- [BT_CTF_TYPE_ID_ARRAY] = bt_ctf_field_array_freeze,
- [BT_CTF_TYPE_ID_SEQUENCE] = bt_ctf_field_sequence_freeze,
+ [CTF_TYPE_INTEGER] = generic_field_freeze,
+ [CTF_TYPE_FLOAT] = generic_field_freeze,
+ [CTF_TYPE_STRING] = generic_field_freeze,
+ [CTF_TYPE_ENUM] = bt_ctf_field_enumeration_freeze,
+ [CTF_TYPE_STRUCT] = bt_ctf_field_structure_freeze,
+ [CTF_TYPE_VARIANT] = bt_ctf_field_variant_freeze,
+ [CTF_TYPE_ARRAY] = bt_ctf_field_array_freeze,
+ [CTF_TYPE_SEQUENCE] = bt_ctf_field_sequence_freeze,
};
struct bt_ctf_field *bt_ctf_field_create(struct bt_ctf_field_type *type)
{
struct bt_ctf_field *field = NULL;
- enum bt_ctf_type_id type_id;
+ enum ctf_type_id type_id;
int ret;
if (!type) {
}
type_id = bt_ctf_field_type_get_type_id(type);
- if (type_id <= BT_CTF_TYPE_ID_UNKNOWN ||
- type_id >= BT_CTF_NR_TYPE_IDS) {
+ if (type_id <= CTF_TYPE_UNKNOWN ||
+ type_id >= NR_CTF_TYPES) {
goto error;
}
}
BT_HIDDEN
-enum bt_ctf_type_id bt_ctf_field_get_type_id(struct bt_ctf_field *field)
+enum ctf_type_id bt_ctf_field_get_type_id(struct bt_ctf_field *field)
{
- enum bt_ctf_type_id ret = BT_CTF_TYPE_ID_UNKNOWN;
+ enum ctf_type_id ret = CTF_TYPE_UNKNOWN;
if (!field) {
goto end;
BT_HIDDEN
int bt_ctf_field_is_integer(struct bt_ctf_field *field)
{
- return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_INTEGER;
+ return bt_ctf_field_get_type_id(field) == CTF_TYPE_INTEGER;
}
BT_HIDDEN
int bt_ctf_field_is_floating_point(struct bt_ctf_field *field)
{
- return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_FLOAT;
+ return bt_ctf_field_get_type_id(field) == CTF_TYPE_FLOAT;
}
BT_HIDDEN
int bt_ctf_field_is_enumeration(struct bt_ctf_field *field)
{
- return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_ENUM;
+ return bt_ctf_field_get_type_id(field) == CTF_TYPE_ENUM;
}
BT_HIDDEN
int bt_ctf_field_is_string(struct bt_ctf_field *field)
{
- return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_STRING;
+ return bt_ctf_field_get_type_id(field) == CTF_TYPE_STRING;
}
BT_HIDDEN
int bt_ctf_field_is_structure(struct bt_ctf_field *field)
{
- return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_STRUCT;
+ return bt_ctf_field_get_type_id(field) == CTF_TYPE_STRUCT;
}
BT_HIDDEN
int bt_ctf_field_is_array(struct bt_ctf_field *field)
{
- return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_ARRAY;
+ return bt_ctf_field_get_type_id(field) == CTF_TYPE_ARRAY;
}
BT_HIDDEN
int bt_ctf_field_is_sequence(struct bt_ctf_field *field)
{
- return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_SEQUENCE;
+ return bt_ctf_field_get_type_id(field) == CTF_TYPE_SEQUENCE;
}
BT_HIDDEN
int bt_ctf_field_is_variant(struct bt_ctf_field *field)
{
- return bt_ctf_field_get_type_id(field) == BT_CTF_TYPE_ID_VARIANT;
+ return bt_ctf_field_get_type_id(field) == CTF_TYPE_VARIANT;
}
BT_HIDDEN
}
if (bt_ctf_field_type_get_type_id(field->type) !=
- BT_CTF_TYPE_ID_SEQUENCE) {
+ CTF_TYPE_SEQUENCE) {
goto end;
}
goto end;
}
if (bt_ctf_field_type_get_type_id(length_field->type) !=
- BT_CTF_TYPE_ID_INTEGER) {
+ CTF_TYPE_INTEGER) {
ret = -1;
goto end;
}
if (!field || !name ||
bt_ctf_field_type_get_type_id(field->type) !=
- BT_CTF_TYPE_ID_STRUCT) {
+ CTF_TYPE_STRUCT) {
goto error;
}
if (!field ||
bt_ctf_field_type_get_type_id(field->type) !=
- BT_CTF_TYPE_ID_STRUCT) {
+ CTF_TYPE_STRUCT) {
goto end;
}
if (!field || !name || !value || field->frozen ||
bt_ctf_field_type_get_type_id(field->type) !=
- BT_CTF_TYPE_ID_STRUCT) {
+ CTF_TYPE_STRUCT) {
ret = -1;
goto end;
}
struct bt_ctf_field_array *array;
if (!field || bt_ctf_field_type_get_type_id(field->type) !=
- BT_CTF_TYPE_ID_ARRAY) {
+ CTF_TYPE_ARRAY) {
goto end;
}
struct bt_ctf_field_sequence *sequence;
if (!field || bt_ctf_field_type_get_type_id(field->type) !=
- BT_CTF_TYPE_ID_SEQUENCE) {
+ CTF_TYPE_SEQUENCE) {
goto end;
}
if (!field || !tag_field ||
bt_ctf_field_type_get_type_id(field->type) !=
- BT_CTF_TYPE_ID_VARIANT ||
+ CTF_TYPE_VARIANT ||
bt_ctf_field_type_get_type_id(tag_field->type) !=
- BT_CTF_TYPE_ID_ENUM) {
+ CTF_TYPE_ENUM) {
goto end;
}
if (!variant_field ||
bt_ctf_field_type_get_type_id(variant_field->type) !=
- BT_CTF_TYPE_ID_VARIANT) {
+ CTF_TYPE_VARIANT) {
goto end;
}
struct bt_ctf_field_enumeration *enumeration;
if (!field || bt_ctf_field_type_get_type_id(field->type) !=
- BT_CTF_TYPE_ID_ENUM) {
+ CTF_TYPE_ENUM) {
goto end;
}
if (!field || !value || !field->payload_set ||
bt_ctf_field_type_get_type_id(field->type) !=
- BT_CTF_TYPE_ID_INTEGER) {
+ CTF_TYPE_INTEGER) {
ret = -1;
goto end;
}
if (!field || field->frozen ||
bt_ctf_field_type_get_type_id(field->type) !=
- BT_CTF_TYPE_ID_INTEGER) {
+ CTF_TYPE_INTEGER) {
ret = -1;
goto end;
}
if (!field || !value || !field->payload_set ||
bt_ctf_field_type_get_type_id(field->type) !=
- BT_CTF_TYPE_ID_INTEGER) {
+ CTF_TYPE_INTEGER) {
ret = -1;
goto end;
}
if (!field || field->frozen ||
bt_ctf_field_type_get_type_id(field->type) !=
- BT_CTF_TYPE_ID_INTEGER) {
+ CTF_TYPE_INTEGER) {
ret = -1;
goto end;
}
if (!field || !value || !field->payload_set ||
bt_ctf_field_type_get_type_id(field->type) !=
- BT_CTF_TYPE_ID_FLOAT) {
+ CTF_TYPE_FLOAT) {
ret = -1;
goto end;
}
if (!field || field->frozen ||
bt_ctf_field_type_get_type_id(field->type) !=
- BT_CTF_TYPE_ID_FLOAT) {
+ CTF_TYPE_FLOAT) {
ret = -1;
goto end;
}
if (!field || !field->payload_set ||
bt_ctf_field_type_get_type_id(field->type) !=
- BT_CTF_TYPE_ID_STRING) {
+ CTF_TYPE_STRING) {
goto end;
}
if (!field || !value || field->frozen ||
bt_ctf_field_type_get_type_id(field->type) !=
- BT_CTF_TYPE_ID_STRING) {
+ CTF_TYPE_STRING) {
ret = -1;
goto end;
}
if (!field || !value || field->frozen ||
bt_ctf_field_type_get_type_id(field->type) !=
- BT_CTF_TYPE_ID_STRING) {
+ CTF_TYPE_STRING) {
ret = -1;
goto end;
}
if (!field || !value || field->frozen ||
bt_ctf_field_type_get_type_id(field->type) !=
- BT_CTF_TYPE_ID_STRING) {
+ CTF_TYPE_STRING) {
ret = -1;
goto end;
}
int bt_ctf_field_validate(struct bt_ctf_field *field)
{
int ret = 0;
- enum bt_ctf_type_id type_id;
+ enum ctf_type_id type_id;
if (!field) {
ret = -1;
}
type_id = bt_ctf_field_type_get_type_id(field->type);
- if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) {
+ if (type_id <= CTF_TYPE_UNKNOWN || type_id >= NR_CTF_TYPES) {
ret = -1;
goto end;
}
int bt_ctf_field_reset(struct bt_ctf_field *field)
{
int ret = 0;
- enum bt_ctf_type_id type_id;
+ enum ctf_type_id type_id;
if (!field) {
ret = -1;
}
type_id = bt_ctf_field_type_get_type_id(field->type);
- if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) {
+ if (type_id <= CTF_TYPE_UNKNOWN || type_id >= NR_CTF_TYPES) {
ret = -1;
goto end;
}
struct ctf_stream_pos *pos)
{
int ret = 0;
- enum bt_ctf_type_id type_id;
+ enum ctf_type_id type_id;
if (!field || !pos) {
ret = -1;
}
type_id = bt_ctf_field_type_get_type_id(field->type);
- if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) {
+ if (type_id <= CTF_TYPE_UNKNOWN || type_id >= NR_CTF_TYPES) {
ret = -1;
goto end;
}
{
int ret;
struct bt_ctf_field *copy = NULL;
- enum bt_ctf_type_id type_id;
+ enum ctf_type_id type_id;
if (!field) {
goto end;
}
type_id = bt_ctf_field_type_get_type_id(field->type);
- if (type_id <= BT_CTF_TYPE_ID_UNKNOWN || type_id >= BT_CTF_NR_TYPE_IDS) {
+ if (type_id <= CTF_TYPE_UNKNOWN || type_id >= NR_CTF_TYPES) {
goto end;
}
{
struct bt_ctf_field *field;
struct bt_ctf_field_type *type;
- enum bt_ctf_type_id type_id;
+ enum ctf_type_id type_id;
field = container_of(obj, struct bt_ctf_field, base);
type = field->type;
type_id = bt_ctf_field_type_get_type_id(type);
- if (type_id <= BT_CTF_TYPE_ID_UNKNOWN ||
- type_id >= BT_CTF_NR_TYPE_IDS) {
+ if (type_id <= CTF_TYPE_UNKNOWN ||
+ type_id >= NR_CTF_TYPES) {
return;
}
BT_HIDDEN
void bt_ctf_field_freeze(struct bt_ctf_field *field)
{
- enum bt_ctf_type_id type_id;
+ enum ctf_type_id type_id;
if (!field) {
goto end;
}
type_id = bt_ctf_field_get_type_id(field);
- if (type_id <= BT_CTF_TYPE_ID_UNKNOWN ||
- type_id >= BT_CTF_NR_TYPE_IDS) {
+ if (type_id <= CTF_TYPE_UNKNOWN ||
+ type_id >= NR_CTF_TYPES) {
goto end;
}