static
struct bt_field_type *bt_field_type_string_copy(struct bt_field_type *ft);
-static struct bt_field_type_common_methods bt_field_type_integer_methods = {
- .freeze = bt_field_type_common_generic_freeze,
- .validate = bt_field_type_common_integer_validate,
- .set_byte_order = bt_field_type_common_integer_set_byte_order,
- .copy = (bt_field_type_common_method_copy)
+static
+int bt_field_type_integer_validate(struct bt_field_type *ft);
+
+static
+int bt_field_type_enumeration_validate_recursive(
+ struct bt_field_type *ft);
+static
+int bt_field_type_sequence_validate_recursive(
+ struct bt_field_type *ft);
+static
+int bt_field_type_array_validate_recursive(
+ struct bt_field_type *ft);
+static
+int bt_field_type_structure_validate_recursive(
+ struct bt_field_type *ft);
+static
+int bt_field_type_variant_validate_recursive(
+ struct bt_field_type *ft);
+
+static
+void bt_field_type_generic_freeze(struct bt_field_type *ft);
+
+static
+void bt_field_type_enumeration_freeze_recursive(
+ struct bt_field_type *ft);
+static
+void bt_field_type_structure_freeze_recursive(
+ struct bt_field_type *ft);
+static
+void bt_field_type_variant_freeze_recursive(
+ struct bt_field_type *ft);
+static
+void bt_field_type_array_freeze_recursive(
+ struct bt_field_type *ft);
+static
+void bt_field_type_sequence_freeze_recursive(
+ struct bt_field_type *ft);
+
+static
+void bt_field_type_integer_set_byte_order(
+ struct bt_field_type *ft, enum bt_byte_order byte_order);
+
+static
+void bt_field_type_enumeration_set_byte_order_recursive(
+ struct bt_field_type *ft, enum bt_byte_order byte_order);
+
+static
+void bt_field_type_floating_point_set_byte_order(
+ struct bt_field_type *ft, enum bt_byte_order byte_order);
+
+static
+void bt_field_type_structure_set_byte_order_recursive(
+ struct bt_field_type *ft,
+ enum bt_byte_order byte_order);
+static
+void bt_field_type_variant_set_byte_order_recursive(
+ struct bt_field_type *ft,
+ enum bt_byte_order byte_order);
+
+static
+void bt_field_type_array_set_byte_order_recursive(
+ struct bt_field_type *ft,
+ enum bt_byte_order byte_order);
+
+static
+void bt_field_type_sequence_set_byte_order_recursive(
+ struct bt_field_type *ft,
+ enum bt_byte_order byte_order);
+
+static
+int bt_field_type_integer_compare(struct bt_field_type *ft_a,
+ struct bt_field_type *ft_b);
+
+static
+int bt_field_type_floating_point_compare(
+ struct bt_field_type *ft_a,
+ struct bt_field_type *ft_b);
+
+static
+int bt_field_type_enumeration_compare_recursive(
+ struct bt_field_type *ft_a,
+ struct bt_field_type *ft_b);
+
+static
+int bt_field_type_string_compare(struct bt_field_type *ft_a,
+ struct bt_field_type *ft_b);
+
+static
+int bt_field_type_structure_compare_recursive(
+ struct bt_field_type *ft_a,
+ struct bt_field_type *ft_b);
+
+static
+int bt_field_type_variant_compare_recursive(
+ struct bt_field_type *ft_a,
+ struct bt_field_type *ft_b);
+
+static
+int bt_field_type_array_compare_recursive(
+ struct bt_field_type *ft_a,
+ struct bt_field_type *ft_b);
+
+static
+int bt_field_type_sequence_compare_recursive(
+ struct bt_field_type *ft_a,
+ struct bt_field_type *ft_b);
+
+static struct bt_field_type_methods bt_field_type_integer_methods = {
+ .freeze = bt_field_type_generic_freeze,
+ .validate = bt_field_type_integer_validate,
+ .set_byte_order = bt_field_type_integer_set_byte_order,
+ .copy = (bt_field_type_method_copy)
bt_field_type_integer_copy,
- .compare = bt_field_type_common_integer_compare,
+ .compare = bt_field_type_integer_compare,
};
-static struct bt_field_type_common_methods bt_field_type_floating_point_methods = {
- .freeze = bt_field_type_common_generic_freeze,
+static struct bt_field_type_methods bt_field_type_floating_point_methods = {
+ .freeze = bt_field_type_generic_freeze,
.validate = NULL,
- .set_byte_order = bt_field_type_common_floating_point_set_byte_order,
- .copy = (bt_field_type_common_method_copy)
+ .set_byte_order = bt_field_type_floating_point_set_byte_order,
+ .copy = (bt_field_type_method_copy)
bt_field_type_floating_point_copy,
- .compare = bt_field_type_common_floating_point_compare,
+ .compare = bt_field_type_floating_point_compare,
};
-static struct bt_field_type_common_methods bt_field_type_enumeration_methods = {
- .freeze = bt_field_type_common_enumeration_freeze_recursive,
- .validate = bt_field_type_common_enumeration_validate_recursive,
- .set_byte_order = bt_field_type_common_enumeration_set_byte_order_recursive,
- .copy = (bt_field_type_common_method_copy)
+static struct bt_field_type_methods bt_field_type_enumeration_methods = {
+ .freeze = bt_field_type_enumeration_freeze_recursive,
+ .validate = bt_field_type_enumeration_validate_recursive,
+ .set_byte_order = bt_field_type_enumeration_set_byte_order_recursive,
+ .copy = (bt_field_type_method_copy)
bt_field_type_enumeration_copy_recursive,
- .compare = bt_field_type_common_enumeration_compare_recursive,
+ .compare = bt_field_type_enumeration_compare_recursive,
};
-static struct bt_field_type_common_methods bt_field_type_string_methods = {
- .freeze = bt_field_type_common_generic_freeze,
+static struct bt_field_type_methods bt_field_type_string_methods = {
+ .freeze = bt_field_type_generic_freeze,
.validate = NULL,
.set_byte_order = NULL,
- .copy = (bt_field_type_common_method_copy)
+ .copy = (bt_field_type_method_copy)
bt_field_type_string_copy,
- .compare = bt_field_type_common_string_compare,
+ .compare = bt_field_type_string_compare,
};
-static struct bt_field_type_common_methods bt_field_type_array_methods = {
- .freeze = bt_field_type_common_array_freeze_recursive,
- .validate = bt_field_type_common_array_validate_recursive,
- .set_byte_order = bt_field_type_common_array_set_byte_order_recursive,
- .copy = (bt_field_type_common_method_copy)
+static struct bt_field_type_methods bt_field_type_array_methods = {
+ .freeze = bt_field_type_array_freeze_recursive,
+ .validate = bt_field_type_array_validate_recursive,
+ .set_byte_order = bt_field_type_array_set_byte_order_recursive,
+ .copy = (bt_field_type_method_copy)
bt_field_type_array_copy_recursive,
- .compare = bt_field_type_common_array_compare_recursive,
+ .compare = bt_field_type_array_compare_recursive,
};
-static struct bt_field_type_common_methods bt_field_type_sequence_methods = {
- .freeze = bt_field_type_common_sequence_freeze_recursive,
- .validate = bt_field_type_common_sequence_validate_recursive,
- .set_byte_order = bt_field_type_common_sequence_set_byte_order_recursive,
- .copy = (bt_field_type_common_method_copy)
+static struct bt_field_type_methods bt_field_type_sequence_methods = {
+ .freeze = bt_field_type_sequence_freeze_recursive,
+ .validate = bt_field_type_sequence_validate_recursive,
+ .set_byte_order = bt_field_type_sequence_set_byte_order_recursive,
+ .copy = (bt_field_type_method_copy)
bt_field_type_sequence_copy_recursive,
- .compare = bt_field_type_common_sequence_compare_recursive,
+ .compare = bt_field_type_sequence_compare_recursive,
};
-static struct bt_field_type_common_methods bt_field_type_structure_methods = {
- .freeze = bt_field_type_common_structure_freeze_recursive,
- .validate = bt_field_type_common_structure_validate_recursive,
- .set_byte_order = bt_field_type_common_structure_set_byte_order_recursive,
- .copy = (bt_field_type_common_method_copy)
+static struct bt_field_type_methods bt_field_type_structure_methods = {
+ .freeze = bt_field_type_structure_freeze_recursive,
+ .validate = bt_field_type_structure_validate_recursive,
+ .set_byte_order = bt_field_type_structure_set_byte_order_recursive,
+ .copy = (bt_field_type_method_copy)
bt_field_type_structure_copy_recursive,
- .compare = bt_field_type_common_structure_compare_recursive,
+ .compare = bt_field_type_structure_compare_recursive,
};
-static struct bt_field_type_common_methods bt_field_type_variant_methods = {
- .freeze = bt_field_type_common_variant_freeze_recursive,
- .validate = bt_field_type_common_variant_validate_recursive,
- .set_byte_order = bt_field_type_common_variant_set_byte_order_recursive,
- .copy = (bt_field_type_common_method_copy)
+static struct bt_field_type_methods bt_field_type_variant_methods = {
+ .freeze = bt_field_type_variant_freeze_recursive,
+ .validate = bt_field_type_variant_validate_recursive,
+ .set_byte_order = bt_field_type_variant_set_byte_order_recursive,
+ .copy = (bt_field_type_method_copy)
bt_field_type_variant_copy_recursive,
- .compare = bt_field_type_common_variant_compare_recursive,
+ .compare = bt_field_type_variant_compare_recursive,
};
static
g_free(mapping);
}
-BT_HIDDEN
-void bt_field_type_common_initialize(struct bt_field_type_common *ft,
+static
+void bt_field_type_initialize(struct bt_field_type *ft,
bool init_bo, bt_object_release_func release_func,
- struct bt_field_type_common_methods *methods)
+ struct bt_field_type_methods *methods)
{
BT_ASSERT(ft && (ft->id > BT_FIELD_TYPE_ID_UNKNOWN) &&
(ft->id < BT_FIELD_TYPE_ID_NR));
BT_LOGD("Setting initial field type's byte order: bo=%s",
bt_common_byte_order_string(bo));
- ret = bt_field_type_common_set_byte_order(ft, bo);
+ ret = bt_field_type_set_byte_order(ft, bo);
BT_ASSERT(ret == 0);
}
ft->alignment = 1;
}
-BT_HIDDEN
-void bt_field_type_common_integer_initialize(
- struct bt_field_type_common *ft,
+static
+void bt_field_type_integer_initialize(
+ struct bt_field_type *ft,
unsigned int size, bt_object_release_func release_func,
- struct bt_field_type_common_methods *methods)
+ struct bt_field_type_methods *methods)
{
- struct bt_field_type_common_integer *int_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_integer *int_ft = (void *) ft;
BT_ASSERT(size > 0);
- BT_LOGD("Initializing common integer field type object: size=%u",
+ BT_LOGD("Initializing integer field type object: size=%u",
size);
ft->id = BT_FIELD_TYPE_ID_INTEGER;
int_ft->size = size;
int_ft->base = BT_INTEGER_BASE_DECIMAL;
int_ft->encoding = BT_STRING_ENCODING_NONE;
- bt_field_type_common_initialize(ft, true, release_func, methods);
- BT_LOGD("Initialized common integer field type object: addr=%p, size=%u",
+ bt_field_type_initialize(ft, true, release_func, methods);
+ BT_LOGD("Initialized integer field type object: addr=%p, size=%u",
ft, size);
}
-BT_HIDDEN
-void bt_field_type_common_floating_point_initialize(
- struct bt_field_type_common *ft,
+static
+void bt_field_type_floating_point_initialize(
+ struct bt_field_type *ft,
bt_object_release_func release_func,
- struct bt_field_type_common_methods *methods)
+ struct bt_field_type_methods *methods)
{
- struct bt_field_type_common_floating_point *flt_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_floating_point *flt_ft = (void *) ft;
- BT_LOGD_STR("Initializing common floating point number field type object.");
+ BT_LOGD_STR("Initializing floating point number field type object.");
ft->id = BT_FIELD_TYPE_ID_FLOAT;
flt_ft->exp_dig = sizeof(float) * CHAR_BIT - FLT_MANT_DIG;
flt_ft->mant_dig = FLT_MANT_DIG;
- bt_field_type_common_initialize(ft, true, release_func, methods);
- BT_LOGD("Initialized common floating point number field type object: addr=%p, "
+ bt_field_type_initialize(ft, true, release_func, methods);
+ BT_LOGD("Initialized floating point number field type object: addr=%p, "
"exp-size=%u, mant-size=%u", ft, flt_ft->exp_dig,
flt_ft->mant_dig);
}
-BT_HIDDEN
-void bt_field_type_common_enumeration_initialize(
- struct bt_field_type_common *ft,
- struct bt_field_type_common *container_ft,
+static
+void bt_field_type_enumeration_initialize(
+ struct bt_field_type *ft,
+ struct bt_field_type *container_ft,
bt_object_release_func release_func,
- struct bt_field_type_common_methods *methods)
+ struct bt_field_type_methods *methods)
{
- struct bt_field_type_common_enumeration *enum_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_enumeration *enum_ft = (void *) ft;
BT_ASSERT(container_ft);
- BT_LOGD("Initializing common enumeration field type object: int-ft-addr=%p",
+ BT_LOGD("Initializing enumeration field type object: int-ft-addr=%p",
container_ft);
ft->id = BT_FIELD_TYPE_ID_ENUM;
enum_ft->container_ft = bt_get(container_ft);
enum_ft->entries = g_ptr_array_new_with_free_func(
(GDestroyNotify) destroy_enumeration_mapping);
- bt_field_type_common_initialize(ft, false, release_func, methods);
- BT_LOGD("Initialized common enumeration field type object: addr=%p, "
+ bt_field_type_initialize(ft, false, release_func, methods);
+ BT_LOGD("Initialized enumeration field type object: addr=%p, "
"int-ft-addr=%p, int-ft-size=%u", ft, container_ft,
- bt_field_type_common_integer_get_size(container_ft));
+ bt_field_type_integer_get_size(container_ft));
}
-BT_HIDDEN
-void bt_field_type_common_string_initialize(
- struct bt_field_type_common *ft,
+static
+void bt_field_type_string_initialize(
+ struct bt_field_type *ft,
bt_object_release_func release_func,
- struct bt_field_type_common_methods *methods)
+ struct bt_field_type_methods *methods)
{
- struct bt_field_type_common_string *string_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_string *string_ft = (void *) ft;
- BT_LOGD_STR("Initializing common string field type object.");
+ BT_LOGD_STR("Initializing string field type object.");
ft->id = BT_FIELD_TYPE_ID_STRING;
- bt_field_type_common_initialize(ft, true, release_func, methods);
+ bt_field_type_initialize(ft, true, release_func, methods);
string_ft->encoding = BT_STRING_ENCODING_UTF8;
ft->alignment = CHAR_BIT;
- BT_LOGD("Initialized common string field type object: addr=%p", ft);
+ BT_LOGD("Initialized string field type object: addr=%p", ft);
}
-BT_HIDDEN
-void bt_field_type_common_structure_initialize(
- struct bt_field_type_common *ft,
+static
+void bt_field_type_structure_initialize(
+ struct bt_field_type *ft,
bt_object_release_func release_func,
- struct bt_field_type_common_methods *methods)
+ struct bt_field_type_methods *methods)
{
- struct bt_field_type_common_structure *struct_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_structure *struct_ft = (void *) ft;
- BT_LOGD_STR("Initializing common structure field type object.");
+ BT_LOGD_STR("Initializing structure field type object.");
ft->id = BT_FIELD_TYPE_ID_STRUCT;
struct_ft->fields = g_array_new(FALSE, TRUE,
- sizeof(struct bt_field_type_common_structure_field));
+ sizeof(struct bt_field_type_structure_field));
struct_ft->field_name_to_index = g_hash_table_new(NULL, NULL);
- bt_field_type_common_initialize(ft, true, release_func, methods);
- BT_LOGD("Initialized common structure field type object: addr=%p", ft);
+ bt_field_type_initialize(ft, true, release_func, methods);
+ BT_LOGD("Initialized structure field type object: addr=%p", ft);
}
-BT_HIDDEN
-void bt_field_type_common_array_initialize(
- struct bt_field_type_common *ft,
- struct bt_field_type_common *element_ft,
+static
+void bt_field_type_array_initialize(
+ struct bt_field_type *ft,
+ struct bt_field_type *element_ft,
unsigned int length, bt_object_release_func release_func,
- struct bt_field_type_common_methods *methods)
+ struct bt_field_type_methods *methods)
{
- struct bt_field_type_common_array *array_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_array *array_ft = (void *) ft;
BT_ASSERT(element_ft);
- BT_LOGD("Initializing common array field type object: element-ft-addr=%p, "
+ BT_LOGD("Initializing array field type object: element-ft-addr=%p, "
"length=%u", element_ft, length);
ft->id = BT_FIELD_TYPE_ID_ARRAY;
array_ft->element_ft = bt_get(element_ft);
array_ft->length = length;
- bt_field_type_common_initialize(ft, false, release_func, methods);
- BT_LOGD("Initialized common array field type object: addr=%p, "
+ bt_field_type_initialize(ft, false, release_func, methods);
+ BT_LOGD("Initialized array field type object: addr=%p, "
"element-ft-addr=%p, length=%u", ft, element_ft, length);
}
-BT_HIDDEN
-void bt_field_type_common_sequence_initialize(
- struct bt_field_type_common *ft,
- struct bt_field_type_common *element_ft,
+static
+void bt_field_type_sequence_initialize(
+ struct bt_field_type *ft,
+ struct bt_field_type *element_ft,
const char *length_field_name,
bt_object_release_func release_func,
- struct bt_field_type_common_methods *methods)
+ struct bt_field_type_methods *methods)
{
- struct bt_field_type_common_sequence *seq_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_sequence *seq_ft = (void *) ft;
BT_ASSERT(element_ft);
BT_ASSERT(length_field_name);
BT_ASSERT(bt_identifier_is_valid(length_field_name));
- BT_LOGD("Initializing common sequence field type object: element-ft-addr=%p, "
+ BT_LOGD("Initializing sequence field type object: element-ft-addr=%p, "
"length-field-name=\"%s\"", element_ft, length_field_name);
ft->id = BT_FIELD_TYPE_ID_SEQUENCE;
seq_ft->element_ft = bt_get(element_ft);
seq_ft->length_field_name = g_string_new(length_field_name);
- bt_field_type_common_initialize(ft, false, release_func, methods);
- BT_LOGD("Initialized common sequence field type object: addr=%p, "
+ bt_field_type_initialize(ft, false, release_func, methods);
+ BT_LOGD("Initialized sequence field type object: addr=%p, "
"element-ft-addr=%p, length-field-name=\"%s\"",
ft, element_ft, length_field_name);
}
-BT_HIDDEN
-void bt_field_type_common_variant_initialize(
- struct bt_field_type_common *ft,
- struct bt_field_type_common *tag_ft,
+static
+void bt_field_type_variant_initialize(
+ struct bt_field_type *ft,
+ struct bt_field_type *tag_ft,
const char *tag_name,
bt_object_release_func release_func,
- struct bt_field_type_common_methods *methods)
+ struct bt_field_type_methods *methods)
{
- struct bt_field_type_common_variant *var_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_variant *var_ft = (void *) ft;
BT_ASSERT(!tag_name || bt_identifier_is_valid(tag_name));
- BT_LOGD("Initializing common variant field type object: "
+ BT_LOGD("Initializing variant field type object: "
"tag-ft-addr=%p, tag-field-name=\"%s\"",
tag_ft, tag_name);
ft->id = BT_FIELD_TYPE_ID_VARIANT;
var_ft->tag_name = g_string_new(tag_name);
var_ft->choice_name_to_index = g_hash_table_new(NULL, NULL);
var_ft->choices = g_array_new(FALSE, TRUE,
- sizeof(struct bt_field_type_common_variant_choice));
+ sizeof(struct bt_field_type_variant_choice));
if (tag_ft) {
var_ft->tag_ft = bt_get(tag_ft);
}
- bt_field_type_common_initialize(ft, true, release_func, methods);
+ bt_field_type_initialize(ft, true, release_func, methods);
/* A variant's alignment is undefined */
ft->alignment = 0;
- BT_LOGD("Initialized common variant field type object: addr=%p, "
+ BT_LOGD("Initialized variant field type object: addr=%p, "
"tag-ft-addr=%p, tag-field-name=\"%s\"",
ft, tag_ft, tag_name);
}
-BT_HIDDEN
-void bt_field_type_common_integer_destroy(struct bt_object *obj)
+static
+void bt_field_type_integer_destroy(struct bt_object *obj)
{
- struct bt_field_type_common_integer *ft = (void *) obj;
+ struct bt_field_type_integer *ft = (void *) obj;
if (!ft) {
return;
g_free(ft);
}
-BT_HIDDEN
-void bt_field_type_common_floating_point_destroy(struct bt_object *obj)
+static
+void bt_field_type_floating_point_destroy(struct bt_object *obj)
{
- struct bt_field_type_common_floating_point *ft = (void *) obj;
+ struct bt_field_type_floating_point *ft = (void *) obj;
if (!ft) {
return;
g_free(ft);
}
-BT_HIDDEN
-void bt_field_type_common_enumeration_destroy_recursive(struct bt_object *obj)
+static
+void bt_field_type_enumeration_destroy_recursive(struct bt_object *obj)
{
- struct bt_field_type_common_enumeration *ft = (void *) obj;
+ struct bt_field_type_enumeration *ft = (void *) obj;
if (!ft) {
return;
g_free(ft);
}
-BT_HIDDEN
-void bt_field_type_common_string_destroy(struct bt_object *obj)
+static
+void bt_field_type_string_destroy(struct bt_object *obj)
{
- struct bt_field_type_common_string *ft = (void *) obj;
+ struct bt_field_type_string *ft = (void *) obj;
if (!ft) {
return;
}
static
-void bt_field_type_common_structure_field_finalize(
- struct bt_field_type_common_structure_field *field)
+void bt_field_type_structure_field_finalize(
+ struct bt_field_type_structure_field *field)
{
if (!field) {
return;
bt_put(field->type);
}
-BT_HIDDEN
-void bt_field_type_common_structure_destroy_recursive(struct bt_object *obj)
+static
+void bt_field_type_structure_destroy_recursive(struct bt_object *obj)
{
- struct bt_field_type_common_structure *ft = (void *) obj;
+ struct bt_field_type_structure *ft = (void *) obj;
uint64_t i;
if (!ft) {
if (ft->fields) {
for (i = 0; i < ft->fields->len; i++) {
- bt_field_type_common_structure_field_finalize(
- BT_FIELD_TYPE_COMMON_STRUCTURE_FIELD_AT_INDEX(
+ bt_field_type_structure_field_finalize(
+ BT_FIELD_TYPE_STRUCTURE_FIELD_AT_INDEX(
ft, i));
}
g_free(ft);
}
-BT_HIDDEN
-void bt_field_type_common_array_destroy_recursive(struct bt_object *obj)
+static
+void bt_field_type_array_destroy_recursive(struct bt_object *obj)
{
- struct bt_field_type_common_array *ft = (void *) obj;
+ struct bt_field_type_array *ft = (void *) obj;
if (!ft) {
return;
g_free(ft);
}
-BT_HIDDEN
-void bt_field_type_common_sequence_destroy_recursive(struct bt_object *obj)
+static
+void bt_field_type_sequence_destroy_recursive(struct bt_object *obj)
{
- struct bt_field_type_common_sequence *ft = (void *) obj;
+ struct bt_field_type_sequence *ft = (void *) obj;
if (!ft) {
return;
}
static
-void bt_field_type_common_variant_choice_finalize(
- struct bt_field_type_common_variant_choice *choice)
+void bt_field_type_variant_choice_finalize(
+ struct bt_field_type_variant_choice *choice)
{
if (!choice) {
return;
}
}
-BT_HIDDEN
-void bt_field_type_common_variant_destroy_recursive(struct bt_object *obj)
+static
+void bt_field_type_variant_destroy_recursive(struct bt_object *obj)
{
- struct bt_field_type_common_variant *ft = (void *) obj;
+ struct bt_field_type_variant *ft = (void *) obj;
uint64_t i;
if (!ft) {
if (ft->choices) {
for (i = 0; i < ft->choices->len; i++) {
- bt_field_type_common_variant_choice_finalize(
- BT_FIELD_TYPE_COMMON_VARIANT_CHOICE_AT_INDEX(
+ bt_field_type_variant_choice_finalize(
+ BT_FIELD_TYPE_VARIANT_CHOICE_AT_INDEX(
ft, i));
}
GQuark mapping_name;
};
-static
-void check_ranges_overlap(gpointer element, gpointer query)
-{
- struct enumeration_mapping *mapping = element;
- struct range_overlap_query *overlap_query = query;
-
- if (mapping->range_start._signed <= overlap_query->range_end._signed
- && overlap_query->range_start._signed <=
- mapping->range_end._signed) {
- overlap_query->overlaps = 1;
- overlap_query->mapping_name = mapping->string;
- }
-
- overlap_query->overlaps |=
- mapping->string == overlap_query->mapping_name;
-
- if (overlap_query->overlaps) {
- BT_LOGV("Overlapping enumeration field type mappings: "
- "mapping-name=\"%s\", "
- "mapping-a-range-start=%" PRId64 ", "
- "mapping-a-range-end=%" PRId64 ", "
- "mapping-b-range-start=%" PRId64 ", "
- "mapping-b-range-end=%" PRId64,
- g_quark_to_string(mapping->string),
- mapping->range_start._signed,
- mapping->range_end._signed,
- overlap_query->range_start._signed,
- overlap_query->range_end._signed);
- }
-}
-
-static
-void check_ranges_overlap_unsigned(gpointer element, gpointer query)
-{
- struct enumeration_mapping *mapping = element;
- struct range_overlap_query *overlap_query = query;
-
- if (mapping->range_start._unsigned <= overlap_query->range_end._unsigned
- && overlap_query->range_start._unsigned <=
- mapping->range_end._unsigned) {
- overlap_query->overlaps = 1;
- overlap_query->mapping_name = mapping->string;
- }
-
- overlap_query->overlaps |=
- mapping->string == overlap_query->mapping_name;
-
- if (overlap_query->overlaps) {
- BT_LOGW("Overlapping enumeration field type mappings: "
- "mapping-name=\"%s\", "
- "mapping-a-range-start=%" PRIu64 ", "
- "mapping-a-range-end=%" PRIu64 ", "
- "mapping-b-range-start=%" PRIu64 ", "
- "mapping-b-range-end=%" PRIu64,
- g_quark_to_string(mapping->string),
- mapping->range_start._unsigned,
- mapping->range_end._unsigned,
- overlap_query->range_start._unsigned,
- overlap_query->range_end._unsigned);
- }
-}
-
static
gint compare_enumeration_mappings_signed(struct enumeration_mapping **a,
struct enumeration_mapping **b)
static
int add_structure_variant_member(GArray *members,
GHashTable *field_name_to_index,
- struct bt_field_type_common *field_type, const char *field_name,
+ struct bt_field_type *field_type, const char *field_name,
bool is_variant)
{
int ret = 0;
GQuark name_quark = g_quark_from_string(field_name);
- struct bt_field_type_common **member_ft;
+ struct bt_field_type **member_ft;
GQuark *member_name;
/* Make sure structure does not contain a field of the same name */
g_array_set_size(members, members->len + 1);
if (is_variant) {
- struct bt_field_type_common_variant_choice *choice =
+ struct bt_field_type_variant_choice *choice =
&g_array_index(members,
- struct bt_field_type_common_variant_choice,
+ struct bt_field_type_variant_choice,
members->len - 1);
member_ft = &choice->type;
member_name = &choice->name;
BT_ASSERT(!choice->ranges);
choice->ranges = g_array_new(FALSE, TRUE,
- sizeof(struct bt_field_type_common_variant_choice_range));
+ sizeof(struct bt_field_type_variant_choice_range));
BT_ASSERT(choice->ranges);
} else {
- struct bt_field_type_common_structure_field *field =
+ struct bt_field_type_structure_field *field =
&g_array_index(members,
- struct bt_field_type_common_structure_field,
+ struct bt_field_type_structure_field,
members->len - 1);
member_ft = &field->type;
return ret;
}
-BT_HIDDEN
-int bt_field_type_common_integer_validate(struct bt_field_type_common *ft)
+static
+int bt_field_type_integer_validate(struct bt_field_type *ft)
{
int ret = 0;
- struct bt_field_type_common_integer *int_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_integer *int_ft = (void *) ft;
if (int_ft->mapped_clock_class && int_ft->is_signed) {
BT_LOGW("Invalid integer field type: cannot be signed and have a mapped clock class: "
}
static
-struct enumeration_mapping *bt_field_type_common_enumeration_get_mapping_by_index(
- struct bt_field_type_common *ft, uint64_t index)
+struct enumeration_mapping *bt_field_type_enumeration_get_mapping_by_index(
+ struct bt_field_type *ft, uint64_t index)
{
- struct bt_field_type_common_enumeration *enum_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_enumeration *enum_ft = (void *) ft;
struct enumeration_mapping *mapping = NULL;
if (index >= enum_ft->entries->len) {
* Only used when freezing an enumeration.
*/
static
-void bt_field_type_common_enumeration_set_range_overlap(
- struct bt_field_type_common_enumeration *ft)
+void bt_field_type_enumeration_set_range_overlap(
+ struct bt_field_type_enumeration *ft)
{
int64_t i, j, len;
int is_signed;
BT_LOGV("Setting enumeration field type's overlap flag: addr=%p",
ft);
len = ft->entries->len;
- is_signed = bt_field_type_common_integer_is_signed(
- BT_TO_COMMON(ft->container_ft));
+ is_signed = bt_field_type_integer_is_signed((void *) ft->container_ft);
for (i = 0; i < len; i++) {
for (j = i + 1; j < len; j++) {
struct enumeration_mapping *mapping[2];
- mapping[0] = bt_field_type_common_enumeration_get_mapping_by_index(
- BT_TO_COMMON(ft), i);
- mapping[1] = bt_field_type_common_enumeration_get_mapping_by_index(
- BT_TO_COMMON(ft), j);
+ mapping[0] = bt_field_type_enumeration_get_mapping_by_index(
+ (void *) ft, i);
+ mapping[1] = bt_field_type_enumeration_get_mapping_by_index(
+ (void *) ft, j);
if (is_signed) {
if (mapping[0]->range_start._signed
<= mapping[1]->range_end._signed
}
}
-BT_HIDDEN
-int bt_field_type_common_enumeration_validate_recursive(
- struct bt_field_type_common *ft)
+static
+int bt_field_type_enumeration_validate_recursive(
+ struct bt_field_type *ft)
{
int ret = 0;
- struct bt_field_type_common_enumeration *enum_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_enumeration *enum_ft = (void *) ft;
- ret = bt_field_type_common_integer_validate(
- BT_TO_COMMON(enum_ft->container_ft));
+ ret = bt_field_type_integer_validate((void *) enum_ft->container_ft);
if (ret) {
BT_LOGW("Invalid enumeration field type: container type is invalid: "
"enum-ft-addr=%p, int-ft-addr=%p",
return ret;
}
-BT_HIDDEN
-int bt_field_type_common_sequence_validate_recursive(
- struct bt_field_type_common *ft)
+static
+int bt_field_type_sequence_validate_recursive(
+ struct bt_field_type *ft)
{
int ret = 0;
- struct bt_field_type_common_sequence *seq_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_sequence *seq_ft = (void *) ft;
/* Length field name should be set at this point */
if (seq_ft->length_field_name->len == 0) {
goto end;
}
- ret = bt_field_type_common_validate(seq_ft->element_ft);
+ ret = bt_field_type_validate(seq_ft->element_ft);
if (ret) {
BT_LOGW("Invalid sequence field type: invalid element field type: "
"seq-ft-addr=%p, element-ft-add=%p",
return ret;
}
-BT_HIDDEN
-int bt_field_type_common_array_validate_recursive(
- struct bt_field_type_common *ft)
+static
+int bt_field_type_array_validate_recursive(
+ struct bt_field_type *ft)
{
int ret = 0;
- struct bt_field_type_common_array *array_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_array *array_ft = (void *) ft;
- ret = bt_field_type_common_validate(array_ft->element_ft);
+ ret = bt_field_type_validate(array_ft->element_ft);
if (ret) {
BT_LOGW("Invalid array field type: invalid element field type: "
"array-ft-addr=%p, element-ft-add=%p",
return ret;
}
-BT_HIDDEN
-int bt_field_type_common_structure_validate_recursive(
- struct bt_field_type_common *ft)
+static
+int bt_field_type_structure_validate_recursive(
+ struct bt_field_type *ft)
{
int ret = 0;
- struct bt_field_type_common *child_ft = NULL;
+ struct bt_field_type *child_ft = NULL;
int64_t field_count =
- bt_field_type_common_structure_get_field_count(ft);
+ bt_field_type_structure_get_field_count(ft);
int64_t i;
BT_ASSERT(field_count >= 0);
for (i = 0; i < field_count; ++i) {
const char *field_name;
- ret = bt_field_type_common_structure_borrow_field_by_index(ft,
+ ret = bt_field_type_structure_borrow_field_by_index(ft,
&field_name, &child_ft, i);
BT_ASSERT(ret == 0);
- ret = bt_field_type_common_validate(child_ft);
+ ret = bt_field_type_validate(child_ft);
if (ret) {
BT_LOGW("Invalid structure field type: "
"a contained field type is invalid: "
}
static
-bt_bool bt_field_type_common_enumeration_has_overlapping_ranges(
- struct bt_field_type_common_enumeration *enum_ft)
+bt_bool bt_field_type_enumeration_has_overlapping_ranges(
+ struct bt_field_type_enumeration *enum_ft)
{
if (!enum_ft->common.frozen) {
- bt_field_type_common_enumeration_set_range_overlap(enum_ft);
+ bt_field_type_enumeration_set_range_overlap(enum_ft);
}
return enum_ft->has_overlapping_ranges;
}
-BT_HIDDEN
-int bt_field_type_common_variant_validate_recursive(
- struct bt_field_type_common *ft)
+static
+int bt_field_type_variant_validate_recursive(
+ struct bt_field_type *ft)
{
int ret = 0;
int64_t field_count;
- struct bt_field_type_common *child_ft = NULL;
- struct bt_field_type_common_variant *var_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type *child_ft = NULL;
+ struct bt_field_type_variant *var_ft = (void *) ft;
int64_t i;
if (var_ft->tag_name->len == 0) {
goto end;
}
- if (bt_field_type_common_enumeration_has_overlapping_ranges(var_ft->tag_ft)) {
+ if (bt_field_type_enumeration_has_overlapping_ranges(var_ft->tag_ft)) {
BT_LOGW("Invalid variant field type: enumeration tag field type has overlapping ranges: "
"variant-ft-addr=%p, tag-field-name=\"%s\", "
"enum-ft-addr=%p", ft, var_ft->tag_name->str,
* enumeration while reading a variant field, an error will be
* generated at that point (while reading the stream).
*/
- field_count = bt_field_type_common_variant_get_field_count(ft);
+ field_count = bt_field_type_variant_get_field_count(ft);
if (field_count < 0) {
BT_LOGW("Invalid variant field type: no fields: "
"addr=%p, tag-field-name=\"%s\"",
for (i = 0; i < field_count; ++i) {
const char *field_name;
- ret = bt_field_type_common_variant_borrow_field_by_index(ft,
+ ret = bt_field_type_variant_borrow_field_by_index(ft,
&field_name, &child_ft, i);
BT_ASSERT(ret == 0);
- ret = bt_field_type_common_validate(child_ft);
+ ret = bt_field_type_validate(child_ft);
if (ret) {
BT_LOGW("Invalid variant field type: "
"a contained field type is invalid: "
* applicable.
*/
BT_HIDDEN
-int bt_field_type_common_validate(struct bt_field_type_common *ft)
+int bt_field_type_validate(struct bt_field_type *ft)
{
int ret = 0;
struct bt_field_type *bt_field_type_integer_create(unsigned int size)
{
- struct bt_field_type_common_integer *integer = NULL;
+ struct bt_field_type_integer *integer = NULL;
BT_LOGD("Creating integer field type object: size=%u", size);
goto error;
}
- integer = g_new0(struct bt_field_type_common_integer, 1);
+ integer = g_new0(struct bt_field_type_integer, 1);
if (!integer) {
BT_LOGE_STR("Failed to allocate one integer field type.");
goto error;
}
- bt_field_type_common_integer_initialize(BT_TO_COMMON(integer),
- size, bt_field_type_common_integer_destroy,
+ bt_field_type_integer_initialize((void *) integer,
+ size, bt_field_type_integer_destroy,
&bt_field_type_integer_methods);
BT_LOGD("Created integer field type object: addr=%p, size=%u",
integer, size);
return (void *) integer;
}
-BT_HIDDEN
-int bt_field_type_common_integer_get_size(struct bt_field_type_common *ft)
+
+int bt_field_type_integer_get_size(struct bt_field_type *ft)
{
- struct bt_field_type_common_integer *int_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_integer *int_ft = (void *) ft;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_INTEGER,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_INTEGER,
"Field type");
return (int) int_ft->size;
}
-int bt_field_type_integer_get_size(struct bt_field_type *ft)
-{
- return bt_field_type_common_integer_get_size((void *) ft);
-}
-
-BT_HIDDEN
-bt_bool bt_field_type_common_integer_is_signed(struct bt_field_type_common *ft)
+bt_bool bt_field_type_integer_is_signed(struct bt_field_type *ft)
{
- struct bt_field_type_common_integer *int_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_integer *int_ft = (void *) ft;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_INTEGER,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_INTEGER,
"Field type");
return int_ft->is_signed;
}
-bt_bool bt_field_type_integer_is_signed(struct bt_field_type *ft)
-{
- return bt_field_type_common_integer_is_signed((void *) ft);
-}
-
-BT_HIDDEN
-int bt_field_type_common_integer_set_is_signed(struct bt_field_type_common *ft,
+int bt_field_type_integer_set_is_signed(struct bt_field_type *ft,
bt_bool is_signed)
{
int ret = 0;
- struct bt_field_type_common_integer *int_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_integer *int_ft = (void *) ft;
if (!ft) {
BT_LOGW_STR("Invalid parameter: field type is NULL.");
return ret;
}
-int bt_field_type_integer_set_is_signed(struct bt_field_type *ft,
- bt_bool is_signed)
-{
- return bt_field_type_common_integer_set_is_signed((void *) ft,
- is_signed);
-}
-
-BT_HIDDEN
-int bt_field_type_common_integer_set_size(struct bt_field_type_common *ft,
+int bt_field_type_integer_set_size(struct bt_field_type *ft,
unsigned int size)
{
int ret = 0;
- struct bt_field_type_common_integer *int_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_integer *int_ft = (void *) ft;
if (!ft) {
BT_LOGW_STR("Invalid parameter: field type is NULL.");
return ret;
}
-int bt_field_type_integer_set_size(struct bt_field_type *ft,
- unsigned int size)
-{
- return bt_field_type_common_integer_set_size((void *) ft, size);
-}
-
-BT_HIDDEN
-enum bt_integer_base bt_field_type_common_integer_get_base(
- struct bt_field_type_common *ft)
+enum bt_integer_base bt_field_type_integer_get_base(
+ struct bt_field_type *ft)
{
- struct bt_field_type_common_integer *int_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_integer *int_ft = (void *) ft;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_INTEGER,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_INTEGER,
"Field type");
return int_ft->base;
}
-enum bt_integer_base bt_field_type_integer_get_base(
- struct bt_field_type *ft)
-{
- return bt_field_type_common_integer_get_base((void *) ft);
-}
-
-BT_HIDDEN
-int bt_field_type_common_integer_set_base(struct bt_field_type_common *ft,
+int bt_field_type_integer_set_base(struct bt_field_type *ft,
enum bt_integer_base base)
{
int ret = 0;
- struct bt_field_type_common_integer *int_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_integer *int_ft = (void *) ft;
if (!ft) {
BT_LOGW_STR("Invalid parameter: field type is NULL.");
return ret;
}
-int bt_field_type_integer_set_base(struct bt_field_type *ft,
- enum bt_integer_base base)
-{
- return bt_field_type_common_integer_set_base((void *) ft, base);
-}
-
-BT_HIDDEN
-enum bt_string_encoding bt_field_type_common_integer_get_encoding(
- struct bt_field_type_common *ft)
+enum bt_string_encoding bt_field_type_integer_get_encoding(
+ struct bt_field_type *ft)
{
- struct bt_field_type_common_integer *int_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_integer *int_ft = (void *) ft;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_INTEGER,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_INTEGER,
"Field type");
return int_ft->encoding;
}
-enum bt_string_encoding bt_field_type_integer_get_encoding(
- struct bt_field_type *ft)
-{
- return bt_field_type_common_integer_get_encoding((void *) ft);
-}
-
-BT_HIDDEN
-int bt_field_type_common_integer_set_encoding(struct bt_field_type_common *ft,
+int bt_field_type_integer_set_encoding(struct bt_field_type *ft,
enum bt_string_encoding encoding)
{
int ret = 0;
- struct bt_field_type_common_integer *int_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_integer *int_ft = (void *) ft;
if (!ft) {
BT_LOGW_STR("Invalid parameter: field type is NULL.");
return ret;
}
-int bt_field_type_integer_set_encoding(struct bt_field_type *ft,
- enum bt_string_encoding encoding)
-{
- return bt_field_type_common_integer_set_encoding((void *) ft, encoding);
-}
-
-BT_HIDDEN
-struct bt_clock_class *bt_field_type_common_integer_borrow_mapped_clock_class(
- struct bt_field_type_common *ft)
+struct bt_clock_class *bt_field_type_integer_borrow_mapped_clock_class(
+ struct bt_field_type *ft)
{
- struct bt_field_type_common_integer *int_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_integer *int_ft = (void *) ft;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_INTEGER,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_INTEGER,
"Field type");
return int_ft->mapped_clock_class;
}
-struct bt_clock_class *bt_field_type_integer_borrow_mapped_clock_class(
- struct bt_field_type *ft)
-{
- return bt_field_type_common_integer_borrow_mapped_clock_class(
- (void *) ft);
-}
-
-BT_HIDDEN
-int bt_field_type_common_integer_set_mapped_clock_class_no_check_frozen(
- struct bt_field_type_common *ft,
+static
+int bt_field_type_integer_set_mapped_clock_class_no_check_frozen(
+ struct bt_field_type *ft,
struct bt_clock_class *clock_class)
{
- struct bt_field_type_common_integer *int_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_integer *int_ft = (void *) ft;
int ret = 0;
if (!clock_class) {
return ret;
}
-BT_HIDDEN
-int bt_field_type_common_integer_set_mapped_clock_class(
- struct bt_field_type_common *ft,
+int bt_field_type_integer_set_mapped_clock_class(struct bt_field_type *ft,
struct bt_clock_class *clock_class)
{
int ret = 0;
goto end;
}
- ret = bt_field_type_common_integer_set_mapped_clock_class_no_check_frozen(
+ ret = bt_field_type_integer_set_mapped_clock_class_no_check_frozen(
ft, clock_class);
end:
return ret;
}
-int bt_field_type_integer_set_mapped_clock_class(struct bt_field_type *ft,
- struct bt_clock_class *clock_class)
-{
- return bt_field_type_common_integer_set_mapped_clock_class((void *) ft,
- clock_class);
-}
-
static
void bt_field_type_enum_iter_destroy(struct bt_object *obj)
{
static
struct bt_field_type_enumeration_mapping_iterator *
-bt_field_type_common_enumeration_find_mappings_type(
- struct bt_field_type_common *ft,
+bt_field_type_enumeration_find_mappings_type(
+ struct bt_field_type *ft,
enum bt_field_type_enumeration_mapping_iterator_type iterator_type)
{
struct bt_field_type_enumeration_mapping_iterator *iter = NULL;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_ENUM,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_ENUM,
"Field type");
iter = g_new0(struct bt_field_type_enumeration_mapping_iterator, 1);
if (!iter) {
return iter;
}
-BT_HIDDEN
struct bt_field_type_enumeration_mapping_iterator *
-bt_field_type_common_enumeration_find_mappings_by_name(
- struct bt_field_type_common *ft, const char *name)
+bt_field_type_enumeration_find_mappings_by_name(
+ struct bt_field_type *ft, const char *name)
{
struct bt_field_type_enumeration_mapping_iterator *iter;
- iter = bt_field_type_common_enumeration_find_mappings_type(
+ iter = bt_field_type_enumeration_find_mappings_type(
ft, ITERATOR_BY_NAME);
if (!iter) {
BT_LOGW("Cannot create enumeration field type mapping iterator: "
return NULL;
}
-struct bt_field_type_enumeration_mapping_iterator *
-bt_field_type_enumeration_find_mappings_by_name(
- struct bt_field_type *ft, const char *name)
-{
- return bt_field_type_common_enumeration_find_mappings_by_name(
- (void *) ft, name);
-}
-
int bt_field_type_enumeration_mapping_iterator_next(
struct bt_field_type_enumeration_mapping_iterator *iter)
{
- struct bt_field_type_common_enumeration *enum_ft = iter->enumeration_ft;
+ struct bt_field_type_enumeration *enum_ft = iter->enumeration_ft;
int i, ret = 0, len;
BT_ASSERT_PRE_NON_NULL(iter, "Enumeration field type mapping iterator");
len = enum_ft->entries->len;
for (i = iter->index + 1; i < len; i++) {
struct enumeration_mapping *mapping =
- bt_field_type_common_enumeration_get_mapping_by_index(
- BT_TO_COMMON(enum_ft), i);
+ bt_field_type_enumeration_get_mapping_by_index(
+ (void *) enum_ft, i);
switch (iter->type) {
case ITERATOR_BY_NAME:
return ret;
}
-BT_HIDDEN
struct bt_field_type_enumeration_mapping_iterator *
-bt_field_type_common_enumeration_signed_find_mappings_by_value(
- struct bt_field_type_common *ft, int64_t value)
+bt_field_type_enumeration_signed_find_mappings_by_value(
+ struct bt_field_type *ft, int64_t value)
{
struct bt_field_type_enumeration_mapping_iterator *iter;
- iter = bt_field_type_common_enumeration_find_mappings_type(
+ iter = bt_field_type_enumeration_find_mappings_type(
ft, ITERATOR_BY_SIGNED_VALUE);
if (!iter) {
BT_LOGW("Cannot create enumeration field type mapping iterator: "
goto error;
}
- if (bt_field_type_common_integer_is_signed(
- BT_TO_COMMON(iter->enumeration_ft->container_ft)) != 1) {
+ if (bt_field_type_integer_is_signed(
+ (void *) iter->enumeration_ft->container_ft) != 1) {
BT_LOGW("Invalid parameter: enumeration field type is unsigned: "
"enum-ft-addr=%p, int-ft-addr=%p",
ft, iter->enumeration_ft->container_ft);
}
struct bt_field_type_enumeration_mapping_iterator *
-bt_field_type_enumeration_signed_find_mappings_by_value(
- struct bt_field_type *ft, int64_t value)
-{
- return bt_field_type_common_enumeration_signed_find_mappings_by_value(
- (void *) ft, value);
-}
-
-BT_HIDDEN
-struct bt_field_type_enumeration_mapping_iterator *
-bt_field_type_common_enumeration_unsigned_find_mappings_by_value(
- struct bt_field_type_common *ft, uint64_t value)
+bt_field_type_enumeration_unsigned_find_mappings_by_value(
+ struct bt_field_type *ft, uint64_t value)
{
struct bt_field_type_enumeration_mapping_iterator *iter;
- iter = bt_field_type_common_enumeration_find_mappings_type(
+ iter = bt_field_type_enumeration_find_mappings_type(
ft, ITERATOR_BY_UNSIGNED_VALUE);
if (!iter) {
BT_LOGW("Cannot create enumeration field type mapping iterator: "
goto error;
}
- if (bt_field_type_common_integer_is_signed(
- BT_TO_COMMON(iter->enumeration_ft->container_ft)) != 0) {
+ if (bt_field_type_integer_is_signed(
+ (void *) iter->enumeration_ft->container_ft) != 0) {
BT_LOGW("Invalid parameter: enumeration field type is signed: "
"enum-ft-addr=%p, int-ft-addr=%p",
ft, iter->enumeration_ft->container_ft);
return NULL;
}
-struct bt_field_type_enumeration_mapping_iterator *
-bt_field_type_enumeration_unsigned_find_mappings_by_value(
- struct bt_field_type *ft, uint64_t value)
-{
- return bt_field_type_common_enumeration_unsigned_find_mappings_by_value(
- (void *) ft, value);
-}
-
int bt_field_type_enumeration_mapping_iterator_signed_get(
struct bt_field_type_enumeration_mapping_iterator *iter,
const char **mapping_name, int64_t *range_begin,
BT_ASSERT_PRE(iter->index != -1,
"Invalid enumeration field type mapping iterator access: "
"addr=%p, position=-1", iter);
- return bt_field_type_common_enumeration_signed_get_mapping_by_index(
+ return bt_field_type_enumeration_signed_get_mapping_by_index(
(void *) iter->enumeration_ft, iter->index,
mapping_name, range_begin, range_end);
}
BT_ASSERT_PRE(iter->index != -1,
"Invalid enumeration field type mapping iterator access: "
"addr=%p, position=-1", iter);
- return bt_field_type_common_enumeration_unsigned_get_mapping_by_index(
+ return bt_field_type_enumeration_unsigned_get_mapping_by_index(
(void *) iter->enumeration_ft, iter->index,
mapping_name, range_begin, range_end);
}
-BT_HIDDEN
-int bt_field_type_common_enumeration_signed_get_mapping_by_index(
- struct bt_field_type_common *ft, uint64_t index,
+int bt_field_type_enumeration_signed_get_mapping_by_index(
+ struct bt_field_type *ft, uint64_t index,
const char **mapping_name, int64_t *range_begin,
int64_t *range_end)
{
struct enumeration_mapping *mapping;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft,
+ BT_ASSERT_PRE_FT_HAS_ID(ft,
BT_FIELD_TYPE_ID_ENUM, "Field type");
- mapping = bt_field_type_common_enumeration_get_mapping_by_index(ft,
+ mapping = bt_field_type_enumeration_get_mapping_by_index(ft,
index);
if (!mapping) {
- /* bt_field_type_common_enumeration_get_mapping_by_index() logs errors */
+ /* bt_field_type_enumeration_get_mapping_by_index() logs errors */
ret = -1;
goto end;
}
return ret;
}
-int bt_field_type_enumeration_signed_get_mapping_by_index(
+int bt_field_type_enumeration_unsigned_get_mapping_by_index(
struct bt_field_type *ft, uint64_t index,
- const char **mapping_name, int64_t *range_begin,
- int64_t *range_end)
-{
- return bt_field_type_common_enumeration_signed_get_mapping_by_index(
- (void *) ft, index, mapping_name, range_begin, range_end);
-}
-
-BT_HIDDEN
-int bt_field_type_common_enumeration_unsigned_get_mapping_by_index(
- struct bt_field_type_common *ft, uint64_t index,
const char **mapping_name, uint64_t *range_begin,
uint64_t *range_end)
{
struct enumeration_mapping *mapping;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_ENUM, "Field type");
- mapping = bt_field_type_common_enumeration_get_mapping_by_index(
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_ENUM, "Field type");
+ mapping = bt_field_type_enumeration_get_mapping_by_index(
ft, index);
if (!mapping) {
- /* bt_field_type_common_enumeration_get_mapping_by_index() reports any error */
+ /* bt_field_type_enumeration_get_mapping_by_index() reports any error */
ret = -1;
goto end;
}
return ret;
}
-int bt_field_type_enumeration_unsigned_get_mapping_by_index(
- struct bt_field_type *ft, uint64_t index,
- const char **mapping_name, uint64_t *range_begin,
- uint64_t *range_end)
-{
- return bt_field_type_common_enumeration_unsigned_get_mapping_by_index(
- (void *) ft, index, mapping_name, range_begin, range_end);
-}
-
struct bt_field_type *bt_field_type_enumeration_create(
struct bt_field_type *container_ft)
{
- struct bt_field_type_common_enumeration *enumeration = NULL;
- struct bt_field_type_common *int_ft = (void *) container_ft;
+ struct bt_field_type_enumeration *enumeration = NULL;
+ struct bt_field_type *int_ft = (void *) container_ft;
BT_LOGD("Creating enumeration field type object: int-ft-addr=%p",
container_ft);
goto error;
}
- enumeration = g_new0(struct bt_field_type_common_enumeration, 1);
+ enumeration = g_new0(struct bt_field_type_enumeration, 1);
if (!enumeration) {
BT_LOGE_STR("Failed to allocate one enumeration field type.");
goto error;
}
- bt_field_type_common_enumeration_initialize(BT_TO_COMMON(enumeration),
- int_ft, bt_field_type_common_enumeration_destroy_recursive,
+ bt_field_type_enumeration_initialize((void *) enumeration,
+ int_ft, bt_field_type_enumeration_destroy_recursive,
&bt_field_type_enumeration_methods);
BT_LOGD("Created enumeration field type object: addr=%p, "
"int-ft-addr=%p, int-ft-size=%u",
return (void *) enumeration;
}
-BT_HIDDEN
-struct bt_field_type_common *
-bt_field_type_common_enumeration_borrow_container_field_type(
- struct bt_field_type_common *ft)
-{
- struct bt_field_type_common_enumeration *enum_ft = BT_FROM_COMMON(ft);
-
- BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_ENUM, "Field type");
- return BT_TO_COMMON(enum_ft->container_ft);
-}
-
struct bt_field_type *bt_field_type_enumeration_borrow_container_field_type(
struct bt_field_type *ft)
{
- return (void *) bt_field_type_common_enumeration_borrow_container_field_type(
- (void *) ft);
+ struct bt_field_type_enumeration *enum_ft = (void *) ft;
+
+ BT_ASSERT_PRE_NON_NULL(ft, "Field type");
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_ENUM, "Field type");
+ return (void *) enum_ft->container_ft;
}
-BT_HIDDEN
-int bt_field_type_common_enumeration_signed_add_mapping(
- struct bt_field_type_common *ft, const char *string,
+int bt_field_type_enumeration_signed_add_mapping(
+ struct bt_field_type *ft, const char *string,
int64_t range_start, int64_t range_end)
{
int ret = 0;
GQuark mapping_name;
struct enumeration_mapping *mapping;
- struct bt_field_type_common_enumeration *enum_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_enumeration *enum_ft = (void *) ft;
char *escaped_string;
if (!ft) {
return ret;
}
-int bt_field_type_enumeration_signed_add_mapping(
+int bt_field_type_enumeration_unsigned_add_mapping(
struct bt_field_type *ft, const char *string,
- int64_t range_start, int64_t range_end)
-{
- return bt_field_type_common_enumeration_signed_add_mapping(
- (void *) ft, string, range_start, range_end);
-}
-
-BT_HIDDEN
-int bt_field_type_common_enumeration_unsigned_add_mapping(
- struct bt_field_type_common *ft, const char *string,
uint64_t range_start, uint64_t range_end)
{
int ret = 0;
GQuark mapping_name;
struct enumeration_mapping *mapping;
- struct bt_field_type_common_enumeration *enum_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_enumeration *enum_ft = (void *) ft;
char *escaped_string;
if (!ft) {
return ret;
}
-int bt_field_type_enumeration_unsigned_add_mapping(
- struct bt_field_type *ft, const char *string,
- uint64_t range_start, uint64_t range_end)
-{
- return bt_field_type_common_enumeration_unsigned_add_mapping(
- (void *) ft, string, range_start, range_end);
-}
-
-BT_HIDDEN
-int64_t bt_field_type_common_enumeration_get_mapping_count(
- struct bt_field_type_common *ft)
+int64_t bt_field_type_enumeration_get_mapping_count(
+ struct bt_field_type *ft)
{
- struct bt_field_type_common_enumeration *enum_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_enumeration *enum_ft = (void *) ft;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_ENUM, "Field type");
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_ENUM, "Field type");
return (int64_t) enum_ft->entries->len;
}
-int64_t bt_field_type_enumeration_get_mapping_count(
- struct bt_field_type *ft)
-{
- return bt_field_type_common_enumeration_get_mapping_count((void *) ft);
-}
-
struct bt_field_type *bt_field_type_floating_point_create(void)
{
- struct bt_field_type_common_floating_point *floating_point =
- g_new0(struct bt_field_type_common_floating_point, 1);
+ struct bt_field_type_floating_point *floating_point =
+ g_new0(struct bt_field_type_floating_point, 1);
BT_LOGD_STR("Creating floating point number field type object.");
goto end;
}
- bt_field_type_common_floating_point_initialize(
- BT_TO_COMMON(floating_point),
- bt_field_type_common_floating_point_destroy,
+ bt_field_type_floating_point_initialize(
+ (void *) floating_point,
+ bt_field_type_floating_point_destroy,
&bt_field_type_floating_point_methods);
BT_LOGD("Created floating point number field type object: addr=%p, "
"exp-size=%u, mant-size=%u", floating_point,
return (void *) floating_point;
}
-BT_HIDDEN
-int bt_field_type_common_floating_point_get_exponent_digits(
- struct bt_field_type_common *ft)
+int bt_field_type_floating_point_get_exponent_digits(
+ struct bt_field_type *ft)
{
- struct bt_field_type_common_floating_point *flt_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_floating_point *flt_ft = (void *) ft;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_FLOAT,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_FLOAT,
"Field type");
return (int) flt_ft->exp_dig;
}
-int bt_field_type_floating_point_get_exponent_digits(
- struct bt_field_type *ft)
-{
- return bt_field_type_common_floating_point_get_exponent_digits(
- (void *) ft);
-}
-
-BT_HIDDEN
-int bt_field_type_common_floating_point_set_exponent_digits(
- struct bt_field_type_common *ft,
- unsigned int exponent_digits)
+int bt_field_type_floating_point_set_exponent_digits(
+ struct bt_field_type *ft, unsigned int exponent_digits)
{
int ret = 0;
- struct bt_field_type_common_floating_point *flt_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_floating_point *flt_ft = (void *) ft;
if (!ft) {
BT_LOGW_STR("Invalid parameter: field type is NULL.");
return ret;
}
-int bt_field_type_floating_point_set_exponent_digits(
- struct bt_field_type *ft, unsigned int exponent_digits)
-{
- return bt_field_type_common_floating_point_set_exponent_digits(
- (void *) ft, exponent_digits);
-}
-
-BT_HIDDEN
-int bt_field_type_common_floating_point_get_mantissa_digits(
- struct bt_field_type_common *ft)
+int bt_field_type_floating_point_get_mantissa_digits(
+ struct bt_field_type *ft)
{
- struct bt_field_type_common_floating_point *flt_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_floating_point *flt_ft = (void *) ft;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_FLOAT,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_FLOAT,
"Field type");
return (int) flt_ft->mant_dig;
}
-int bt_field_type_floating_point_get_mantissa_digits(
- struct bt_field_type *ft)
-{
- return bt_field_type_common_floating_point_get_mantissa_digits(
- (void *) ft);
-}
-
-BT_HIDDEN
-int bt_field_type_common_floating_point_set_mantissa_digits(
- struct bt_field_type_common *ft, unsigned int mantissa_digits)
+int bt_field_type_floating_point_set_mantissa_digits(
+ struct bt_field_type *ft, unsigned int mantissa_digits)
{
int ret = 0;
- struct bt_field_type_common_floating_point *flt_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_floating_point *flt_ft = (void *) ft;
if (!ft) {
BT_LOGW_STR("Invalid parameter: field type is NULL.");
return ret;
}
-int bt_field_type_floating_point_set_mantissa_digits(
- struct bt_field_type *ft, unsigned int mantissa_digits)
-{
- return bt_field_type_common_floating_point_set_mantissa_digits(
- (void *) ft, mantissa_digits);
-}
-
struct bt_field_type *bt_field_type_structure_create(void)
{
- struct bt_field_type_common_structure *structure =
- g_new0(struct bt_field_type_common_structure, 1);
+ struct bt_field_type_structure *structure =
+ g_new0(struct bt_field_type_structure, 1);
BT_LOGD_STR("Creating structure field type object.");
goto error;
}
- bt_field_type_common_structure_initialize(BT_TO_COMMON(structure),
- bt_field_type_common_structure_destroy_recursive,
+ bt_field_type_structure_initialize((void *) structure,
+ bt_field_type_structure_destroy_recursive,
&bt_field_type_structure_methods);
BT_LOGD("Created structure field type object: addr=%p",
structure);
return (void *) structure;
}
-BT_HIDDEN
-int bt_field_type_common_structure_replace_field(
- struct bt_field_type_common *ft,
- const char *field_name,
- struct bt_field_type_common *field_type)
-{
- int ret = 0;
- struct bt_field_type_common_structure *struct_ft = BT_FROM_COMMON(ft);
- GQuark name_quark;
- uint64_t i;
-
- BT_ASSERT(ft);
- BT_ASSERT(field_name);
- BT_ASSERT(field_type);
- BT_ASSERT(ft->id == BT_FIELD_TYPE_ID_STRUCT);
- name_quark = g_quark_from_string(field_name);
-
- for (i = 0; i < struct_ft->fields->len; i++) {
- struct bt_field_type_common_structure_field *field =
- BT_FIELD_TYPE_COMMON_STRUCTURE_FIELD_AT_INDEX(ft, i);
-
- if (field->name == name_quark) {
- bt_put(field->type);
- field->type = bt_get(field_type);
- }
- }
-
- return ret;
-}
-
-BT_HIDDEN
-int bt_field_type_common_structure_add_field(struct bt_field_type_common *ft,
- struct bt_field_type_common *field_type,
+int bt_field_type_structure_add_field(struct bt_field_type *ft,
+ struct bt_field_type *field_type,
const char *field_name)
{
int ret = 0;
- struct bt_field_type_common_structure *struct_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_structure *struct_ft = (void *) ft;
/*
* TODO: check that `field_type` does not contain `type`,
return ret;
}
-int bt_field_type_structure_add_field(struct bt_field_type *ft,
- struct bt_field_type *field_type,
- const char *field_name)
-{
- return bt_field_type_common_structure_add_field((void *) ft,
- (void *) field_type, field_name);
-}
-
-BT_HIDDEN
-int64_t bt_field_type_common_structure_get_field_count(
- struct bt_field_type_common *ft)
+int64_t bt_field_type_structure_get_field_count(struct bt_field_type *ft)
{
- struct bt_field_type_common_structure *struct_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_structure *struct_ft = (void *) ft;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_STRUCT,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_STRUCT,
"Field type");
return (int64_t) struct_ft->fields->len;
}
-int64_t bt_field_type_structure_get_field_count(struct bt_field_type *ft)
-{
- return bt_field_type_common_structure_get_field_count((void *) ft);
-}
-
-BT_HIDDEN
-int bt_field_type_common_structure_borrow_field_by_index(
- struct bt_field_type_common *ft,
+int bt_field_type_structure_borrow_field_by_index(
+ struct bt_field_type *ft,
const char **field_name,
- struct bt_field_type_common **field_type, uint64_t index)
+ struct bt_field_type **field_type, uint64_t index)
{
- struct bt_field_type_common_structure *struct_ft = BT_FROM_COMMON(ft);
- struct bt_field_type_common_structure_field *field;
+ struct bt_field_type_structure *struct_ft = (void *) ft;
+ struct bt_field_type_structure_field *field;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_STRUCT,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_STRUCT,
"Field type");
BT_ASSERT_PRE(index < struct_ft->fields->len,
"Index is out of bounds: index=%" PRIu64 ", "
- "count=%u, %![ft-]+_F",
+ "count=%u, %![ft-]+F",
index, struct_ft->fields->len, ft);
- field = BT_FIELD_TYPE_COMMON_STRUCTURE_FIELD_AT_INDEX(struct_ft, index);
+ field = BT_FIELD_TYPE_STRUCTURE_FIELD_AT_INDEX(struct_ft, index);
if (field_type) {
*field_type = field->type;
return 0;
}
-int bt_field_type_structure_borrow_field_by_index(
- struct bt_field_type *ft,
- const char **field_name,
- struct bt_field_type **field_type, uint64_t index)
-{
- return bt_field_type_common_structure_borrow_field_by_index(
- (void *) ft, field_name, (void *) field_type, index);
-}
-
-BT_HIDDEN
-struct bt_field_type_common *
-bt_field_type_common_structure_borrow_field_type_by_name(
- struct bt_field_type_common *ft, const char *name)
+struct bt_field_type *bt_field_type_structure_borrow_field_type_by_name(
+ struct bt_field_type *ft, const char *name)
{
size_t index;
GQuark name_quark;
- struct bt_field_type_common_structure_field *field;
- struct bt_field_type_common_structure *struct_ft = BT_FROM_COMMON(ft);
- struct bt_field_type_common *field_type = NULL;
+ struct bt_field_type_structure_field *field;
+ struct bt_field_type_structure *struct_ft = (void *) ft;
+ struct bt_field_type *field_type = NULL;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
BT_ASSERT_PRE_NON_NULL(name, "Name");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_STRUCT,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_STRUCT,
"Field type");
name_quark = g_quark_try_string(name);
if (!name_quark) {
goto end;
}
- field = BT_FIELD_TYPE_COMMON_STRUCTURE_FIELD_AT_INDEX(ft, index);
+ field = BT_FIELD_TYPE_STRUCTURE_FIELD_AT_INDEX(ft, index);
field_type = field->type;
end:
return field_type;
}
-struct bt_field_type *bt_field_type_structure_borrow_field_type_by_name(
- struct bt_field_type *ft, const char *name)
-{
- return (void *) bt_field_type_common_structure_borrow_field_type_by_name(
- (void *) ft, name);
-}
-
struct bt_field_type *bt_field_type_variant_create(
struct bt_field_type *tag_ft, const char *tag_name)
{
- struct bt_field_type_common_variant *var_ft = NULL;
+ struct bt_field_type_variant *var_ft = NULL;
BT_LOGD("Creating variant field type object: "
"tag-ft-addr=%p, tag-field-name=\"%s\"",
goto error;
}
- var_ft = g_new0(struct bt_field_type_common_variant, 1);
+ var_ft = g_new0(struct bt_field_type_variant, 1);
if (!var_ft) {
BT_LOGE_STR("Failed to allocate one variant field type.");
goto error;
}
- bt_field_type_common_variant_initialize(BT_TO_COMMON(var_ft),
+ bt_field_type_variant_initialize((void *) var_ft,
(void *) tag_ft, tag_name,
- bt_field_type_common_variant_destroy_recursive,
+ bt_field_type_variant_destroy_recursive,
&bt_field_type_variant_methods);
BT_LOGD("Created variant field type object: addr=%p, "
"tag-ft-addr=%p, tag-field-name=\"%s\"",
return (void *) var_ft;
}
-BT_HIDDEN
-struct bt_field_type_common *
-bt_field_type_common_variant_borrow_tag_field_type(
- struct bt_field_type_common *ft)
+struct bt_field_type *bt_field_type_variant_borrow_tag_field_type(
+ struct bt_field_type *ft)
{
- struct bt_field_type_common_variant *var_ft = BT_FROM_COMMON(ft);
- struct bt_field_type_common *tag_ft = NULL;
+ struct bt_field_type_variant *var_ft = (void *) ft;
+ struct bt_field_type *tag_ft = NULL;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_VARIANT,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_VARIANT,
"Field type");
if (!var_ft->tag_ft) {
goto end;
}
- tag_ft = BT_TO_COMMON(var_ft->tag_ft);
+ tag_ft = (void *) var_ft->tag_ft;
end:
return tag_ft;
}
-struct bt_field_type *bt_field_type_variant_borrow_tag_field_type(
- struct bt_field_type *ft)
-{
- return (void *) bt_field_type_common_variant_borrow_tag_field_type(
- (void *) ft);
-}
-
-BT_HIDDEN
-const char *bt_field_type_common_variant_get_tag_name(
- struct bt_field_type_common *ft)
+const char *bt_field_type_variant_get_tag_name(struct bt_field_type *ft)
{
- struct bt_field_type_common_variant *var_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_variant *var_ft = (void *) ft;
const char *tag_name = NULL;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_VARIANT,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_VARIANT,
"Field type");
if (var_ft->tag_name->len == 0) {
return tag_name;
}
-const char *bt_field_type_variant_get_tag_name(struct bt_field_type *ft)
-{
- return bt_field_type_common_variant_get_tag_name((void *) ft);
-}
-
-BT_HIDDEN
-int bt_field_type_common_variant_set_tag_name(
- struct bt_field_type_common *ft, const char *name)
+int bt_field_type_variant_set_tag_name(
+ struct bt_field_type *ft, const char *name)
{
int ret = 0;
- struct bt_field_type_common_variant *var_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_variant *var_ft = (void *) ft;
if (!ft) {
BT_LOGW_STR("Invalid parameter: field type is NULL.");
return ret;
}
-int bt_field_type_variant_set_tag_name(
- struct bt_field_type *ft, const char *name)
-{
- return bt_field_type_common_variant_set_tag_name((void *) ft, name);
-}
-
-BT_HIDDEN
-int bt_field_type_common_variant_add_field(struct bt_field_type_common *ft,
- struct bt_field_type_common *field_type,
+int bt_field_type_variant_add_field(struct bt_field_type *ft,
+ struct bt_field_type *field_type,
const char *field_name)
{
size_t i;
int ret = 0;
- struct bt_field_type_common_variant *var_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_variant *var_ft = (void *) ft;
GQuark field_name_quark = g_quark_from_string(field_name);
/*
return ret;
}
-int bt_field_type_variant_add_field(struct bt_field_type *ft,
- struct bt_field_type *field_type,
- const char *field_name)
-{
- return bt_field_type_common_variant_add_field((void *) ft,
- (void *) field_type, field_name);
-}
-
-BT_HIDDEN
-struct bt_field_type_common *
-bt_field_type_common_variant_borrow_field_type_by_name(
- struct bt_field_type_common *ft,
+struct bt_field_type *bt_field_type_variant_borrow_field_type_by_name(
+ struct bt_field_type *ft,
const char *field_name)
{
size_t index;
GQuark name_quark;
- struct bt_field_type_common_variant_choice *choice;
- struct bt_field_type_common_variant *var_ft = BT_FROM_COMMON(ft);
- struct bt_field_type_common *field_type = NULL;
+ struct bt_field_type_variant_choice *choice;
+ struct bt_field_type_variant *var_ft = (void *) ft;
+ struct bt_field_type *field_type = NULL;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
BT_ASSERT_PRE_NON_NULL(field_name, "Name");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_VARIANT,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_VARIANT,
"Field type");
name_quark = g_quark_try_string(field_name);
if (!name_quark) {
goto end;
}
- choice = BT_FIELD_TYPE_COMMON_VARIANT_CHOICE_AT_INDEX(ft, index);
+ choice = BT_FIELD_TYPE_VARIANT_CHOICE_AT_INDEX(ft, index);
field_type = choice->type;
end:
return field_type;
}
-struct bt_field_type *bt_field_type_variant_borrow_field_type_by_name(
- struct bt_field_type *ft,
- const char *field_name)
-{
- return (void *) bt_field_type_common_variant_borrow_field_type_by_name(
- (void *) ft, field_name);
-}
-
-BT_HIDDEN
-int64_t bt_field_type_common_variant_get_field_count(
- struct bt_field_type_common *ft)
+int64_t bt_field_type_variant_get_field_count(struct bt_field_type *ft)
{
- struct bt_field_type_common_variant *var_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_variant *var_ft = (void *) ft;
BT_ASSERT_PRE_NON_NULL(ft, "Variant field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_VARIANT,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_VARIANT,
"Field type");
return (int64_t) var_ft->choices->len;
}
-int64_t bt_field_type_variant_get_field_count(struct bt_field_type *ft)
-{
- return bt_field_type_common_variant_get_field_count((void *) ft);
-}
-
-BT_HIDDEN
-int bt_field_type_common_variant_borrow_field_by_index(
- struct bt_field_type_common *ft,
- const char **field_name,
- struct bt_field_type_common **field_type, uint64_t index)
+int bt_field_type_variant_borrow_field_by_index(struct bt_field_type *ft,
+ const char **field_name, struct bt_field_type **field_type,
+ uint64_t index)
{
- struct bt_field_type_common_variant *var_ft = BT_FROM_COMMON(ft);
- struct bt_field_type_common_variant_choice *choice;
+ struct bt_field_type_variant *var_ft = (void *) ft;
+ struct bt_field_type_variant_choice *choice;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_VARIANT,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_VARIANT,
"Field type");
BT_ASSERT_PRE(index < var_ft->choices->len,
"Index is out of bounds: index=%" PRIu64 ", "
- "count=%u, %![ft-]+_F",
+ "count=%u, %![ft-]+F",
index, var_ft->choices->len, ft);
- choice = BT_FIELD_TYPE_COMMON_VARIANT_CHOICE_AT_INDEX(ft, index);
+ choice = BT_FIELD_TYPE_VARIANT_CHOICE_AT_INDEX(ft, index);
if (field_type) {
*field_type = choice->type;
return 0;
}
-int bt_field_type_variant_borrow_field_by_index(struct bt_field_type *ft,
- const char **field_name, struct bt_field_type **field_type,
- uint64_t index)
-{
- return bt_field_type_common_variant_borrow_field_by_index((void *) ft,
- field_name, (void *) field_type, index);
-}
-
BT_HIDDEN
-int64_t bt_field_type_common_variant_find_choice_index(
- struct bt_field_type_common *ft, uint64_t uval,
+int64_t bt_field_type_variant_find_choice_index(
+ struct bt_field_type *ft, uint64_t uval,
bool is_signed)
{
int64_t ret;
uint64_t i;
- struct bt_field_type_common_variant *var_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_variant *var_ft = (void *) ft;
BT_ASSERT(ft);
BT_ASSERT(ft->id == BT_FIELD_TYPE_ID_VARIANT);
- if (bt_field_type_common_variant_update_choices(ft)) {
+ if (bt_field_type_variant_update_choices(ft)) {
ret = INT64_C(-1);
goto end;
}
for (i = 0; i < var_ft->choices->len; i++) {
uint64_t range_i;
- struct bt_field_type_common_variant_choice *choice =
- BT_FIELD_TYPE_COMMON_VARIANT_CHOICE_AT_INDEX(
+ struct bt_field_type_variant_choice *choice =
+ BT_FIELD_TYPE_VARIANT_CHOICE_AT_INDEX(
var_ft, i);
for (range_i = 0; range_i < choice->ranges->len; range_i++) {
- struct bt_field_type_common_variant_choice_range *range =
+ struct bt_field_type_variant_choice_range *range =
&g_array_index(
choice->ranges,
- struct bt_field_type_common_variant_choice_range,
+ struct bt_field_type_variant_choice_range,
range_i);
if (is_signed) {
struct bt_field_type *bt_field_type_array_create(
struct bt_field_type *element_ft, unsigned int length)
{
- struct bt_field_type_common_array *array = NULL;
+ struct bt_field_type_array *array = NULL;
BT_LOGD("Creating array field type object: element-ft-addr=%p, "
"length=%u", element_ft, length);
goto error;
}
- array = g_new0(struct bt_field_type_common_array, 1);
+ array = g_new0(struct bt_field_type_array, 1);
if (!array) {
BT_LOGE_STR("Failed to allocate one array field type.");
goto error;
}
- bt_field_type_common_array_initialize(BT_TO_COMMON(array),
+ bt_field_type_array_initialize((void *) array,
(void *) element_ft, length,
- bt_field_type_common_array_destroy_recursive,
+ bt_field_type_array_destroy_recursive,
&bt_field_type_array_methods);
BT_LOGD("Created array field type object: addr=%p, "
"element-ft-addr=%p, length=%u",
return (void *) array;
}
-BT_HIDDEN
-struct bt_field_type_common *
-bt_field_type_common_array_borrow_element_field_type(
- struct bt_field_type_common *ft)
+struct bt_field_type *bt_field_type_array_borrow_element_field_type(
+ struct bt_field_type *ft)
{
- struct bt_field_type_common_array *array_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_array *array_ft = (void *) ft;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_ARRAY,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_ARRAY,
"Field type");
BT_ASSERT(array_ft && array_ft->element_ft);
return array_ft->element_ft;
}
-struct bt_field_type *bt_field_type_array_borrow_element_field_type(
- struct bt_field_type *ft)
-{
- return (void *) bt_field_type_common_array_borrow_element_field_type(
- (void *) ft);
-}
-
-BT_HIDDEN
-int bt_field_type_common_array_set_element_field_type(
- struct bt_field_type_common *ft,
- struct bt_field_type_common *element_ft)
-{
- int ret = 0;
- struct bt_field_type_common_array *array_ft = BT_FROM_COMMON(ft);
-
- if (!ft) {
- BT_LOGW_STR("Invalid parameter: array field type is NULL.");
- ret = -1;
- goto end;
- }
-
- if (!element_ft) {
- BT_LOGW_STR("Invalid parameter: element field type is NULL.");
- ret = -1;
- goto end;
- }
-
- if (ft->id != BT_FIELD_TYPE_ID_ARRAY) {
- BT_LOGW("Invalid parameter: field type is not an array field type: "
- "addr=%p, ft-id=%s", ft,
- bt_common_field_type_id_string(ft->id));
- ret = -1;
- goto end;
- }
-
- if (array_ft->element_ft) {
- BT_PUT(array_ft->element_ft);
- }
-
- array_ft->element_ft = bt_get(element_ft);
- BT_LOGV("Set array field type's element field type: array-ft-addr=%p, "
- "element-ft-addr=%p", ft, element_ft);
-
-end:
- return ret;
-}
-
-BT_HIDDEN
-int64_t bt_field_type_common_array_get_length(struct bt_field_type_common *ft)
+int64_t bt_field_type_array_get_length(struct bt_field_type *ft)
{
- struct bt_field_type_common_array *array_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_array *array_ft = (void *) ft;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_ARRAY,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_ARRAY,
"Field type");
return (int64_t) array_ft->length;
}
-int64_t bt_field_type_array_get_length(struct bt_field_type *ft)
-{
- return bt_field_type_common_array_get_length((void *) ft);
-}
-
struct bt_field_type *bt_field_type_sequence_create(
struct bt_field_type *element_ft,
const char *length_field_name)
{
- struct bt_field_type_common_sequence *sequence = NULL;
+ struct bt_field_type_sequence *sequence = NULL;
BT_LOGD("Creating sequence field type object: element-ft-addr=%p, "
"length-field-name=\"%s\"", element_ft, length_field_name);
goto error;
}
- sequence = g_new0(struct bt_field_type_common_sequence, 1);
+ sequence = g_new0(struct bt_field_type_sequence, 1);
if (!sequence) {
BT_LOGE_STR("Failed to allocate one sequence field type.");
goto error;
}
- bt_field_type_common_sequence_initialize(BT_TO_COMMON(sequence),
+ bt_field_type_sequence_initialize((void *) sequence,
(void *) element_ft, length_field_name,
- bt_field_type_common_sequence_destroy_recursive,
+ bt_field_type_sequence_destroy_recursive,
&bt_field_type_sequence_methods);
BT_LOGD("Created sequence field type object: addr=%p, "
"element-ft-addr=%p, length-field-name=\"%s\"",
return (void *) sequence;
}
-BT_HIDDEN
-struct bt_field_type_common *bt_field_type_common_sequence_borrow_element_field_type(
- struct bt_field_type_common *ft)
+struct bt_field_type *bt_field_type_sequence_borrow_element_field_type(
+ struct bt_field_type *ft)
{
- struct bt_field_type_common_sequence *seq_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_sequence *seq_ft = (void *) ft;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_SEQUENCE,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_SEQUENCE,
"Field type");
return seq_ft->element_ft;
}
-struct bt_field_type *bt_field_type_sequence_borrow_element_field_type(
+const char *bt_field_type_sequence_get_length_field_name(
struct bt_field_type *ft)
{
- return (void *) bt_field_type_common_sequence_borrow_element_field_type(
- (void *) ft);
-}
-
-BT_HIDDEN
-int bt_field_type_common_sequence_set_element_field_type(
- struct bt_field_type_common *ft,
- struct bt_field_type_common *element_ft)
-{
- int ret = 0;
- struct bt_field_type_common_sequence *seq_ft = BT_FROM_COMMON(ft);
-
- if (!ft) {
- BT_LOGW_STR("Invalid parameter: sequence field type is NULL.");
- ret = -1;
- goto end;
- }
-
- if (!element_ft) {
- BT_LOGW_STR("Invalid parameter: element field type is NULL.");
- ret = -1;
- goto end;
- }
-
- if (ft->id != BT_FIELD_TYPE_ID_SEQUENCE) {
- BT_LOGW("Invalid parameter: field type is not a sequence field type: "
- "addr=%p, ft-id=%s", ft,
- bt_common_field_type_id_string(ft->id));
- ret = -1;
- goto end;
- }
-
- if (seq_ft->element_ft) {
- BT_PUT(seq_ft->element_ft);
- }
-
- seq_ft->element_ft = element_ft;
- bt_get(seq_ft->element_ft);
- BT_LOGV("Set sequence field type's element field type: sequence-ft-addr=%p, "
- "element-ft-addr=%p", ft, element_ft);
-
-end:
- return ret;
-}
-
-BT_HIDDEN
-const char *bt_field_type_common_sequence_get_length_field_name(
- struct bt_field_type_common *ft)
-{
- struct bt_field_type_common_sequence *seq_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_sequence *seq_ft = (void *) ft;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_SEQUENCE,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_SEQUENCE,
"Field type");
return seq_ft->length_field_name ?
seq_ft->length_field_name->str : NULL;
}
-const char *bt_field_type_sequence_get_length_field_name(
- struct bt_field_type *ft)
-{
- return bt_field_type_common_sequence_get_length_field_name((void *) ft);
-}
-
struct bt_field_type *bt_field_type_string_create(void)
{
- struct bt_field_type_common_string *string =
- g_new0(struct bt_field_type_common_string, 1);
+ struct bt_field_type_string *string =
+ g_new0(struct bt_field_type_string, 1);
BT_LOGD_STR("Creating string field type object.");
return NULL;
}
- bt_field_type_common_string_initialize(BT_TO_COMMON(string),
- bt_field_type_common_string_destroy,
+ bt_field_type_string_initialize((void *) string,
+ bt_field_type_string_destroy,
&bt_field_type_string_methods);
BT_LOGD("Created string field type object: addr=%p", string);
return (void *) string;
}
-BT_HIDDEN
-enum bt_string_encoding bt_field_type_common_string_get_encoding(
- struct bt_field_type_common *ft)
+enum bt_string_encoding bt_field_type_string_get_encoding(
+ struct bt_field_type *ft)
{
- struct bt_field_type_common_string *string_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_string *string_ft = (void *) ft;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_STRING,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_STRING,
"Field type");
return string_ft->encoding;
}
-enum bt_string_encoding bt_field_type_string_get_encoding(
- struct bt_field_type *ft)
-{
- return bt_field_type_common_string_get_encoding((void *) ft);
-}
-
-BT_HIDDEN
-int bt_field_type_common_string_set_encoding(struct bt_field_type_common *ft,
+int bt_field_type_string_set_encoding(struct bt_field_type *ft,
enum bt_string_encoding encoding)
{
int ret = 0;
- struct bt_field_type_common_string *string_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_string *string_ft = (void *) ft;
if (!ft) {
BT_LOGW_STR("Invalid parameter: field type is NULL.");
return ret;
}
-int bt_field_type_string_set_encoding(struct bt_field_type *ft,
- enum bt_string_encoding encoding)
-{
- return bt_field_type_common_string_set_encoding((void *) ft, encoding);
-}
-
-BT_HIDDEN
-int bt_field_type_common_get_alignment(struct bt_field_type_common *ft)
+int bt_field_type_get_alignment(struct bt_field_type *ft)
{
int ret;
enum bt_field_type_id type_id;
goto end;
}
- type_id = bt_field_type_common_get_type_id(ft);
+ type_id = bt_field_type_get_type_id(ft);
switch (type_id) {
case BT_FIELD_TYPE_ID_SEQUENCE:
{
- struct bt_field_type_common *element_ft =
- bt_field_type_common_sequence_borrow_element_field_type(ft);
+ struct bt_field_type *element_ft =
+ bt_field_type_sequence_borrow_element_field_type(ft);
BT_ASSERT(element_ft);
- ret = bt_field_type_common_get_alignment(element_ft);
+ ret = bt_field_type_get_alignment(element_ft);
break;
}
case BT_FIELD_TYPE_ID_ARRAY:
{
- struct bt_field_type_common *element_ft =
- bt_field_type_common_array_borrow_element_field_type(ft);
+ struct bt_field_type *element_ft =
+ bt_field_type_array_borrow_element_field_type(ft);
BT_ASSERT(element_ft);
- ret = bt_field_type_common_get_alignment(element_ft);
+ ret = bt_field_type_get_alignment(element_ft);
break;
}
case BT_FIELD_TYPE_ID_STRUCT:
{
int64_t i, element_count;
- element_count = bt_field_type_common_structure_get_field_count(
+ element_count = bt_field_type_structure_get_field_count(
ft);
BT_ASSERT(element_count >= 0);
for (i = 0; i < element_count; i++) {
- struct bt_field_type_common *field = NULL;
+ struct bt_field_type *field = NULL;
int field_alignment;
- ret = bt_field_type_common_structure_borrow_field_by_index(
+ ret = bt_field_type_structure_borrow_field_by_index(
ft, NULL, &field, i);
BT_ASSERT(ret == 0);
BT_ASSERT(field);
- field_alignment = bt_field_type_common_get_alignment(
+ field_alignment = bt_field_type_get_alignment(
field);
if (field_alignment < 0) {
ret = field_alignment;
return ret;
}
-int bt_field_type_get_alignment(struct bt_field_type *ft)
-{
- return bt_field_type_common_get_alignment((void *) ft);
-}
-
static inline
int is_power_of_two(unsigned int value)
{
return ((value & (value - 1)) == 0) && value > 0;
}
-BT_HIDDEN
-int bt_field_type_common_set_alignment(struct bt_field_type_common *ft,
+int bt_field_type_set_alignment(struct bt_field_type *ft,
unsigned int alignment)
{
int ret = 0;
goto end;
}
- type_id = bt_field_type_common_get_type_id(ft);
+ type_id = bt_field_type_get_type_id(ft);
if (type_id == BT_FIELD_TYPE_ID_UNKNOWN) {
BT_LOGW("Invalid parameter: unknown field type ID: "
"addr=%p, ft-id=%d", ft, type_id);
return ret;
}
-int bt_field_type_set_alignment(struct bt_field_type *ft,
- unsigned int alignment)
-{
- return bt_field_type_common_set_alignment((void *) ft, alignment);
-}
-
-BT_HIDDEN
-enum bt_byte_order bt_field_type_common_get_byte_order(
- struct bt_field_type_common *ft)
+enum bt_byte_order bt_field_type_get_byte_order(struct bt_field_type *ft)
{
enum bt_byte_order ret = BT_BYTE_ORDER_UNKNOWN;
switch (ft->id) {
case BT_FIELD_TYPE_ID_INTEGER:
{
- struct bt_field_type_common_integer *integer =
- BT_FROM_COMMON(ft);
+ struct bt_field_type_integer *integer = (void *) ft;
ret = integer->user_byte_order;
break;
}
case BT_FIELD_TYPE_ID_ENUM:
{
- struct bt_field_type_common_enumeration *enum_ft =
- BT_FROM_COMMON(ft);
+ struct bt_field_type_enumeration *enum_ft = (void *) ft;
- ret = bt_field_type_common_get_byte_order(
- BT_TO_COMMON(enum_ft->container_ft));
+ ret = bt_field_type_get_byte_order(
+ (void *) enum_ft->container_ft);
break;
}
case BT_FIELD_TYPE_ID_FLOAT:
{
- struct bt_field_type_common_floating_point *floating_point =
- BT_FROM_COMMON(ft);
+ struct bt_field_type_floating_point *floating_point = (void *) ft;
ret = floating_point->user_byte_order;
break;
}
return ret;
}
-enum bt_byte_order bt_field_type_get_byte_order(struct bt_field_type *ft)
-{
- return bt_field_type_common_get_byte_order((void *) ft);
-}
-
-BT_HIDDEN
-int bt_field_type_common_set_byte_order(struct bt_field_type_common *ft,
+int bt_field_type_set_byte_order(struct bt_field_type *ft,
enum bt_byte_order byte_order)
{
int ret = 0;
return ret;
}
-int bt_field_type_set_byte_order(struct bt_field_type *ft,
- enum bt_byte_order byte_order)
-{
- return bt_field_type_common_set_byte_order((void *) ft, byte_order);
-}
-
-BT_HIDDEN
-enum bt_field_type_id bt_field_type_common_get_type_id(
- struct bt_field_type_common *ft)
+enum bt_field_type_id bt_field_type_get_type_id(struct bt_field_type *ft)
{
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
return ft->id;
}
-enum bt_field_type_id bt_field_type_get_type_id(struct bt_field_type *ft)
-{
- return bt_field_type_common_get_type_id((void *) ft);
-}
-
-int bt_field_type_is_integer(struct bt_field_type *type)
-{
- return bt_field_type_get_type_id(type) == BT_FIELD_TYPE_ID_INTEGER;
-}
-
-int bt_field_type_is_floating_point(struct bt_field_type *type)
-{
- return bt_field_type_get_type_id(type) == BT_FIELD_TYPE_ID_FLOAT;
-}
-
-int bt_field_type_is_enumeration(struct bt_field_type *type)
-{
- return bt_field_type_get_type_id(type) == BT_FIELD_TYPE_ID_ENUM;
-}
-
-int bt_field_type_is_string(struct bt_field_type *type)
-{
- return bt_field_type_get_type_id(type) == BT_FIELD_TYPE_ID_STRING;
-}
-
-int bt_field_type_is_structure(struct bt_field_type *type)
-{
- return bt_field_type_get_type_id(type) == BT_FIELD_TYPE_ID_STRUCT;
-}
-
-int bt_field_type_is_array(struct bt_field_type *type)
-{
- return bt_field_type_get_type_id(type) == BT_FIELD_TYPE_ID_ARRAY;
-}
-
-int bt_field_type_is_sequence(struct bt_field_type *type)
-{
- return bt_field_type_get_type_id(type) == BT_FIELD_TYPE_ID_SEQUENCE;
-}
-
-int bt_field_type_is_variant(struct bt_field_type *type)
-{
- return bt_field_type_get_type_id(type) == BT_FIELD_TYPE_ID_VARIANT;
-}
-
BT_HIDDEN
-void bt_field_type_common_freeze(struct bt_field_type_common *ft)
+void bt_field_type_freeze(struct bt_field_type *ft)
{
if (!ft || ft->frozen) {
return;
ft->methods->freeze(ft);
}
-BT_HIDDEN
-void bt_field_type_freeze(struct bt_field_type *ft)
-{
- bt_field_type_common_freeze((void *) ft);
-}
-
-BT_HIDDEN
-struct bt_field_type_common *
-bt_field_type_common_variant_borrow_field_type_signed(
- struct bt_field_type_common_variant *var_ft,
- int64_t tag_value)
-{
- struct bt_field_type_common *field_type = NULL;
- GQuark field_name_quark;
- gpointer index;
- struct bt_field_type_common_variant_choice *choice;
- struct range_overlap_query query = {
- .range_start._signed = tag_value,
- .range_end._signed = tag_value,
- .mapping_name = 0,
- .overlaps = 0,
- };
-
- g_ptr_array_foreach(var_ft->tag_ft->entries, check_ranges_overlap,
- &query);
- if (!query.overlaps) {
- goto end;
- }
-
- field_name_quark = query.mapping_name;
- if (!g_hash_table_lookup_extended(var_ft->choice_name_to_index,
- GUINT_TO_POINTER(field_name_quark), NULL, &index)) {
- goto end;
- }
-
- choice = BT_FIELD_TYPE_COMMON_VARIANT_CHOICE_AT_INDEX(var_ft,
- (size_t) index);
- field_type = choice->type;
-
-end:
- return field_type;
-}
-
-BT_HIDDEN
-struct bt_field_type_common *
-bt_field_type_common_variant_borrow_field_type_unsigned(
- struct bt_field_type_common_variant *var_ft,
- uint64_t tag_value)
-{
- struct bt_field_type_common *field_type = NULL;
- GQuark field_name_quark;
- gpointer index;
- struct bt_field_type_common_variant_choice *choice;
- struct range_overlap_query query = {
- .range_start._unsigned = tag_value,
- .range_end._unsigned = tag_value,
- .mapping_name = 0,
- .overlaps = 0,
- };
-
- g_ptr_array_foreach(var_ft->tag_ft->entries,
- check_ranges_overlap_unsigned, &query);
- if (!query.overlaps) {
- goto end;
- }
-
- field_name_quark = query.mapping_name;
- if (!g_hash_table_lookup_extended(var_ft->choice_name_to_index,
- GUINT_TO_POINTER(field_name_quark), NULL, &index)) {
- goto end;
- }
-
- choice = BT_FIELD_TYPE_COMMON_VARIANT_CHOICE_AT_INDEX(var_ft,
- (size_t) index);
- field_type = choice->type;
-
-end:
- return field_type;
-}
-
-BT_HIDDEN
-struct bt_field_type_common *bt_field_type_common_copy(
- struct bt_field_type_common *ft)
+struct bt_field_type *bt_field_type_copy(struct bt_field_type *ft)
{
- struct bt_field_type_common *ft_copy = NULL;
+ struct bt_field_type *ft_copy = NULL;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
BT_ASSERT(ft->methods->copy);
return ft_copy;
}
-struct bt_field_type *bt_field_type_copy(struct bt_field_type *ft)
-{
- return (void *) bt_field_type_common_copy((void *) ft);
-}
-
-BT_HIDDEN
-int bt_field_type_common_structure_get_field_name_index(
- struct bt_field_type_common *ft, const char *name)
+static inline
+int bt_field_type_structure_get_field_name_index(
+ struct bt_field_type *ft, const char *name)
{
int ret;
size_t index;
GQuark name_quark;
- struct bt_field_type_common_structure *struct_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_structure *struct_ft = (void *) ft;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
BT_ASSERT_PRE_NON_NULL(name, "Name");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_STRUCT,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_STRUCT,
"Field type");
name_quark = g_quark_try_string(name);
return ret;
}
-BT_HIDDEN
-int bt_field_type_common_variant_get_field_name_index(
- struct bt_field_type_common *ft, const char *name)
+static inline
+int bt_field_type_variant_get_field_name_index(
+ struct bt_field_type *ft, const char *name)
{
int ret;
size_t index;
GQuark name_quark;
- struct bt_field_type_common_variant *var_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_variant *var_ft = (void *) ft;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
BT_ASSERT_PRE_NON_NULL(name, "Name");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_VARIANT,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_VARIANT,
"Field type");
name_quark = g_quark_try_string(name);
if (!name_quark) {
}
BT_HIDDEN
-int bt_field_type_common_sequence_set_length_field_path(
- struct bt_field_type_common *ft, struct bt_field_path *path)
+int bt_field_type_sequence_set_length_field_path(
+ struct bt_field_type *ft, struct bt_field_path *path)
{
int ret = 0;
- struct bt_field_type_common_sequence *seq_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_sequence *seq_ft = (void *) ft;
if (!ft) {
BT_LOGW_STR("Invalid parameter: field type is NULL.");
}
BT_HIDDEN
-int bt_field_type_common_variant_set_tag_field_path(
- struct bt_field_type_common *ft,
+int bt_field_type_variant_set_tag_field_path(
+ struct bt_field_type *ft,
struct bt_field_path *path)
{
int ret = 0;
- struct bt_field_type_common_variant *var_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_variant *var_ft = (void *) ft;
if (!ft) {
BT_LOGW_STR("Invalid parameter: field type is NULL.");
}
BT_HIDDEN
-int bt_field_type_common_variant_set_tag_field_type(
- struct bt_field_type_common *ft,
- struct bt_field_type_common *tag_ft)
+int bt_field_type_variant_set_tag_field_type(
+ struct bt_field_type *ft,
+ struct bt_field_type *tag_ft)
{
int ret = 0;
- struct bt_field_type_common_variant *var_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_variant *var_ft = (void *) ft;
if (!ft) {
BT_LOGW_STR("Invalid parameter: variant field type is NULL.");
return ret;
}
-BT_HIDDEN
-void bt_field_type_common_generic_freeze(struct bt_field_type_common *ft)
+static
+void bt_field_type_generic_freeze(struct bt_field_type *ft)
{
ft->frozen = 1;
}
-BT_HIDDEN
-void bt_field_type_common_enumeration_freeze_recursive(
- struct bt_field_type_common *ft)
+static
+void bt_field_type_enumeration_freeze_recursive(
+ struct bt_field_type *ft)
{
- struct bt_field_type_common_enumeration *enum_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_enumeration *enum_ft = (void *) ft;
BT_LOGD("Freezing enumeration field type object: addr=%p", ft);
- bt_field_type_common_enumeration_set_range_overlap(enum_ft);
- bt_field_type_common_generic_freeze(ft);
+ bt_field_type_enumeration_set_range_overlap(enum_ft);
+ bt_field_type_generic_freeze(ft);
BT_LOGD("Freezing enumeration field type object's container field type: int-ft-addr=%p",
enum_ft->container_ft);
- bt_field_type_common_freeze(BT_TO_COMMON(enum_ft->container_ft));
+ bt_field_type_freeze((void *) enum_ft->container_ft);
}
-BT_HIDDEN
-void bt_field_type_common_structure_freeze_recursive(
- struct bt_field_type_common *ft)
+static
+void bt_field_type_structure_freeze_recursive(
+ struct bt_field_type *ft)
{
- struct bt_field_type_common_structure *struct_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_structure *struct_ft = (void *) ft;
uint64_t i;
/* Cache the alignment */
BT_LOGD("Freezing structure field type object: addr=%p", ft);
- ft->alignment = bt_field_type_common_get_alignment(ft);
- bt_field_type_common_generic_freeze(ft);
+ ft->alignment = bt_field_type_get_alignment(ft);
+ bt_field_type_generic_freeze(ft);
for (i = 0; i < struct_ft->fields->len; i++) {
- struct bt_field_type_common_structure_field *field =
- BT_FIELD_TYPE_COMMON_STRUCTURE_FIELD_AT_INDEX(ft, i);
+ struct bt_field_type_structure_field *field =
+ BT_FIELD_TYPE_STRUCTURE_FIELD_AT_INDEX(ft, i);
BT_LOGD("Freezing structure field type field: "
"ft-addr=%p, name=\"%s\"",
field->type, g_quark_to_string(field->name));
- bt_field_type_common_freeze(field->type);
+ bt_field_type_freeze(field->type);
}
}
BT_HIDDEN
-int bt_field_type_common_variant_update_choices(struct bt_field_type_common *ft)
+int bt_field_type_variant_update_choices(struct bt_field_type *ft)
{
- struct bt_field_type_common_variant *var_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_variant *var_ft = (void *) ft;
uint64_t i;
int ret = 0;
bool is_signed;
is_signed = !!var_ft->tag_ft->container_ft->is_signed;
for (i = 0; i < var_ft->choices->len; i++) {
- struct bt_field_type_common_variant_choice *choice =
- BT_FIELD_TYPE_COMMON_VARIANT_CHOICE_AT_INDEX(ft, i);
+ struct bt_field_type_variant_choice *choice =
+ BT_FIELD_TYPE_VARIANT_CHOICE_AT_INDEX(ft, i);
const char *choice_name = g_quark_to_string(choice->name);
struct bt_field_type_enumeration_mapping_iterator *iter =
- bt_field_type_common_enumeration_find_mappings_by_name(
- BT_TO_COMMON(var_ft->tag_ft), choice_name);
+ bt_field_type_enumeration_find_mappings_by_name(
+ (void *) var_ft->tag_ft, choice_name);
if (!iter) {
ret = -1;
g_array_set_size(choice->ranges, 0);
while (bt_field_type_enumeration_mapping_iterator_next(iter) == 0) {
- struct bt_field_type_common_variant_choice_range range;
+ struct bt_field_type_variant_choice_range range;
if (is_signed) {
ret = bt_field_type_enumeration_mapping_iterator_signed_get(
return ret;
}
-BT_HIDDEN
-void bt_field_type_common_variant_freeze_recursive(
- struct bt_field_type_common *ft)
+static
+void bt_field_type_variant_freeze_recursive(
+ struct bt_field_type *ft)
{
- struct bt_field_type_common_variant *var_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_variant *var_ft = (void *) ft;
uint64_t i;
BT_LOGD("Freezing variant field type object: addr=%p", ft);
- bt_field_type_common_generic_freeze(ft);
+ bt_field_type_generic_freeze(ft);
for (i = 0; i < var_ft->choices->len; i++) {
- struct bt_field_type_common_variant_choice *choice =
- BT_FIELD_TYPE_COMMON_VARIANT_CHOICE_AT_INDEX(ft, i);
+ struct bt_field_type_variant_choice *choice =
+ BT_FIELD_TYPE_VARIANT_CHOICE_AT_INDEX(ft, i);
BT_LOGD("Freezing variant field type member: "
"ft-addr=%p, name=\"%s\"",
choice->type, g_quark_to_string(choice->name));
- bt_field_type_common_freeze(choice->type);
+ bt_field_type_freeze(choice->type);
}
}
-BT_HIDDEN
-void bt_field_type_common_array_freeze_recursive(
- struct bt_field_type_common *ft)
+static
+void bt_field_type_array_freeze_recursive(
+ struct bt_field_type *ft)
{
- struct bt_field_type_common_array *array_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_array *array_ft = (void *) ft;
/* Cache the alignment */
BT_LOGD("Freezing array field type object: addr=%p", ft);
- ft->alignment = bt_field_type_common_get_alignment(ft);
- bt_field_type_common_generic_freeze(ft);
+ ft->alignment = bt_field_type_get_alignment(ft);
+ bt_field_type_generic_freeze(ft);
BT_LOGD("Freezing array field type object's element field type: element-ft-addr=%p",
array_ft->element_ft);
- bt_field_type_common_freeze(array_ft->element_ft);
+ bt_field_type_freeze(array_ft->element_ft);
}
-BT_HIDDEN
-void bt_field_type_common_sequence_freeze_recursive(
- struct bt_field_type_common *ft)
+static
+void bt_field_type_sequence_freeze_recursive(
+ struct bt_field_type *ft)
{
- struct bt_field_type_common_sequence *seq_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_sequence *seq_ft = (void *) ft;
/* Cache the alignment */
BT_LOGD("Freezing sequence field type object: addr=%p", ft);
- ft->alignment = bt_field_type_common_get_alignment(ft);
- bt_field_type_common_generic_freeze(ft);
+ ft->alignment = bt_field_type_get_alignment(ft);
+ bt_field_type_generic_freeze(ft);
BT_LOGD("Freezing sequence field type object's element field type: element-ft-addr=%p",
seq_ft->element_ft);
- bt_field_type_common_freeze(seq_ft->element_ft);
+ bt_field_type_freeze(seq_ft->element_ft);
}
-BT_HIDDEN
-void bt_field_type_common_integer_set_byte_order(
- struct bt_field_type_common *ft, enum bt_byte_order byte_order)
+static
+void bt_field_type_integer_set_byte_order(
+ struct bt_field_type *ft, enum bt_byte_order byte_order)
{
- struct bt_field_type_common_integer *int_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_integer *int_ft = (void *) ft;
int_ft->user_byte_order = byte_order;
}
-BT_HIDDEN
-void bt_field_type_common_enumeration_set_byte_order_recursive(
- struct bt_field_type_common *ft, enum bt_byte_order byte_order)
+static
+void bt_field_type_enumeration_set_byte_order_recursive(
+ struct bt_field_type *ft, enum bt_byte_order byte_order)
{
- struct bt_field_type_common_enumeration *enum_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_enumeration *enum_ft = (void *) ft;
- bt_field_type_common_set_byte_order(BT_TO_COMMON(enum_ft->container_ft),
+ bt_field_type_set_byte_order((void *) enum_ft->container_ft,
byte_order);
}
-BT_HIDDEN
-void bt_field_type_common_floating_point_set_byte_order(
- struct bt_field_type_common *ft, enum bt_byte_order byte_order)
+static
+void bt_field_type_floating_point_set_byte_order(
+ struct bt_field_type *ft, enum bt_byte_order byte_order)
{
- struct bt_field_type_common_floating_point *flt_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_floating_point *flt_ft = (void *) ft;
flt_ft->user_byte_order = byte_order;
}
-BT_HIDDEN
-void bt_field_type_common_structure_set_byte_order_recursive(
- struct bt_field_type_common *ft,
+static
+void bt_field_type_structure_set_byte_order_recursive(
+ struct bt_field_type *ft,
enum bt_byte_order byte_order)
{
int i;
- struct bt_field_type_common_structure *struct_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_structure *struct_ft = (void *) ft;
for (i = 0; i < struct_ft->fields->len; i++) {
- struct bt_field_type_common_structure_field *field =
- BT_FIELD_TYPE_COMMON_STRUCTURE_FIELD_AT_INDEX(
+ struct bt_field_type_structure_field *field =
+ BT_FIELD_TYPE_STRUCTURE_FIELD_AT_INDEX(
struct_ft, i);
- struct bt_field_type_common *field_type = field->type;
+ struct bt_field_type *field_type = field->type;
- bt_field_type_common_set_byte_order(field_type, byte_order);
+ bt_field_type_set_byte_order(field_type, byte_order);
}
}
-BT_HIDDEN
-void bt_field_type_common_variant_set_byte_order_recursive(
- struct bt_field_type_common *ft,
+static
+void bt_field_type_variant_set_byte_order_recursive(
+ struct bt_field_type *ft,
enum bt_byte_order byte_order)
{
int i;
- struct bt_field_type_common_variant *var_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_variant *var_ft = (void *) ft;
for (i = 0; i < var_ft->choices->len; i++) {
- struct bt_field_type_common_variant_choice *choice =
- BT_FIELD_TYPE_COMMON_VARIANT_CHOICE_AT_INDEX(
+ struct bt_field_type_variant_choice *choice =
+ BT_FIELD_TYPE_VARIANT_CHOICE_AT_INDEX(
var_ft, i);
- struct bt_field_type_common *field_type = choice->type;
+ struct bt_field_type *field_type = choice->type;
- bt_field_type_common_set_byte_order(field_type, byte_order);
+ bt_field_type_set_byte_order(field_type, byte_order);
}
}
-BT_HIDDEN
-void bt_field_type_common_array_set_byte_order_recursive(
- struct bt_field_type_common *ft,
+static
+void bt_field_type_array_set_byte_order_recursive(
+ struct bt_field_type *ft,
enum bt_byte_order byte_order)
{
- struct bt_field_type_common_array *array_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_array *array_ft = (void *) ft;
- bt_field_type_common_set_byte_order(array_ft->element_ft, byte_order);
+ bt_field_type_set_byte_order(array_ft->element_ft, byte_order);
}
-BT_HIDDEN
-void bt_field_type_common_sequence_set_byte_order_recursive(
- struct bt_field_type_common *ft,
+static
+void bt_field_type_sequence_set_byte_order_recursive(
+ struct bt_field_type *ft,
enum bt_byte_order byte_order)
{
- struct bt_field_type_common_sequence *seq_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_sequence *seq_ft = (void *) ft;
- bt_field_type_common_set_byte_order(seq_ft->element_ft, byte_order);
+ bt_field_type_set_byte_order(seq_ft->element_ft, byte_order);
}
-BT_HIDDEN
-int bt_field_type_common_integer_compare(struct bt_field_type_common *ft_a,
- struct bt_field_type_common *ft_b)
+static
+int bt_field_type_integer_compare(struct bt_field_type *ft_a,
+ struct bt_field_type *ft_b)
{
int ret = 1;
- struct bt_field_type_common_integer *int_ft_a = BT_FROM_COMMON(ft_a);
- struct bt_field_type_common_integer *int_ft_b = BT_FROM_COMMON(ft_b);
+ struct bt_field_type_integer *int_ft_a = (void *) ft_a;
+ struct bt_field_type_integer *int_ft_b = (void *) ft_b;
/* Length */
if (int_ft_a->size != int_ft_b->size) {
return ret;
}
-BT_HIDDEN
-int bt_field_type_common_floating_point_compare(
- struct bt_field_type_common *ft_a,
- struct bt_field_type_common *ft_b)
+static
+int bt_field_type_floating_point_compare(
+ struct bt_field_type *ft_a,
+ struct bt_field_type *ft_b)
{
int ret = 1;
- struct bt_field_type_common_floating_point *flt_ft_a =
- BT_FROM_COMMON(ft_a);
- struct bt_field_type_common_floating_point *flt_ft_b =
- BT_FROM_COMMON(ft_b);
+ struct bt_field_type_floating_point *flt_ft_a = (void *) ft_a;
+ struct bt_field_type_floating_point *flt_ft_b = (void *) ft_b;
/* Byte order */
if (flt_ft_a->user_byte_order != flt_ft_b->user_byte_order) {
return ret;
}
-BT_HIDDEN
-int bt_field_type_common_enumeration_compare_recursive(
- struct bt_field_type_common *ft_a,
- struct bt_field_type_common *ft_b)
+static
+int bt_field_type_enumeration_compare_recursive(
+ struct bt_field_type *ft_a,
+ struct bt_field_type *ft_b)
{
int ret = 1;
int i;
- struct bt_field_type_common_enumeration *enum_ft_a =
- BT_FROM_COMMON(ft_a);
- struct bt_field_type_common_enumeration *enum_ft_b =
- BT_FROM_COMMON(ft_b);
+ struct bt_field_type_enumeration *enum_ft_a = (void *) ft_a;
+ struct bt_field_type_enumeration *enum_ft_b = (void *) ft_b;
/* Container field type */
- ret = bt_field_type_common_compare(
- BT_TO_COMMON(enum_ft_a->container_ft),
- BT_TO_COMMON(enum_ft_b->container_ft));
+ ret = bt_field_type_compare((void *) enum_ft_a->container_ft,
+ (void *) enum_ft_b->container_ft);
if (ret) {
BT_LOGV("Enumeration field types differ: different container field types: "
"ft-a-container-ft-addr=%p, ft-b-container-ft-addr=%p",
return ret;
}
-BT_HIDDEN
-int bt_field_type_common_string_compare(struct bt_field_type_common *ft_a,
- struct bt_field_type_common *ft_b)
+static
+int bt_field_type_string_compare(struct bt_field_type *ft_a,
+ struct bt_field_type *ft_b)
{
int ret = 1;
- struct bt_field_type_common_string *string_ft_a = BT_FROM_COMMON(ft_a);
- struct bt_field_type_common_string *string_ft_b = BT_FROM_COMMON(ft_b);
+ struct bt_field_type_string *string_ft_a = (void *) ft_a;
+ struct bt_field_type_string *string_ft_b = (void *) ft_b;
/* Encoding */
if (string_ft_a->encoding != string_ft_b->encoding) {
static
int compare_structure_variant_members(
- struct bt_field_type_common *member_a_ft,
- struct bt_field_type_common *member_b_ft,
+ struct bt_field_type *member_a_ft,
+ struct bt_field_type *member_b_ft,
GQuark member_a_name, GQuark member_b_name)
{
int ret = 1;
}
/* Type */
- ret = bt_field_type_common_compare(member_a_ft, member_b_ft);
+ ret = bt_field_type_compare(member_a_ft, member_b_ft);
if (ret == 1) {
BT_LOGV("Structure/variant field type fields differ: different field types: "
"field-name=\"%s\", field-a-ft-addr=%p, field-b-ft-addr=%p",
return ret;
}
-BT_HIDDEN
-int bt_field_type_common_structure_compare_recursive(
- struct bt_field_type_common *ft_a,
- struct bt_field_type_common *ft_b)
+static
+int bt_field_type_structure_compare_recursive(
+ struct bt_field_type *ft_a,
+ struct bt_field_type *ft_b)
{
int ret = 1;
int i;
- struct bt_field_type_common_structure *struct_ft_a =
- BT_FROM_COMMON(ft_a);
- struct bt_field_type_common_structure *struct_ft_b =
- BT_FROM_COMMON(ft_b);
+ struct bt_field_type_structure *struct_ft_a = (void *) ft_a;
+ struct bt_field_type_structure *struct_ft_b = (void *) ft_b;
/* Alignment */
- if (bt_field_type_common_get_alignment(ft_a) !=
- bt_field_type_common_get_alignment(ft_b)) {
+ if (bt_field_type_get_alignment(ft_a) !=
+ bt_field_type_get_alignment(ft_b)) {
BT_LOGV("Structure field types differ: different alignments: "
"ft-a-align=%u, ft-b-align=%u",
- bt_field_type_common_get_alignment(ft_a),
- bt_field_type_common_get_alignment(ft_b));
+ bt_field_type_get_alignment(ft_a),
+ bt_field_type_get_alignment(ft_b));
goto end;
}
}
for (i = 0; i < struct_ft_a->fields->len; ++i) {
- struct bt_field_type_common_structure_field *field_a =
- BT_FIELD_TYPE_COMMON_STRUCTURE_FIELD_AT_INDEX(
+ struct bt_field_type_structure_field *field_a =
+ BT_FIELD_TYPE_STRUCTURE_FIELD_AT_INDEX(
struct_ft_a, i);
- struct bt_field_type_common_structure_field *field_b =
- BT_FIELD_TYPE_COMMON_STRUCTURE_FIELD_AT_INDEX(
+ struct bt_field_type_structure_field *field_b =
+ BT_FIELD_TYPE_STRUCTURE_FIELD_AT_INDEX(
struct_ft_b, i);
ret = compare_structure_variant_members(field_a->type,
return ret;
}
-BT_HIDDEN
-int bt_field_type_common_variant_compare_recursive(
- struct bt_field_type_common *ft_a,
- struct bt_field_type_common *ft_b)
+static
+int bt_field_type_variant_compare_recursive(
+ struct bt_field_type *ft_a,
+ struct bt_field_type *ft_b)
{
int ret = 1;
int i;
- struct bt_field_type_common_variant *var_ft_a = BT_FROM_COMMON(ft_a);
- struct bt_field_type_common_variant *var_ft_b = BT_FROM_COMMON(ft_b);
+ struct bt_field_type_variant *var_ft_a = (void *) ft_a;
+ struct bt_field_type_variant *var_ft_b = (void *) ft_b;
/* Tag name */
if (strcmp(var_ft_a->tag_name->str, var_ft_b->tag_name->str)) {
}
/* Tag type */
- ret = bt_field_type_common_compare(BT_TO_COMMON(var_ft_a->tag_ft),
- BT_TO_COMMON(var_ft_b->tag_ft));
+ ret = bt_field_type_compare((void *) var_ft_a->tag_ft,
+ (void *) var_ft_b->tag_ft);
if (ret) {
BT_LOGV("Variant field types differ: different tag field types: "
"ft-a-tag-ft-addr=%p, ft-b-tag-ft-addr=%p",
}
for (i = 0; i < var_ft_a->choices->len; ++i) {
- struct bt_field_type_common_variant_choice *choice_a =
- BT_FIELD_TYPE_COMMON_VARIANT_CHOICE_AT_INDEX(
+ struct bt_field_type_variant_choice *choice_a =
+ BT_FIELD_TYPE_VARIANT_CHOICE_AT_INDEX(
var_ft_a, i);
- struct bt_field_type_common_variant_choice *choice_b =
- BT_FIELD_TYPE_COMMON_VARIANT_CHOICE_AT_INDEX(
+ struct bt_field_type_variant_choice *choice_b =
+ BT_FIELD_TYPE_VARIANT_CHOICE_AT_INDEX(
var_ft_b, i);
ret = compare_structure_variant_members(choice_a->type,
return ret;
}
-BT_HIDDEN
-int bt_field_type_common_array_compare_recursive(
- struct bt_field_type_common *ft_a,
- struct bt_field_type_common *ft_b)
+static
+int bt_field_type_array_compare_recursive(
+ struct bt_field_type *ft_a,
+ struct bt_field_type *ft_b)
{
int ret = 1;
- struct bt_field_type_common_array *array_ft_a = BT_FROM_COMMON(ft_a);
- struct bt_field_type_common_array *array_ft_b = BT_FROM_COMMON(ft_b);
+ struct bt_field_type_array *array_ft_a = (void *) ft_a;
+ struct bt_field_type_array *array_ft_b = (void *) ft_b;
/* Length */
if (array_ft_a->length != array_ft_b->length) {
}
/* Element type */
- ret = bt_field_type_common_compare(array_ft_a->element_ft,
+ ret = bt_field_type_compare(array_ft_a->element_ft,
array_ft_b->element_ft);
if (ret == 1) {
BT_LOGV("Array field types differ: different element field types: "
return ret;
}
-BT_HIDDEN
-int bt_field_type_common_sequence_compare_recursive(
- struct bt_field_type_common *ft_a,
- struct bt_field_type_common *ft_b)
+static
+int bt_field_type_sequence_compare_recursive(
+ struct bt_field_type *ft_a,
+ struct bt_field_type *ft_b)
{
int ret = -1;
- struct bt_field_type_common_sequence *seq_ft_a = BT_FROM_COMMON(ft_a);
- struct bt_field_type_common_sequence *seq_ft_b = BT_FROM_COMMON(ft_b);
+ struct bt_field_type_sequence *seq_ft_a = (void *) ft_a;
+ struct bt_field_type_sequence *seq_ft_b = (void *) ft_b;
/* Length name */
if (strcmp(seq_ft_a->length_field_name->str,
}
/* Element type */
- ret = bt_field_type_common_compare(seq_ft_a->element_ft,
+ ret = bt_field_type_compare(seq_ft_a->element_ft,
seq_ft_b->element_ft);
if (ret == 1) {
BT_LOGV("Sequence field types differ: different element field types: "
}
BT_HIDDEN
-int bt_field_type_common_compare(struct bt_field_type_common *ft_a,
- struct bt_field_type_common *ft_b)
+int bt_field_type_compare(struct bt_field_type *ft_a,
+ struct bt_field_type *ft_b)
{
int ret = 1;
return ret;
}
-int bt_field_type_compare(struct bt_field_type *ft_a,
- struct bt_field_type *ft_b)
-{
- return bt_field_type_common_compare((void *) ft_a, (void *) ft_b);
-}
-
BT_HIDDEN
-int64_t bt_field_type_common_get_field_count(struct bt_field_type_common *ft)
+int64_t bt_field_type_get_field_count(struct bt_field_type *ft)
{
int64_t field_count = -1;
switch (ft->id) {
case BT_FIELD_TYPE_ID_STRUCT:
field_count =
- bt_field_type_common_structure_get_field_count(ft);
+ bt_field_type_structure_get_field_count(ft);
break;
case BT_FIELD_TYPE_ID_VARIANT:
field_count =
- bt_field_type_common_variant_get_field_count(ft);
+ bt_field_type_variant_get_field_count(ft);
break;
case BT_FIELD_TYPE_ID_ARRAY:
case BT_FIELD_TYPE_ID_SEQUENCE:
}
BT_HIDDEN
-struct bt_field_type_common *bt_field_type_common_borrow_field_at_index(
- struct bt_field_type_common *ft, int index)
+struct bt_field_type *bt_field_type_borrow_field_at_index(
+ struct bt_field_type *ft, int index)
{
- struct bt_field_type_common *field_type = NULL;
+ struct bt_field_type *field_type = NULL;
switch (ft->id) {
case BT_FIELD_TYPE_ID_STRUCT:
{
- int ret = bt_field_type_common_structure_borrow_field_by_index(
+ int ret = bt_field_type_structure_borrow_field_by_index(
ft, NULL, &field_type, index);
if (ret) {
field_type = NULL;
}
case BT_FIELD_TYPE_ID_VARIANT:
{
- int ret = bt_field_type_common_variant_borrow_field_by_index(
+ int ret = bt_field_type_variant_borrow_field_by_index(
ft, NULL, &field_type, index);
if (ret) {
field_type = NULL;
}
case BT_FIELD_TYPE_ID_ARRAY:
field_type =
- bt_field_type_common_array_borrow_element_field_type(ft);
+ bt_field_type_array_borrow_element_field_type(ft);
break;
case BT_FIELD_TYPE_ID_SEQUENCE:
field_type =
- bt_field_type_common_sequence_borrow_element_field_type(ft);
+ bt_field_type_sequence_borrow_element_field_type(ft);
break;
default:
break;
}
BT_HIDDEN
-int bt_field_type_common_get_field_index(struct bt_field_type_common *ft,
+int bt_field_type_get_field_index(struct bt_field_type *ft,
const char *name)
{
int field_index = -1;
switch (ft->id) {
case BT_FIELD_TYPE_ID_STRUCT:
- field_index = bt_field_type_common_structure_get_field_name_index(
+ field_index = bt_field_type_structure_get_field_name_index(
ft, name);
break;
case BT_FIELD_TYPE_ID_VARIANT:
- field_index = bt_field_type_common_variant_get_field_name_index(
+ field_index = bt_field_type_variant_get_field_name_index(
ft, name);
break;
default:
return field_index;
}
-BT_HIDDEN
-struct bt_field_path *bt_field_type_common_variant_borrow_tag_field_path(
- struct bt_field_type_common *ft)
+struct bt_field_path *bt_field_type_variant_borrow_tag_field_path(
+ struct bt_field_type *ft)
{
- struct bt_field_type_common_variant *var_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_variant *var_ft = (void *) ft;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_VARIANT,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_VARIANT,
"Field type");
return var_ft->tag_field_path;
}
-struct bt_field_path *bt_field_type_variant_borrow_tag_field_path(
+struct bt_field_path *bt_field_type_sequence_borrow_length_field_path(
struct bt_field_type *ft)
{
- return bt_field_type_common_variant_borrow_tag_field_path((void *) ft);
-}
-
-BT_HIDDEN
-struct bt_field_path *bt_field_type_common_sequence_borrow_length_field_path(
- struct bt_field_type_common *ft)
-{
- struct bt_field_type_common_sequence *seq_ft = BT_FROM_COMMON(ft);
+ struct bt_field_type_sequence *seq_ft = (void *) ft;
BT_ASSERT_PRE_NON_NULL(ft, "Field type");
- BT_ASSERT_PRE_FT_COMMON_HAS_ID(ft, BT_FIELD_TYPE_ID_SEQUENCE,
+ BT_ASSERT_PRE_FT_HAS_ID(ft, BT_FIELD_TYPE_ID_SEQUENCE,
"Field type");
return seq_ft->length_field_path;
}
-struct bt_field_path *bt_field_type_sequence_borrow_length_field_path(
- struct bt_field_type *ft)
-{
- return bt_field_type_common_sequence_borrow_length_field_path(
- (void *) ft);
-}
-
BT_HIDDEN
-int bt_field_type_common_validate_single_clock_class(
- struct bt_field_type_common *ft,
+int bt_field_type_validate_single_clock_class(
+ struct bt_field_type *ft,
struct bt_clock_class **expected_clock_class)
{
int ret = 0;
case BT_FIELD_TYPE_ID_INTEGER:
{
struct bt_clock_class *mapped_clock_class =
- bt_field_type_common_integer_borrow_mapped_clock_class(ft);
+ bt_field_type_integer_borrow_mapped_clock_class(ft);
if (!mapped_clock_class) {
goto end;
case BT_FIELD_TYPE_ID_ARRAY:
case BT_FIELD_TYPE_ID_SEQUENCE:
{
- struct bt_field_type_common *sub_ft = NULL;
+ struct bt_field_type *sub_ft = NULL;
switch (ft->id) {
case BT_FIELD_TYPE_ID_ENUM:
- sub_ft = bt_field_type_common_enumeration_borrow_container_field_type(
+ sub_ft = bt_field_type_enumeration_borrow_container_field_type(
ft);
break;
case BT_FIELD_TYPE_ID_ARRAY:
- sub_ft = bt_field_type_common_array_borrow_element_field_type(
+ sub_ft = bt_field_type_array_borrow_element_field_type(
ft);
break;
case BT_FIELD_TYPE_ID_SEQUENCE:
- sub_ft = bt_field_type_common_sequence_borrow_element_field_type(
+ sub_ft = bt_field_type_sequence_borrow_element_field_type(
ft);
break;
default:
}
BT_ASSERT(sub_ft);
- ret = bt_field_type_common_validate_single_clock_class(sub_ft,
+ ret = bt_field_type_validate_single_clock_class(sub_ft,
expected_clock_class);
break;
}
case BT_FIELD_TYPE_ID_STRUCT:
{
uint64_t i;
- int64_t count = bt_field_type_common_structure_get_field_count(
+ int64_t count = bt_field_type_structure_get_field_count(
ft);
for (i = 0; i < count; i++) {
const char *name;
- struct bt_field_type_common *member_type;
+ struct bt_field_type *member_type;
- ret = bt_field_type_common_structure_borrow_field_by_index(
+ ret = bt_field_type_structure_borrow_field_by_index(
ft, &name, &member_type, i);
BT_ASSERT(ret == 0);
- ret = bt_field_type_common_validate_single_clock_class(
+ ret = bt_field_type_validate_single_clock_class(
member_type, expected_clock_class);
if (ret) {
BT_LOGW("Structure field type's field's type "
case BT_FIELD_TYPE_ID_VARIANT:
{
uint64_t i;
- int64_t count = bt_field_type_common_variant_get_field_count(
+ int64_t count = bt_field_type_variant_get_field_count(
ft);
for (i = 0; i < count; i++) {
const char *name;
- struct bt_field_type_common *member_type;
+ struct bt_field_type *member_type;
- ret = bt_field_type_common_variant_borrow_field_by_index(
+ ret = bt_field_type_variant_borrow_field_by_index(
ft, &name, &member_type, i);
BT_ASSERT(ret == 0);
- ret = bt_field_type_common_validate_single_clock_class(
+ ret = bt_field_type_validate_single_clock_class(
member_type, expected_clock_class);
if (ret) {
BT_LOGW("Variant field type's field's type "
struct bt_field_type *bt_field_type_integer_copy(
struct bt_field_type *ft)
{
- struct bt_field_type_common_integer *int_ft = (void *) ft;
- struct bt_field_type_common_integer *copy_ft;
+ struct bt_field_type_integer *int_ft = (void *) ft;
+ struct bt_field_type_integer *copy_ft;
BT_LOGD("Copying integer field type's: addr=%p", ft);
copy_ft = (void *) bt_field_type_integer_create(int_ft->size);
struct bt_field_type *ft)
{
size_t i;
- struct bt_field_type_common_enumeration *enum_ft = (void *) ft;
- struct bt_field_type_common_enumeration *copy_ft = NULL;
- struct bt_field_type_common_enumeration *container_copy_ft;
+ struct bt_field_type_enumeration *enum_ft = (void *) ft;
+ struct bt_field_type_enumeration *copy_ft = NULL;
+ struct bt_field_type_enumeration *container_copy_ft;
BT_LOGD("Copying enumeration field type's: addr=%p", ft);
/* Copy the source enumeration's container */
BT_LOGD_STR("Copying enumeration field type's container field type.");
- container_copy_ft = BT_FROM_COMMON(bt_field_type_common_copy(
- BT_TO_COMMON(enum_ft->container_ft)));
+ container_copy_ft =
+ (void *) bt_field_type_copy((void *) enum_ft->container_ft);
if (!container_copy_ft) {
BT_LOGE_STR("Cannot copy enumeration field type's container field type.");
goto end;
struct bt_field_type *bt_field_type_floating_point_copy(
struct bt_field_type *ft)
{
- struct bt_field_type_common_floating_point *flt_ft = BT_FROM_COMMON(ft);
- struct bt_field_type_common_floating_point *copy_ft;
+ struct bt_field_type_floating_point *flt_ft = (void *) ft;
+ struct bt_field_type_floating_point *copy_ft;
BT_LOGD("Copying floating point number field type's: addr=%p", ft);
copy_ft = (void *) bt_field_type_floating_point_create();
int64_t i;
GHashTableIter iter;
gpointer key, value;
- struct bt_field_type_common_structure *struct_ft = (void *) ft;
- struct bt_field_type_common_structure *copy_ft;
+ struct bt_field_type_structure *struct_ft = (void *) ft;
+ struct bt_field_type_structure *copy_ft;
BT_LOGD("Copying structure field type's: addr=%p", ft);
copy_ft = (void *) bt_field_type_structure_create();
g_array_set_size(copy_ft->fields, struct_ft->fields->len);
for (i = 0; i < struct_ft->fields->len; i++) {
- struct bt_field_type_common_structure_field *entry, *copy_entry;
- struct bt_field_type_common *field_ft_copy;
+ struct bt_field_type_structure_field *entry, *copy_entry;
+ struct bt_field_type *field_ft_copy;
- entry = BT_FIELD_TYPE_COMMON_STRUCTURE_FIELD_AT_INDEX(
+ entry = BT_FIELD_TYPE_STRUCTURE_FIELD_AT_INDEX(
struct_ft, i);
- copy_entry = BT_FIELD_TYPE_COMMON_STRUCTURE_FIELD_AT_INDEX(
+ copy_entry = BT_FIELD_TYPE_STRUCTURE_FIELD_AT_INDEX(
copy_ft, i);
BT_LOGD("Copying structure field type's field: "
"index=%" PRId64 ", "
int64_t i;
GHashTableIter iter;
gpointer key, value;
- struct bt_field_type_common *tag_ft_copy = NULL;
- struct bt_field_type_common_variant *var_ft = (void *) ft;
- struct bt_field_type_common_variant *copy_ft = NULL;
+ struct bt_field_type *tag_ft_copy = NULL;
+ struct bt_field_type_variant *var_ft = (void *) ft;
+ struct bt_field_type_variant *copy_ft = NULL;
BT_LOGD("Copying variant field type's: addr=%p", ft);
if (var_ft->tag_ft) {
BT_LOGD_STR("Copying variant field type's tag field type.");
- tag_ft_copy = bt_field_type_common_copy(
- BT_TO_COMMON(var_ft->tag_ft));
+ tag_ft_copy = bt_field_type_copy((void *) var_ft->tag_ft);
if (!tag_ft_copy) {
BT_LOGE_STR("Cannot copy variant field type's tag field type.");
goto end;
g_array_set_size(copy_ft->choices, var_ft->choices->len);
for (i = 0; i < var_ft->choices->len; i++) {
- struct bt_field_type_common_variant_choice *entry, *copy_entry;
- struct bt_field_type_common *field_ft_copy;
+ struct bt_field_type_variant_choice *entry, *copy_entry;
+ struct bt_field_type *field_ft_copy;
uint64_t range_i;
- entry = BT_FIELD_TYPE_COMMON_VARIANT_CHOICE_AT_INDEX(var_ft, i);
- copy_entry = BT_FIELD_TYPE_COMMON_VARIANT_CHOICE_AT_INDEX(
+ entry = BT_FIELD_TYPE_VARIANT_CHOICE_AT_INDEX(var_ft, i);
+ copy_entry = BT_FIELD_TYPE_VARIANT_CHOICE_AT_INDEX(
copy_ft, i);
BT_LOGD("Copying variant field type's field: "
"index=%" PRId64 ", "
/* Copy ranges */
copy_entry->ranges = g_array_new(FALSE, TRUE,
- sizeof(struct bt_field_type_common_variant_choice_range));
+ sizeof(struct bt_field_type_variant_choice_range));
BT_ASSERT(copy_entry->ranges);
g_array_set_size(copy_entry->ranges, entry->ranges->len);
struct bt_field_type *bt_field_type_array_copy_recursive(
struct bt_field_type *ft)
{
- struct bt_field_type_common *container_ft_copy = NULL;
- struct bt_field_type_common_array *array_ft = (void *) ft;
- struct bt_field_type_common_array *copy_ft = NULL;
+ struct bt_field_type *container_ft_copy = NULL;
+ struct bt_field_type_array *array_ft = (void *) ft;
+ struct bt_field_type_array *copy_ft = NULL;
BT_LOGD("Copying array field type's: addr=%p", ft);
BT_LOGD_STR("Copying array field type's element field type.");
- container_ft_copy = bt_field_type_common_copy(array_ft->element_ft);
+ container_ft_copy = bt_field_type_copy(array_ft->element_ft);
if (!container_ft_copy) {
BT_LOGE_STR("Cannot copy array field type's element field type.");
goto end;
struct bt_field_type *bt_field_type_sequence_copy_recursive(
struct bt_field_type *ft)
{
- struct bt_field_type_common *container_ft_copy = NULL;
- struct bt_field_type_common_sequence *seq_ft = (void *) ft;
- struct bt_field_type_common_sequence *copy_ft = NULL;
+ struct bt_field_type *container_ft_copy = NULL;
+ struct bt_field_type_sequence *seq_ft = (void *) ft;
+ struct bt_field_type_sequence *copy_ft = NULL;
BT_LOGD("Copying sequence field type's: addr=%p", ft);
BT_LOGD_STR("Copying sequence field type's element field type.");
- container_ft_copy = bt_field_type_common_copy(seq_ft->element_ft);
+ container_ft_copy = bt_field_type_copy(seq_ft->element_ft);
if (!container_ft_copy) {
BT_LOGE_STR("Cannot copy sequence field type's element field type.");
goto end;
static
struct bt_field_type *bt_field_type_string_copy(struct bt_field_type *ft)
{
- struct bt_field_type_common_string *string_ft = (void *) ft;
- struct bt_field_type_common_string *copy_ft = NULL;
+ struct bt_field_type_string *string_ft = (void *) ft;
+ struct bt_field_type_string *copy_ft = NULL;
BT_LOGD("Copying string field type's: addr=%p", ft);
copy_ft = (void *) bt_field_type_string_create();