#define BT_LOG_TAG "CTF-WRITER"
#include <babeltrace/lib-logging-internal.h>
+#include <babeltrace/assert-internal.h>
+#include <babeltrace/compat/uuid-internal.h>
+#include <babeltrace/compiler-internal.h>
#include <babeltrace/ctf-writer/clock-internal.h>
#include <babeltrace/ctf-writer/field-types-internal.h>
#include <babeltrace/ctf-writer/fields-internal.h>
#include <babeltrace/ctf-writer/stream-internal.h>
#include <babeltrace/ctf-writer/trace-internal.h>
#include <babeltrace/ctf-writer/writer-internal.h>
-#include <babeltrace/ref.h>
#include <babeltrace/endian-internal.h>
-#include <babeltrace/compiler-internal.h>
-#include <babeltrace/compat/uuid-internal.h>
-#include <babeltrace/assert-internal.h>
+#include <babeltrace/ctf-writer/object.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
-#include <errno.h>
#include <unistd.h>
-#include <fcntl.h>
-#include <inttypes.h>
static
-void bt_ctf_writer_destroy(struct bt_object *obj);
+void bt_ctf_writer_destroy(struct bt_ctf_object *obj);
static
int init_trace_packet_header(struct bt_ctf_trace *trace)
goto end;
}
end:
- bt_put(uuid_array_type);
- bt_put(_uint32_t);
- bt_put(_uint8_t);
- bt_put(trace_packet_header_type);
+ bt_ctf_object_put_ref(uuid_array_type);
+ bt_ctf_object_put_ref(_uint32_t);
+ bt_ctf_object_put_ref(_uint8_t);
+ bt_ctf_object_put_ref(trace_packet_header_type);
return ret;
}
metadata_path = g_build_filename(path, "metadata", NULL);
- bt_object_init_shared(&writer->base, bt_ctf_writer_destroy);
+ bt_ctf_object_init_shared(&writer->base, bt_ctf_writer_destroy);
writer->path = g_string_new(path);
if (!writer->path) {
goto error_destroy;
goto error_destroy;
}
- bt_object_set_parent(&writer->trace->common.base, &writer->base);
- bt_put(writer->trace);
+ bt_ctf_object_set_parent(&writer->trace->common.base, &writer->base);
+ bt_ctf_object_put_ref(writer->trace);
/* Default to little-endian */
ret = bt_ctf_writer_set_byte_order(writer, BT_CTF_BYTE_ORDER_NATIVE);
return writer;
error_destroy:
- BT_PUT(writer);
+ BT_CTF_OBJECT_PUT_REF_AND_RESET(writer);
error:
g_free(metadata_path);
return writer;
}
-void bt_ctf_writer_destroy(struct bt_object *obj)
+void bt_ctf_writer_destroy(struct bt_ctf_object *obj)
{
struct bt_ctf_writer *writer;
}
}
- bt_object_try_spec_release(&writer->trace->common.base);
+ bt_ctf_object_try_spec_release(&writer->trace->common.base);
g_free(writer);
}
}
trace = writer->trace;
- bt_get(trace);
+ bt_ctf_object_get_ref(trace);
end:
return trace;
}
stream_class_found = BT_TRUE;
}
- BT_PUT(existing_stream_class);
+ BT_CTF_OBJECT_PUT_REF_AND_RESET(existing_stream_class);
if (stream_class_found) {
break;
return stream;
error:
- BT_PUT(stream);
+ BT_CTF_OBJECT_PUT_REF_AND_RESET(stream);
return stream;
}
}
if (byte_order == BT_CTF_BYTE_ORDER_NATIVE) {
- byte_order = (int) BT_MY_BYTE_ORDER;
+ if (BYTE_ORDER == LITTLE_ENDIAN) {
+ byte_order = BT_CTF_BYTE_ORDER_LITTLE_ENDIAN;
+ } else {
+ byte_order = BT_CTF_BYTE_ORDER_BIG_ENDIAN;
+ }
}
ret = bt_ctf_trace_set_native_byte_order(writer->trace,
field_type = bt_ctf_field_type_integer_create(size);
ret = bt_ctf_field_type_set_alignment(field_type, alignment);
if (ret) {
- BT_PUT(field_type);
+ BT_CTF_OBJECT_PUT_REF_AND_RESET(field_type);
}
end:
return field_type;
}
BT_HIDDEN
-const char *get_byte_order_string(enum bt_byte_order byte_order)
+const char *bt_ctf_get_byte_order_string(enum bt_ctf_byte_order byte_order)
{
const char *string;
switch (byte_order) {
- case BT_BYTE_ORDER_LITTLE_ENDIAN:
+ case BT_CTF_BYTE_ORDER_LITTLE_ENDIAN:
string = "le";
break;
- case BT_BYTE_ORDER_BIG_ENDIAN:
+ case BT_CTF_BYTE_ORDER_BIG_ENDIAN:
string = "be";
break;
- case BT_BYTE_ORDER_NATIVE:
+ case BT_CTF_BYTE_ORDER_NATIVE:
string = "native";
break;
default: