#include <babeltrace/assert-internal.h>
#include "ctfcopytrace.h"
-#include "clock-fields.h"
+#include "clock-field.h"
BT_HIDDEN
-const struct bt_clock_class *ctf_copy_clock_class(FILE *err,
- const struct bt_clock_class *clock_class)
+const bt_clock_class *ctf_copy_clock_class(FILE *err,
+ const bt_clock_class *clock_class)
{
int64_t offset, offset_s;
int int_ret;
uint64_t u64_ret;
const char *name, *description;
- const struct bt_clock_class *writer_clock_class = NULL;
+ const bt_clock_class *writer_clock_class = NULL;
BT_ASSERT(err && clock_class);
}
BT_HIDDEN
-enum bt_component_status ctf_copy_clock_classes(FILE *err,
- const struct bt_trace *writer_trace,
- const struct bt_stream_class *writer_stream_class,
- const struct bt_trace *trace)
+bt_component_status ctf_copy_clock_classes(FILE *err,
+ const bt_trace *writer_trace,
+ const bt_stream_class *writer_stream_class,
+ const bt_trace *trace)
{
- enum bt_component_status ret;
+ bt_component_status ret;
int int_ret, clock_class_count, i;
clock_class_count = bt_trace_get_clock_class_count(trace);
for (i = 0; i < clock_class_count; i++) {
- const struct bt_clock_class *writer_clock_class;
- const struct bt_clock_class *clock_class =
+ const bt_clock_class *writer_clock_class;
+ const bt_clock_class *clock_class =
bt_trace_get_clock_class_by_index(trace, i);
BT_ASSERT(clock_class);
writer_clock_class = ctf_copy_clock_class(err, clock_class);
- bt_object_put_ref(clock_class);
+ bt_clock_class_put_ref(clock_class);
if (!writer_clock_class) {
BT_LOGE_STR("Failed to copy clock class.");
ret = BT_COMPONENT_STATUS_ERROR;
int_ret = bt_trace_add_clock_class(writer_trace, writer_clock_class);
if (int_ret != 0) {
- BT_OBJECT_PUT_REF_AND_RESET(writer_clock_class);
+ BT_CLOCK_CLASS_PUT_REF_AND_RESET(writer_clock_class);
BT_LOGE_STR("Failed to add clock class.");
ret = BT_COMPONENT_STATUS_ERROR;
goto end;
/*
* Ownership transferred to the trace.
*/
- bt_object_put_ref(writer_clock_class);
+ bt_clock_class_put_ref(writer_clock_class);
}
ret = BT_COMPONENT_STATUS_OK;
}
static
-void replace_clock_classes(const struct bt_trace *trace_copy,
- struct bt_field_type *field_type)
+void replace_clock_classes(const bt_trace *trace_copy,
+ bt_field_type *field_type)
{
int ret;
switch (bt_field_type_get_type_id(field_type)) {
case BT_FIELD_TYPE_ID_INTEGER:
{
- const struct bt_clock_class *mapped_clock_class =
+ const bt_clock_class *mapped_clock_class =
bt_field_type_integer_get_mapped_clock_class(field_type);
- const struct bt_clock_class *clock_class_copy = NULL;
+ const bt_clock_class *clock_class_copy = NULL;
const char *name;
if (!mapped_clock_class) {
ret = bt_field_type_integer_set_mapped_clock_class(
field_type, clock_class_copy);
BT_ASSERT(ret == 0);
- bt_object_put_ref(mapped_clock_class);
- bt_object_put_ref(clock_class_copy);
+ bt_clock_class_put_ref(mapped_clock_class);
+ bt_clock_class_put_ref(clock_class_copy);
break;
}
case BT_FIELD_TYPE_ID_ENUM:
case BT_FIELD_TYPE_ID_ARRAY:
case BT_FIELD_TYPE_ID_SEQUENCE:
{
- struct bt_field_type *subtype = NULL;
+ bt_field_type *subtype = NULL;
switch (bt_field_type_get_type_id(field_type)) {
case BT_FIELD_TYPE_ID_ENUM:
for (i = 0; i < count; i++) {
const char *name;
- struct bt_field_type *member_type;
+ bt_field_type *member_type;
ret = bt_field_type_structure_get_field_by_index(
field_type, &name, &member_type, i);
for (i = 0; i < count; i++) {
const char *name;
- struct bt_field_type *member_type;
+ bt_field_type *member_type;
ret = bt_field_type_variant_get_field_by_index(
field_type, &name, &member_type, i);
}
BT_HIDDEN
-const struct bt_event_class *ctf_copy_event_class(FILE *err,
- const struct bt_trace *trace_copy,
- const struct bt_event_class *event_class)
+const bt_event_class *ctf_copy_event_class(FILE *err,
+ const bt_trace *trace_copy,
+ const bt_event_class *event_class)
{
- const struct bt_event_class *writer_event_class = NULL;
- struct bt_field_type *context = NULL, *payload_type = NULL;
+ const bt_event_class *writer_event_class = NULL;
+ bt_field_type *context = NULL, *payload_type = NULL;
const char *name;
int ret;
int64_t id;
- enum bt_event_class_log_level log_level;
+ bt_event_class_log_level log_level;
const char *emf_uri;
name = bt_event_class_get_name(event_class);
payload_type = bt_event_class_get_payload_type(event_class);
if (payload_type) {
- struct bt_field_type *ft_copy =
+ bt_field_type *ft_copy =
bt_field_type_copy(payload_type);
if (!ft_copy) {
context = bt_event_class_get_context_type(event_class);
if (context) {
- struct bt_field_type *ft_copy =
+ bt_field_type *ft_copy =
bt_field_type_copy(context);
if (!ft_copy) {
goto end;
error:
- BT_OBJECT_PUT_REF_AND_RESET(writer_event_class);
+ BT_EVENT_CLASS_PUT_REF_AND_RESET(writer_event_class);
end:
BT_OBJECT_PUT_REF_AND_RESET(context);
BT_OBJECT_PUT_REF_AND_RESET(payload_type);
}
BT_HIDDEN
-enum bt_component_status ctf_copy_event_classes(FILE *err,
- const struct bt_stream_class *stream_class,
- const struct bt_stream_class *writer_stream_class)
+bt_component_status ctf_copy_event_classes(FILE *err,
+ const bt_stream_class *stream_class,
+ const bt_stream_class *writer_stream_class)
{
- enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
- const struct bt_event_class *event_class = NULL, *writer_event_class = NULL;
+ bt_component_status ret = BT_COMPONENT_STATUS_OK;
+ const bt_event_class *event_class = NULL, *writer_event_class = NULL;
int count, i;
- const struct bt_trace *writer_trace =
+ const bt_trace *writer_trace =
bt_stream_class_get_trace(writer_stream_class);
BT_ASSERT(writer_trace);
* event_classes after a trace has become
* static.
*/
- BT_OBJECT_PUT_REF_AND_RESET(writer_event_class);
- BT_OBJECT_PUT_REF_AND_RESET(event_class);
+ BT_EVENT_CLASS_PUT_REF_AND_RESET(writer_event_class);
+ BT_EVENT_CLASS_PUT_REF_AND_RESET(event_class);
continue;
}
}
ret = BT_COMPONENT_STATUS_ERROR;
goto error;
}
- BT_OBJECT_PUT_REF_AND_RESET(writer_event_class);
- BT_OBJECT_PUT_REF_AND_RESET(event_class);
+ BT_EVENT_CLASS_PUT_REF_AND_RESET(writer_event_class);
+ BT_EVENT_CLASS_PUT_REF_AND_RESET(event_class);
}
goto end;
error:
- bt_object_put_ref(event_class);
- bt_object_put_ref(writer_event_class);
+ bt_event_class_put_ref(event_class);
+ bt_event_class_put_ref(writer_event_class);
end:
- bt_object_put_ref(writer_trace);
+ bt_trace_put_ref(writer_trace);
return ret;
}
BT_HIDDEN
-const struct bt_stream_class *ctf_copy_stream_class(FILE *err,
- const struct bt_stream_class *stream_class,
- const struct bt_trace *writer_trace,
+const bt_stream_class *ctf_copy_stream_class(FILE *err,
+ const bt_stream_class *stream_class,
+ const bt_trace *writer_trace,
bool override_ts64)
{
- struct bt_field_type *type = NULL;
- struct bt_field_type *type_copy = NULL;
- const struct bt_stream_class *writer_stream_class = NULL;
+ bt_field_type *type = NULL;
+ bt_field_type *type_copy = NULL;
+ const bt_stream_class *writer_stream_class = NULL;
int ret_int;
const char *name = bt_stream_class_get_name(stream_class);
ret_int = bt_trace_get_clock_class_count(writer_trace);
BT_ASSERT(ret_int >= 0);
if (override_ts64 && ret_int > 0) {
- struct bt_field_type *new_event_header_type;
+ bt_field_type *new_event_header_type;
new_event_header_type = override_header_type(err, type_copy,
writer_trace);
goto end;
error:
- BT_OBJECT_PUT_REF_AND_RESET(writer_stream_class);
+ BT_STREAM_CLASS_PUT_REF_AND_RESET(writer_stream_class);
end:
bt_object_put_ref(type);
bt_object_put_ref(type_copy);
}
BT_HIDDEN
-int ctf_stream_copy_packet_header(FILE *err, const struct bt_packet *packet,
- const struct bt_stream *writer_stream)
+int ctf_stream_copy_packet_header(FILE *err, const bt_packet *packet,
+ const bt_stream *writer_stream)
{
- const struct bt_field *packet_header = NULL, *writer_packet_header = NULL;
+ const bt_field *packet_header = NULL, *writer_packet_header = NULL;
int ret = 0;
packet_header = bt_packet_get_header(packet);
}
BT_HIDDEN
-int ctf_packet_copy_header(FILE *err, const struct bt_packet *packet,
- const struct bt_packet *writer_packet)
+int ctf_packet_copy_header(FILE *err, const bt_packet *packet,
+ const bt_packet *writer_packet)
{
- const struct bt_field *packet_header = NULL, *writer_packet_header = NULL;
+ const bt_field *packet_header = NULL, *writer_packet_header = NULL;
int ret = 0;
packet_header = bt_packet_get_header(packet);
}
BT_HIDDEN
-int ctf_stream_copy_packet_context(FILE *err, const struct bt_packet *packet,
- const struct bt_stream *writer_stream)
+int ctf_stream_copy_packet_context(FILE *err, const bt_packet *packet,
+ const bt_stream *writer_stream)
{
- const struct bt_field *packet_context = NULL, *writer_packet_context = NULL;
+ const bt_field *packet_context = NULL, *writer_packet_context = NULL;
int ret = 0;
packet_context = bt_packet_get_context(packet);
}
BT_HIDDEN
-int ctf_packet_copy_context(FILE *err, const struct bt_packet *packet,
- const struct bt_stream *writer_stream,
- const struct bt_packet *writer_packet)
+int ctf_packet_copy_context(FILE *err, const bt_packet *packet,
+ const bt_stream *writer_stream,
+ const bt_packet *writer_packet)
{
- const struct bt_field *packet_context = NULL, *writer_packet_context = NULL;
+ const bt_field *packet_context = NULL, *writer_packet_context = NULL;
int ret = 0;
packet_context = bt_packet_get_context(packet);
}
BT_HIDDEN
-int ctf_copy_event_header(FILE *err, const struct bt_event *event,
- const struct bt_event_class *writer_event_class,
- const struct bt_event *writer_event,
- const struct bt_field *event_header)
+int ctf_copy_event_header(FILE *err, const bt_event *event,
+ const bt_event_class *writer_event_class,
+ const bt_event *writer_event,
+ const bt_field *event_header)
{
- const struct bt_clock_class *clock_class = NULL, *writer_clock_class = NULL;
- struct bt_clock_value *clock_value = NULL, *writer_clock_value = NULL;
+ const bt_clock_class *clock_class = NULL, *writer_clock_class = NULL;
+ bt_clock_snapshot *clock_snapshot = NULL, *writer_clock_snapshot = NULL;
int ret;
- const struct bt_field *writer_event_header = NULL;
+ const bt_field *writer_event_header = NULL;
uint64_t value;
clock_class = event_get_clock_class(err, event);
goto error;
}
- clock_value = bt_event_get_clock_value(event, clock_class);
- BT_OBJECT_PUT_REF_AND_RESET(clock_class);
- BT_ASSERT(clock_value);
+ clock_snapshot = bt_event_get_clock_snapshot(event, clock_class);
+ BT_CLOCK_CLASS_PUT_REF_AND_RESET(clock_class);
+ BT_ASSERT(clock_snapshot);
- ret = bt_clock_value_get_value(clock_value, &value);
- BT_OBJECT_PUT_REF_AND_RESET(clock_value);
+ ret = bt_clock_snapshot_get_value(clock_snapshot, &value);
+ BT_OBJECT_PUT_REF_AND_RESET(clock_snapshot);
if (ret) {
BT_LOGE_STR("Failed to get clock value.");
goto error;
goto error;
}
- writer_clock_value = bt_clock_value_create(writer_clock_class, value);
- BT_OBJECT_PUT_REF_AND_RESET(writer_clock_class);
- if (!writer_clock_value) {
+ writer_clock_snapshot = bt_clock_snapshot_create(writer_clock_class, value);
+ BT_CLOCK_CLASS_PUT_REF_AND_RESET(writer_clock_class);
+ if (!writer_clock_snapshot) {
BT_LOGE_STR("Failed to create clock value.");
goto error;
}
- ret = bt_event_set_clock_value(writer_event, writer_clock_value);
- BT_OBJECT_PUT_REF_AND_RESET(writer_clock_value);
+ ret = bt_event_set_clock_snapshot(writer_event, writer_clock_snapshot);
+ BT_OBJECT_PUT_REF_AND_RESET(writer_clock_snapshot);
if (ret) {
BT_LOGE_STR("Failed to set clock value.");
goto error;
}
static
-const struct bt_trace *event_class_get_trace(FILE *err,
- const struct bt_event_class *event_class)
+const bt_trace *event_class_get_trace(FILE *err,
+ const bt_event_class *event_class)
{
- const struct bt_trace *trace = NULL;
- const struct bt_stream_class *stream_class = NULL;
+ const bt_trace *trace = NULL;
+ const bt_stream_class *stream_class = NULL;
stream_class = bt_event_class_get_stream_class(event_class);
BT_ASSERT(stream_class);
trace = bt_stream_class_get_trace(stream_class);
BT_ASSERT(trace);
- bt_object_put_ref(stream_class);
+ bt_stream_class_put_ref(stream_class);
return trace;
}
BT_HIDDEN
-const struct bt_event *ctf_copy_event(FILE *err, const struct bt_event *event,
- const struct bt_event_class *writer_event_class,
+const bt_event *ctf_copy_event(FILE *err, const bt_event *event,
+ const bt_event_class *writer_event_class,
bool override_ts64)
{
- const struct bt_event *writer_event = NULL;
- const struct bt_field *field = NULL, *copy_field = NULL;
- const struct bt_trace *writer_trace = NULL;
+ const bt_event *writer_event = NULL;
+ const bt_field *field = NULL, *copy_field = NULL;
+ const bt_trace *writer_trace = NULL;
int ret;
writer_event = bt_event_create(writer_event_class);
end:
bt_object_put_ref(field);
bt_object_put_ref(copy_field);
- bt_object_put_ref(writer_trace);
+ bt_trace_put_ref(writer_trace);
return writer_event;
}
BT_HIDDEN
-enum bt_component_status ctf_copy_trace(FILE *err, const struct bt_trace *trace,
- const struct bt_trace *writer_trace)
+bt_component_status ctf_copy_trace(FILE *err, const bt_trace *trace,
+ const bt_trace *writer_trace)
{
- enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
+ bt_component_status ret = BT_COMPONENT_STATUS_OK;
int field_count, i, int_ret;
- struct bt_field_type *header_type = NULL;
- enum bt_byte_order order;
+ bt_field_type *header_type = NULL;
+ bt_byte_order order;
const char *trace_name;
const unsigned char *trace_uuid;
for (i = 0; i < field_count; i++) {
int ret_int;
const char *name;
- struct bt_value *value = NULL;
+ bt_value *value = NULL;
name = bt_trace_get_environment_field_name_by_index(
trace, i);
ret_int = bt_trace_set_environment_field(writer_trace,
name, value);
- BT_OBJECT_PUT_REF_AND_RESET(value);
+ BT_VALUE_PUT_REF_AND_RESET(value);
if (ret_int < 0) {
BT_LOGE("Failed to set environment: field-name=\"%s\"",
name);