/*
- * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
+ * SPDX-License-Identifier: MIT
*
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
+ * Copyright 2013, 2014 Jérémie Galarneau <jeremie.galarneau@efficios.com>
*/
-#define BT_LOG_TAG "CTF-WRITER-FIELDS"
+#define BT_LOG_TAG "CTF-WRITER/FIELDS"
#include "logging.h"
#include <float.h>
#include <inttypes.h>
+#include <stdbool.h>
#include <stdlib.h>
-#include <babeltrace2/ctf-writer/object.h>
+#include <babeltrace2-ctf-writer/object.h>
#include "common/align.h"
#include "common/assert.h"
_name " is not an integer or an enumeration field: " \
"field-addr=%p", (_field))
-BT_HIDDEN
struct bt_ctf_field_common *bt_ctf_field_common_copy(struct bt_ctf_field_common *field)
{
struct bt_ctf_field_common *copy = NULL;
BT_CTF_ASSERT_PRE_NON_NULL(field, "Field");
- BT_ASSERT(field_type_common_has_known_id(field->type));
- BT_ASSERT(field->methods->copy);
+ BT_ASSERT_DBG(field_type_common_has_known_id(field->type));
+ BT_ASSERT_DBG(field->methods->copy);
copy = field->methods->copy(field);
if (!copy) {
BT_LOGW("Cannot create field: ft-addr=%p", field->type);
return copy;
}
-BT_HIDDEN
int bt_ctf_field_common_structure_initialize(struct bt_ctf_field_common *field,
struct bt_ctf_field_type_common *type,
bool is_shared, bt_ctf_object_release_func release_func,
/* Create all fields contained in the structure field. */
for (i = 0; i < structure_type->fields->len; i++) {
- struct bt_ctf_field_common *field;
+ struct bt_ctf_field_common *member_field;
struct bt_ctf_field_type_common_structure_field *struct_field =
BT_CTF_FIELD_TYPE_COMMON_STRUCTURE_FIELD_AT_INDEX(
structure_type, i);
- field = field_create_func(struct_field->type);
- if (!field) {
+ member_field = field_create_func(struct_field->type);
+ if (!member_field) {
BT_LOGE("Failed to create structure field's member: name=\"%s\", index=%zu",
g_quark_to_string(struct_field->name), i);
ret = -1;
goto end;
}
- g_ptr_array_index(structure->fields, i) = field;
+ g_ptr_array_index(structure->fields, i) = member_field;
}
BT_LOGD("Initialized common structure field object: addr=%p, ft-addr=%p",
return ret;
}
-BT_HIDDEN
int bt_ctf_field_common_variant_initialize(struct bt_ctf_field_common *field,
struct bt_ctf_field_type_common *type,
bool is_shared, bt_ctf_object_release_func release_func,
/* Create all fields contained in the variant field. */
for (i = 0; i < variant_type->choices->len; i++) {
- struct bt_ctf_field_common *field;
+ struct bt_ctf_field_common *member_field;
struct bt_ctf_field_type_common_variant_choice *var_choice =
BT_CTF_FIELD_TYPE_COMMON_VARIANT_CHOICE_AT_INDEX(
variant_type, i);
- field = field_create_func(var_choice->type);
- if (!field) {
+ member_field = field_create_func(var_choice->type);
+ if (!member_field) {
BT_LOGE("Failed to create variant field's member: name=\"%s\", index=%zu",
g_quark_to_string(var_choice->name), i);
ret = -1;
goto end;
}
- g_ptr_array_index(variant->fields, i) = field;
+ g_ptr_array_index(variant->fields, i) = member_field;
}
BT_LOGD("Initialized common variant field object: addr=%p, ft-addr=%p",
return ret;
}
-BT_HIDDEN
int bt_ctf_field_common_string_initialize(struct bt_ctf_field_common *field,
struct bt_ctf_field_type_common *type,
bool is_shared, bt_ctf_object_release_func release_func,
return ret;
}
-BT_HIDDEN
int bt_ctf_field_common_array_initialize(struct bt_ctf_field_common *field,
struct bt_ctf_field_type_common *type,
bool is_shared, bt_ctf_object_release_func release_func,
uint64_t i;
BT_LOGD("Initializing common array field object: ft-addr=%p", type);
- BT_ASSERT(type);
+ BT_ASSERT_DBG(type);
bt_ctf_field_common_initialize(field, type, is_shared,
release_func, methods);
array_length = array_type->length;
return ret;
}
-BT_HIDDEN
int bt_ctf_field_common_sequence_initialize(struct bt_ctf_field_common *field,
struct bt_ctf_field_type_common *type,
bool is_shared, bt_ctf_object_release_func release_func,
int ret = 0;
BT_LOGD("Initializing common sequence field object: ft-addr=%p", type);
- BT_ASSERT(type);
+ BT_ASSERT_DBG(type);
bt_ctf_field_common_initialize(field, type, is_shared,
release_func, methods);
sequence->elements = g_ptr_array_new();
return ret;
}
-BT_HIDDEN
int bt_ctf_field_common_generic_validate(struct bt_ctf_field_common *field)
{
return (field && field->payload_set) ? 0 : -1;
}
-BT_HIDDEN
int bt_ctf_field_common_structure_validate_recursive(struct bt_ctf_field_common *field)
{
int64_t i;
int ret = 0;
struct bt_ctf_field_common_structure *structure = BT_CTF_FROM_COMMON(field);
- BT_ASSERT(field);
+ BT_ASSERT_DBG(field);
for (i = 0; i < structure->fields->len; i++) {
ret = bt_ctf_field_common_validate_recursive(
this_ret = bt_ctf_field_type_common_structure_borrow_field_by_index(
field->type, &name, NULL, i);
- BT_ASSERT(this_ret == 0);
+ BT_ASSERT_DBG(this_ret == 0);
BT_CTF_ASSERT_PRE_MSG("Invalid structure field's field: "
"struct-field-addr=%p, field-name=\"%s\", "
"index=%" PRId64 ", field-addr=%p",
return ret;
}
-BT_HIDDEN
int bt_ctf_field_common_variant_validate_recursive(struct bt_ctf_field_common *field)
{
int ret = 0;
struct bt_ctf_field_common_variant *variant = BT_CTF_FROM_COMMON(field);
- BT_ASSERT(field);
+ BT_ASSERT_DBG(field);
if (!variant->current_field) {
ret = -1;
return ret;
}
-BT_HIDDEN
int bt_ctf_field_common_array_validate_recursive(struct bt_ctf_field_common *field)
{
int64_t i;
int ret = 0;
struct bt_ctf_field_common_array *array = BT_CTF_FROM_COMMON(field);
- BT_ASSERT(field);
+ BT_ASSERT_DBG(field);
for (i = 0; i < array->elements->len; i++) {
ret = bt_ctf_field_common_validate_recursive((void *) array->elements->pdata[i]);
return ret;
}
-BT_HIDDEN
int bt_ctf_field_common_sequence_validate_recursive(struct bt_ctf_field_common *field)
{
int64_t i;
int ret = 0;
struct bt_ctf_field_common_sequence *sequence = BT_CTF_FROM_COMMON(field);
- BT_ASSERT(field);
+ BT_ASSERT_DBG(field);
for (i = 0; i < sequence->elements->len; i++) {
ret = bt_ctf_field_common_validate_recursive(
return ret;
}
-BT_HIDDEN
void bt_ctf_field_common_generic_reset(struct bt_ctf_field_common *field)
{
- BT_ASSERT(field);
+ BT_ASSERT_DBG(field);
field->payload_set = false;
}
-BT_HIDDEN
void bt_ctf_field_common_structure_reset_recursive(struct bt_ctf_field_common *field)
{
int64_t i;
struct bt_ctf_field_common_structure *structure = BT_CTF_FROM_COMMON(field);
- BT_ASSERT(field);
+ BT_ASSERT_DBG(field);
for (i = 0; i < structure->fields->len; i++) {
struct bt_ctf_field_common *member = structure->fields->pdata[i];
}
}
-BT_HIDDEN
void bt_ctf_field_common_variant_reset_recursive(struct bt_ctf_field_common *field)
{
struct bt_ctf_field_common_variant *variant = BT_CTF_FROM_COMMON(field);
- BT_ASSERT(field);
+ BT_ASSERT_DBG(field);
variant->current_field = NULL;
}
-BT_HIDDEN
void bt_ctf_field_common_array_reset_recursive(struct bt_ctf_field_common *field)
{
size_t i;
struct bt_ctf_field_common_array *array = BT_CTF_FROM_COMMON(field);
- BT_ASSERT(field);
+ BT_ASSERT_DBG(field);
for (i = 0; i < array->elements->len; i++) {
struct bt_ctf_field_common *member = array->elements->pdata[i];
}
}
-BT_HIDDEN
void bt_ctf_field_common_sequence_reset_recursive(struct bt_ctf_field_common *field)
{
struct bt_ctf_field_common_sequence *sequence = BT_CTF_FROM_COMMON(field);
uint64_t i;
- BT_ASSERT(field);
+ BT_ASSERT_DBG(field);
for (i = 0; i < sequence->elements->len; i++) {
if (sequence->elements->pdata[i]) {
sequence->length = 0;
}
-BT_HIDDEN
void bt_ctf_field_common_generic_set_is_frozen(struct bt_ctf_field_common *field,
bool is_frozen)
{
field->frozen = is_frozen;
}
-BT_HIDDEN
void bt_ctf_field_common_structure_set_is_frozen_recursive(
struct bt_ctf_field_common *field, bool is_frozen)
{
bt_ctf_field_common_generic_set_is_frozen(field, is_frozen);
}
-BT_HIDDEN
void bt_ctf_field_common_variant_set_is_frozen_recursive(
struct bt_ctf_field_common *field, bool is_frozen)
{
bt_ctf_field_common_generic_set_is_frozen(field, is_frozen);
}
-BT_HIDDEN
void bt_ctf_field_common_array_set_is_frozen_recursive(
struct bt_ctf_field_common *field, bool is_frozen)
{
bt_ctf_field_common_generic_set_is_frozen(field, is_frozen);
}
-BT_HIDDEN
void bt_ctf_field_common_sequence_set_is_frozen_recursive(
struct bt_ctf_field_common *field, bool is_frozen)
{
bt_ctf_field_common_generic_set_is_frozen(field, is_frozen);
}
-BT_HIDDEN
void _bt_ctf_field_common_set_is_frozen_recursive(struct bt_ctf_field_common *field,
bool is_frozen)
{
BT_LOGD("Setting field object's frozen state: addr=%p, is-frozen=%d",
field, is_frozen);
- BT_ASSERT(field_type_common_has_known_id(field->type));
- BT_ASSERT(field->methods->set_is_frozen);
+ BT_ASSERT_DBG(field_type_common_has_known_id(field->type));
+ BT_ASSERT_DBG(field->methods->set_is_frozen);
field->methods->set_is_frozen(field, is_frozen);
end:
return;
}
-BT_HIDDEN
-bt_bool bt_ctf_field_common_generic_is_set(struct bt_ctf_field_common *field)
+bt_ctf_bool bt_ctf_field_common_generic_is_set(struct bt_ctf_field_common *field)
{
return field && field->payload_set;
}
-BT_HIDDEN
-bt_bool bt_ctf_field_common_structure_is_set_recursive(
+bt_ctf_bool bt_ctf_field_common_structure_is_set_recursive(
struct bt_ctf_field_common *field)
{
- bt_bool is_set = BT_FALSE;
+ bt_ctf_bool is_set = BT_CTF_FALSE;
size_t i;
struct bt_ctf_field_common_structure *structure = BT_CTF_FROM_COMMON(field);
- BT_ASSERT(field);
+ BT_ASSERT_DBG(field);
for (i = 0; i < structure->fields->len; i++) {
is_set = bt_ctf_field_common_is_set_recursive(
return is_set;
}
-BT_HIDDEN
-bt_bool bt_ctf_field_common_variant_is_set_recursive(struct bt_ctf_field_common *field)
+bt_ctf_bool bt_ctf_field_common_variant_is_set_recursive(struct bt_ctf_field_common *field)
{
struct bt_ctf_field_common_variant *variant = BT_CTF_FROM_COMMON(field);
- bt_bool is_set = BT_FALSE;
+ bt_ctf_bool is_set = BT_CTF_FALSE;
- BT_ASSERT(field);
+ BT_ASSERT_DBG(field);
if (variant->current_field) {
is_set = bt_ctf_field_common_is_set_recursive(
return is_set;
}
-BT_HIDDEN
-bt_bool bt_ctf_field_common_array_is_set_recursive(struct bt_ctf_field_common *field)
+bt_ctf_bool bt_ctf_field_common_array_is_set_recursive(struct bt_ctf_field_common *field)
{
size_t i;
- bt_bool is_set = BT_FALSE;
+ bt_ctf_bool is_set = BT_CTF_FALSE;
struct bt_ctf_field_common_array *array = BT_CTF_FROM_COMMON(field);
- BT_ASSERT(field);
+ BT_ASSERT_DBG(field);
for (i = 0; i < array->elements->len; i++) {
is_set = bt_ctf_field_common_is_set_recursive(array->elements->pdata[i]);
return is_set;
}
-BT_HIDDEN
-bt_bool bt_ctf_field_common_sequence_is_set_recursive(struct bt_ctf_field_common *field)
+bt_ctf_bool bt_ctf_field_common_sequence_is_set_recursive(struct bt_ctf_field_common *field)
{
size_t i;
- bt_bool is_set = BT_FALSE;
+ bt_ctf_bool is_set = BT_CTF_FALSE;
struct bt_ctf_field_common_sequence *sequence = BT_CTF_FROM_COMMON(field);
- BT_ASSERT(field);
+ BT_ASSERT_DBG(field);
if (!sequence->elements) {
goto end;
int bt_ctf_field_enumeration_validate_recursive(struct bt_ctf_field_common *field);
static
-bt_bool bt_ctf_field_enumeration_is_set_recursive(
+bt_ctf_bool bt_ctf_field_enumeration_is_set_recursive(
struct bt_ctf_field_common *field);
static
int bt_ctf_field_variant_validate_recursive(struct bt_ctf_field_common *field);
static
-bt_bool bt_ctf_field_variant_is_set_recursive(struct bt_ctf_field_common *field);
+bt_ctf_bool bt_ctf_field_variant_is_set_recursive(struct bt_ctf_field_common *field);
static
void bt_ctf_field_variant_reset_recursive(struct bt_ctf_field_common *field);
g_free(field);
}
-BT_HIDDEN
int bt_ctf_field_serialize_recursive(struct bt_ctf_field *field,
struct bt_ctfser *ctfser,
enum bt_ctf_byte_order native_byte_order)
struct bt_ctf_field_common *field_common = (void *) field;
bt_ctf_field_serialize_recursive_func serialize_func;
- BT_ASSERT(ctfser);
+ BT_ASSERT_DBG(ctfser);
BT_CTF_ASSERT_PRE_NON_NULL(field, "Field");
- BT_ASSERT(field_common->spec.writer.serialize_func);
+ BT_ASSERT_DBG(field_common->spec.writer.serialize_func);
serialize_func = field_common->spec.writer.serialize_func;
return serialize_func(field_common, ctfser,
native_byte_order);
enum bt_ctf_byte_order byte_order;
BT_CTF_ASSERT_PRE_CTF_FIELD_COMMON_IS_SET(field, "Integer field");
- BT_LOGV("Serializing CTF writer integer field: addr=%p, native-bo=%s",
+ BT_LOGT("Serializing CTF writer integer field: addr=%p, native-bo=%s",
field,
bt_ctf_byte_order_string(native_byte_order));
byte_order = int_type->user_byte_order;
LITTLE_ENDIAN : BIG_ENDIAN);
}
- if (unlikely(ret)) {
+ if (G_UNLIKELY(ret)) {
BT_LOGE("Cannot serialize integer field: ret=%d", ret);
goto end;
}
{
struct bt_ctf_field_enumeration *enumeration = (void *) field;
- BT_LOGV("Serializing enumeration field: addr=%p, native-bo=%s",
+ BT_LOGT("Serializing enumeration field: addr=%p, native-bo=%s",
field, bt_ctf_byte_order_string(native_byte_order));
- BT_LOGV_STR("Serializing enumeration field's payload field.");
+ BT_LOGT_STR("Serializing enumeration field's payload field.");
return bt_ctf_field_serialize_recursive(
(void *) enumeration->container, ctfser, native_byte_order);
}
enum bt_ctf_byte_order byte_order;
BT_CTF_ASSERT_PRE_CTF_FIELD_COMMON_IS_SET(field, "Floating point number field");
- BT_LOGV("Serializing floating point number field: "
+ BT_LOGT("Serializing floating point number field: "
"addr=%p, native-bo=%s", field,
bt_ctf_byte_order_string(native_byte_order));
byte_order == BT_CTF_BYTE_ORDER_LITTLE_ENDIAN ?
LITTLE_ENDIAN : BIG_ENDIAN);
} else {
- abort();
+ bt_common_abort();
}
- if (unlikely(ret)) {
+ if (G_UNLIKELY(ret)) {
BT_LOGE("Cannot serialize floating point number field: "
"ret=%d", ret);
goto end;
int ret;
struct bt_ctf_field_common_structure *structure = BT_CTF_FROM_COMMON(field);
- BT_LOGV("Serializing structure field: addr=%p, native-bo=%s",
+ BT_LOGT("Serializing structure field: addr=%p, native-bo=%s",
field, bt_ctf_byte_order_string(native_byte_order));
ret = bt_ctfser_align_offset_in_current_packet(ctfser,
field->type->alignment);
- if (unlikely(ret)) {
+ if (G_UNLIKELY(ret)) {
BT_LOGE("Cannot align offset before serializing structure field: "
"ret=%d", ret);
goto end;
structure->fields, i);
const char *field_name = NULL;
- BT_LOGV("Serializing structure field's field: ser-offset=%" PRIu64 ", "
+ BT_LOGT("Serializing structure field's field: ser-offset=%" PRIu64 ", "
"field-addr=%p, index=%" PRIu64,
bt_ctfser_get_offset_in_current_packet_bits(ctfser),
member, i);
- if (unlikely(!member)) {
+ if (G_UNLIKELY(!member)) {
ret = bt_ctf_field_type_common_structure_borrow_field_by_index(
field->type, &field_name, NULL, i);
- BT_ASSERT(ret == 0);
+ BT_ASSERT_DBG(ret == 0);
BT_LOGW("Cannot serialize structure field's field: field is not set: "
"struct-field-addr=%p, "
"field-name=\"%s\", index=%" PRId64,
ret = bt_ctf_field_serialize_recursive((void *) member, ctfser,
native_byte_order);
- if (unlikely(ret)) {
+ if (G_UNLIKELY(ret)) {
ret = bt_ctf_field_type_common_structure_borrow_field_by_index(
field->type, &field_name, NULL, i);
- BT_ASSERT(ret == 0);
+ BT_ASSERT_DBG(ret == 0);
BT_LOGW("Cannot serialize structure field's field: "
"struct-field-addr=%p, field-addr=%p, "
"field-name=\"%s\", index=%" PRId64,
{
struct bt_ctf_field_common_variant *variant = BT_CTF_FROM_COMMON(field);
- BT_LOGV("Serializing variant field: addr=%p, native-bo=%s",
+ BT_LOGT("Serializing variant field: addr=%p, native-bo=%s",
field, bt_ctf_byte_order_string(native_byte_order));
- BT_LOGV_STR("Serializing variant field's payload field.");
+ BT_LOGT_STR("Serializing variant field's payload field.");
return bt_ctf_field_serialize_recursive(
(void *) variant->current_field, ctfser, native_byte_order);
}
int ret = 0;
struct bt_ctf_field_common_array *array = BT_CTF_FROM_COMMON(field);
- BT_LOGV("Serializing array field: addr=%p, native-bo=%s",
+ BT_LOGT("Serializing array field: addr=%p, native-bo=%s",
field, bt_ctf_byte_order_string(native_byte_order));
for (i = 0; i < array->elements->len; i++) {
struct bt_ctf_field_common *elem_field =
g_ptr_array_index(array->elements, i);
- BT_LOGV("Serializing array field's element field: "
+ BT_LOGT("Serializing array field's element field: "
"ser-offset=%" PRIu64 ", field-addr=%p, index=%" PRId64,
bt_ctfser_get_offset_in_current_packet_bits(ctfser),
elem_field, i);
ret = bt_ctf_field_serialize_recursive(
(void *) elem_field, ctfser, native_byte_order);
- if (unlikely(ret)) {
+ if (G_UNLIKELY(ret)) {
BT_LOGW("Cannot serialize array field's element field: "
"array-field-addr=%p, field-addr=%p, "
"index=%" PRId64, field, elem_field, i);
int ret = 0;
struct bt_ctf_field_common_sequence *sequence = BT_CTF_FROM_COMMON(field);
- BT_LOGV("Serializing sequence field: addr=%p, native-bo=%s",
+ BT_LOGT("Serializing sequence field: addr=%p, native-bo=%s",
field, bt_ctf_byte_order_string(native_byte_order));
for (i = 0; i < sequence->elements->len; i++) {
struct bt_ctf_field_common *elem_field =
g_ptr_array_index(sequence->elements, i);
- BT_LOGV("Serializing sequence field's element field: "
+ BT_LOGT("Serializing sequence field's element field: "
"ser-offset=%" PRIu64 ", field-addr=%p, index=%" PRId64,
bt_ctfser_get_offset_in_current_packet_bits(ctfser),
elem_field, i);
ret = bt_ctf_field_serialize_recursive(
(void *) elem_field, ctfser, native_byte_order);
- if (unlikely(ret)) {
+ if (G_UNLIKELY(ret)) {
BT_LOGW("Cannot serialize sequence field's element field: "
"sequence-field-addr=%p, field-addr=%p, "
"index=%" PRId64, field, elem_field, i);
struct bt_ctf_field_common_string *string = BT_CTF_FROM_COMMON(field);
BT_CTF_ASSERT_PRE_CTF_FIELD_COMMON_IS_SET(field, "String field");
- BT_LOGV("Serializing string field: addr=%p, native-bo=%s",
+ BT_LOGT("Serializing string field: addr=%p, native-bo=%s",
field, bt_ctf_byte_order_string((int) native_byte_order));
ret = bt_ctfser_write_string(ctfser, (const char *) string->buf->data);
- if (unlikely(ret)) {
+ if (G_UNLIKELY(ret)) {
BT_LOGE("Cannot serialize string field: ret=%d", ret);
goto end;
}
return ret;
}
+BT_EXPORT
struct bt_ctf_field *bt_ctf_field_create(struct bt_ctf_field_type *type)
{
struct bt_ctf_field *field = NULL;
enum bt_ctf_field_type_id type_id;
BT_CTF_ASSERT_PRE_NON_NULL(type, "Field type");
- BT_ASSERT(field_type_common_has_known_id((void *) type));
+ BT_ASSERT_DBG(field_type_common_has_known_id((void *) type));
BT_CTF_ASSERT_PRE(bt_ctf_field_type_common_validate((void *) type) == 0,
"Field type is invalid: ft-addr=%p", type);
type_id = bt_ctf_field_type_get_type_id(type);
return field;
}
+BT_EXPORT
struct bt_ctf_field_type *bt_ctf_field_get_type(struct bt_ctf_field *field)
{
return bt_ctf_object_get_ref(bt_ctf_field_common_borrow_type((void *) field));
}
+BT_EXPORT
enum bt_ctf_field_type_id bt_ctf_field_get_type_id(struct bt_ctf_field *field)
{
struct bt_ctf_field_common *field_common = (void *) field;
return (int) field_common->type->id;
}
+BT_EXPORT
int bt_ctf_field_sequence_set_length(struct bt_ctf_field *field,
struct bt_ctf_field *length_field)
{
}
ret = bt_ctf_field_integer_unsigned_get_value(length_field, &length);
- BT_ASSERT(ret == 0);
+ BT_ASSERT_DBG(ret == 0);
return bt_ctf_field_common_sequence_set_length((void *) field,
length, (bt_ctf_field_common_create_func) bt_ctf_field_create);
}
+BT_EXPORT
struct bt_ctf_field *bt_ctf_field_structure_get_field_by_index(
struct bt_ctf_field *field, uint64_t index)
{
(void *) field, index));
}
+BT_EXPORT
struct bt_ctf_field *bt_ctf_field_structure_get_field_by_name(
struct bt_ctf_field *field, const char *name)
{
(void *) field, name));
}
+BT_EXPORT
struct bt_ctf_field *bt_ctf_field_array_get_field(
struct bt_ctf_field *field, uint64_t index)
{
bt_ctf_field_common_array_borrow_field((void *) field, index));
}
+BT_EXPORT
struct bt_ctf_field *bt_ctf_field_sequence_get_field(
struct bt_ctf_field *field, uint64_t index)
{
bt_ctf_field_common_sequence_borrow_field((void *) field, index));
}
+BT_EXPORT
struct bt_ctf_field *bt_ctf_field_variant_get_field(struct bt_ctf_field *field,
struct bt_ctf_field *tag_field)
{
struct bt_ctf_field_type_common_variant *variant_ft;
struct bt_ctf_field_type_common_enumeration *tag_ft;
struct bt_ctf_field *current_field = NULL;
- bt_bool is_signed;
+ bt_ctf_bool is_signed;
uint64_t tag_uval;
int ret;
(void *) enum_field->container, &tag_uval);
}
- BT_ASSERT(ret == 0);
+ BT_ASSERT_DBG(ret == 0);
ret = bt_ctf_field_common_variant_set_tag((void *) field, tag_uval,
is_signed);
if (ret) {
bt_ctf_object_put_ref(variant_field->tag);
variant_field->tag = bt_ctf_object_get_ref(tag_field);
current_field = bt_ctf_field_variant_get_current_field(field);
- BT_ASSERT(current_field);
+ BT_ASSERT_DBG(current_field);
end:
return current_field;
}
+BT_EXPORT
struct bt_ctf_field *bt_ctf_field_variant_get_current_field(
struct bt_ctf_field *variant_field)
{
(void *) variant_field));
}
-BT_HIDDEN
struct bt_ctf_field *bt_ctf_field_enumeration_borrow_container(
struct bt_ctf_field *field)
{
BT_CTF_ASSERT_PRE_NON_NULL(field, "Enumeration field");
BT_CTF_ASSERT_PRE_CTF_FIELD_COMMON_HAS_TYPE_ID((struct bt_ctf_field_common *) field,
BT_CTF_FIELD_TYPE_ID_ENUM, "Field");
- BT_ASSERT(enumeration->container);
+ BT_ASSERT_DBG(enumeration->container);
return (void *) enumeration->container;
}
+BT_EXPORT
struct bt_ctf_field *bt_ctf_field_enumeration_get_container(
struct bt_ctf_field *field)
{
return bt_ctf_object_get_ref(bt_ctf_field_enumeration_borrow_container(field));
}
+BT_EXPORT
int bt_ctf_field_integer_signed_get_value(struct bt_ctf_field *field,
int64_t *value)
{
return 0;
}
+BT_EXPORT
int bt_ctf_field_integer_signed_set_value(struct bt_ctf_field *field,
int64_t value)
{
return ret;
}
+BT_EXPORT
int bt_ctf_field_integer_unsigned_get_value(struct bt_ctf_field *field,
uint64_t *value)
{
return 0;
}
+BT_EXPORT
int bt_ctf_field_integer_unsigned_set_value(struct bt_ctf_field *field,
uint64_t value)
{
return 0;
}
+BT_EXPORT
int bt_ctf_field_floating_point_get_value(struct bt_ctf_field *field,
double *value)
{
return bt_ctf_field_common_floating_point_get_value((void *) field, value);
}
+BT_EXPORT
int bt_ctf_field_floating_point_set_value(struct bt_ctf_field *field,
double value)
{
return bt_ctf_field_common_floating_point_set_value((void *) field, value);
}
+BT_EXPORT
const char *bt_ctf_field_string_get_value(struct bt_ctf_field *field)
{
return bt_ctf_field_common_string_get_value((void *) field);
}
+BT_EXPORT
int bt_ctf_field_string_set_value(struct bt_ctf_field *field, const char *value)
{
return bt_ctf_field_common_string_set_value((void *) field, value);
}
+BT_EXPORT
int bt_ctf_field_string_append(struct bt_ctf_field *field, const char *value)
{
return bt_ctf_field_common_string_append((void *) field, value);
}
+BT_EXPORT
int bt_ctf_field_string_append_len(struct bt_ctf_field *field,
const char *value, unsigned int length)
{
return bt_ctf_field_common_string_append_len((void *) field, value, length);
}
+BT_EXPORT
struct bt_ctf_field *bt_ctf_field_copy(struct bt_ctf_field *field)
{
return (void *) bt_ctf_field_common_copy((void *) field);
int ret;
BT_LOGD("Creating CTF writer array field object: ft-addr=%p", type);
- BT_ASSERT(type);
+ BT_ASSERT_DBG(type);
if (!array) {
BT_LOGE_STR("Failed to allocate one array field.");
}
static
-bt_bool bt_ctf_field_enumeration_is_set_recursive(struct bt_ctf_field_common *field)
+bt_ctf_bool bt_ctf_field_enumeration_is_set_recursive(struct bt_ctf_field_common *field)
{
- bt_bool is_set = BT_FALSE;
+ bt_ctf_bool is_set = BT_CTF_FALSE;
struct bt_ctf_field_enumeration *enumeration = (void *) field;
if (enumeration->container) {
}
static
-bt_bool bt_ctf_field_variant_is_set_recursive(struct bt_ctf_field_common *field)
+bt_ctf_bool bt_ctf_field_variant_is_set_recursive(struct bt_ctf_field_common *field)
{
- bt_bool is_set;
+ bt_ctf_bool is_set;
struct bt_ctf_field_variant *variant = (void *) field;
if (variant->tag) {
return ret;
}
-BT_HIDDEN
int bt_ctf_field_structure_set_field_by_name(struct bt_ctf_field *field,
const char *name, struct bt_ctf_field *value)
{
if (!g_hash_table_lookup_extended(field_name_to_index,
GUINT_TO_POINTER(field_quark), NULL,
(gpointer *) &index)) {
- BT_LOGV("Invalid parameter: no such field in structure field's type: "
+ BT_LOGT("Invalid parameter: no such field in structure field's type: "
"struct-field-addr=%p, struct-ft-addr=%p, "
"field-ft-addr=%p, name=\"%s\"",
field, common_field->type, common_value->type, name);