* Copyright 2019 Philippe Proulx <pproulx@efficios.com>
*/
+#include <string>
+
+#include <glib.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <babeltrace2/babeltrace.h>
+
#define BT_COMP_LOG_SELF_COMP (ctx->self_comp)
#define BT_LOG_OUTPUT_LEVEL (ctx->log_level)
#define BT_LOG_TAG "PLUGIN/SINK.CTF.FS/TRANSLATE-TRACE-IR-TO-CTF-IR"
#include "logging/comp-logging.h"
-#include "translate-trace-ir-to-ctf-ir.hpp"
-
-#include <babeltrace2/babeltrace.h>
-#include "common/macros.h"
-#include "common/common.h"
#include "common/assert.h"
-#include <stdio.h>
-#include <stdbool.h>
-#include <string.h>
-#include <glib.h>
+#include "common/common.h"
+#include "common/macros.h"
-#include "fs-sink.hpp"
#include "fs-sink-ctf-meta.hpp"
+#include "fs-sink.hpp"
+#include "translate-trace-ir-to-ctf-ir.hpp"
struct field_path_elem
{
static inline struct field_path_elem *cur_path_stack_at(struct ctx *ctx, uint64_t i)
{
BT_ASSERT(i < ctx->cur_path->len);
- return &g_array_index(ctx->cur_path, struct field_path_elem, i);
+ return &bt_g_array_index(ctx->cur_path, struct field_path_elem, i);
}
static inline struct field_path_elem *cur_path_stack_top(struct ctx *ctx)
return ret;
}
-BT_HIDDEN
int try_translate_event_class_trace_ir_to_ctf_ir(struct fs_sink_comp *fs_sink,
struct fs_sink_ctf_stream_class *sc,
const bt_event_class *ir_ec,
static void make_unique_default_clock_class_name(struct fs_sink_ctf_stream_class *sc)
{
unsigned int suffix = 0;
- char buf[16];
- g_string_assign(sc->default_clock_class_name, "");
- sprintf(buf, "default");
+ std::string name = "default";
- while (default_clock_class_name_exists(sc->trace, buf)) {
- sprintf(buf, "default%u", suffix);
+ while (default_clock_class_name_exists(sc->trace, name.c_str())) {
+ name = "default" + std::to_string(suffix);
suffix++;
}
- g_string_assign(sc->default_clock_class_name, buf);
+ g_string_assign(sc->default_clock_class_name, name.c_str());
}
static int translate_stream_class(struct fs_sink_comp *fs_sink, struct fs_sink_ctf_trace *trace,
return ret;
}
-BT_HIDDEN
int try_translate_stream_class_trace_ir_to_ctf_ir(struct fs_sink_comp *fs_sink,
struct fs_sink_ctf_trace *trace,
const bt_stream_class *ir_sc,
return ret;
}
-BT_HIDDEN
struct fs_sink_ctf_trace *translate_trace_trace_ir_to_ctf_ir(struct fs_sink_comp *fs_sink,
const bt_trace *ir_trace)
{