CTF_ENCODING_UTF8,
};
+struct ctf_clock_class {
+ GString *name;
+ GString *description;
+ uint64_t frequency;
+ uint64_t precision;
+ int64_t offset_seconds;
+ uint64_t offset_cycles;
+ uint8_t uuid[16];
+ bool has_uuid;
+ bool is_absolute;
+
+ /* Weak, set during translation */
+ bt_clock_class *ir_cc;
+};
+
struct ctf_field_class {
enum ctf_field_class_type type;
unsigned int alignment;
bool in_ir;
/* Weak, set during translation. NULL if `in_ir` is false below. */
- struct bt_private_field_class *ir_fc;
+ bt_field_class *ir_fc;
};
struct ctf_field_class_bit_array {
struct ctf_field_class_bit_array base;
enum ctf_field_class_meaning meaning;
bool is_signed;
- enum bt_field_class_integer_preferred_display_base disp_base;
+ bt_field_class_integer_preferred_display_base disp_base;
enum ctf_encoding encoding;
int64_t storing_index;
- /* Owned by this */
- struct bt_private_clock_class *mapped_clock_class;
+ /* Weak */
+ struct ctf_clock_class *mapped_clock_class;
};
struct ctf_range {
};
struct ctf_field_path {
- enum bt_scope root;
+ bt_scope root;
/* Array of `int64_t` */
GArray *path;
GString *name;
uint64_t id;
GString *emf_uri;
- enum bt_event_class_log_level log_level;
+ bt_event_class_log_level log_level;
bool is_translated;
/* Owned by this */
struct ctf_field_class *payload_fc;
/* Weak, set during translation */
- struct bt_private_event_class *ir_ec;
+ bt_event_class *ir_ec;
};
struct ctf_stream_class {
*/
GHashTable *event_classes_by_id;
- /* Owned by this */
- struct bt_private_clock_class *default_clock_class;
+ /* Weak */
+ struct ctf_clock_class *default_clock_class;
/* Weak, set during translation */
- struct bt_private_stream_class *ir_sc;
+ bt_stream_class *ir_sc;
};
enum ctf_trace_class_env_entry_type {
};
struct ctf_trace_class {
- GString *name;
unsigned int major;
unsigned int minor;
uint8_t uuid[16];
uint64_t stored_value_count;
- /* Array of `struct bt_private_clock_class *` (owned by this) */
+ /* Array of `struct ctf_clock_class *` (owned by this) */
GPtrArray *clock_classes;
/* Array of `struct ctf_stream_class *` */
bool is_translated;
/* Weak, set during translation */
- struct bt_private_trace *ir_tc;
+ bt_trace_class *ir_tc;
};
static inline
void _ctf_field_class_int_destroy(struct ctf_field_class_int *fc)
{
BT_ASSERT(fc);
- bt_object_put_ref(fc->mapped_clock_class);
g_free(fc);
}
void _ctf_field_class_enum_destroy(struct ctf_field_class_enum *fc)
{
BT_ASSERT(fc);
- bt_object_put_ref(fc->base.mapped_clock_class);
if (fc->mappings) {
uint64_t i;
dst_fc->disp_base = src_fc->disp_base;
dst_fc->encoding = src_fc->encoding;
dst_fc->mapped_clock_class = src_fc->mapped_clock_class;
- bt_object_get_ref(dst_fc->mapped_clock_class);
dst_fc->storing_index = src_fc->storing_index;
}
ctf_field_class_destroy(sc->packet_context_fc);
ctf_field_class_destroy(sc->event_header_fc);
ctf_field_class_destroy(sc->event_common_context_fc);
- bt_object_put_ref(sc->default_clock_class);
g_free(sc);
}
}
}
+static inline
+struct ctf_clock_class *ctf_clock_class_create(void)
+{
+ struct ctf_clock_class *cc = g_new0(struct ctf_clock_class, 1);
+
+ BT_ASSERT(cc);
+ cc->name = g_string_new(NULL);
+ BT_ASSERT(cc->name);
+ cc->description = g_string_new(NULL);
+ BT_ASSERT(cc->description);
+ return cc;
+}
+
+static inline
+void ctf_clock_class_destroy(struct ctf_clock_class *cc)
+{
+ if (!cc) {
+ return;
+ }
+
+ if (cc->name) {
+ g_string_free(cc->name, TRUE);
+ }
+
+ if (cc->description) {
+ g_string_free(cc->description, TRUE);
+ }
+
+ bt_clock_class_put_ref(cc->ir_cc);
+ g_free(cc);
+}
+
static inline
struct ctf_trace_class *ctf_trace_class_create(void)
{
struct ctf_trace_class *tc = g_new0(struct ctf_trace_class, 1);
BT_ASSERT(tc);
- tc->name = g_string_new(NULL);
tc->default_byte_order = -1;
- BT_ASSERT(tc->name);
tc->clock_classes = g_ptr_array_new_with_free_func(
- (GDestroyNotify) bt_object_put_ref);
+ (GDestroyNotify) ctf_clock_class_destroy);
BT_ASSERT(tc->clock_classes);
tc->stream_classes = g_ptr_array_new_with_free_func(
(GDestroyNotify) ctf_stream_class_destroy);
return;
}
- if (tc->name) {
- g_string_free(tc->name, TRUE);
- }
-
ctf_field_class_destroy(tc->packet_header_fc);
if (tc->clock_classes) {
}
static inline
-struct bt_private_clock_class *ctf_trace_class_borrow_clock_class_by_name(
+struct ctf_clock_class *ctf_trace_class_borrow_clock_class_by_name(
struct ctf_trace_class *tc, const char *name)
{
uint64_t i;
- struct bt_private_clock_class *ret_cc = NULL;
+ struct ctf_clock_class *ret_cc = NULL;
BT_ASSERT(tc);
BT_ASSERT(name);
for (i = 0; i < tc->clock_classes->len; i++) {
- struct bt_private_clock_class *cc = tc->clock_classes->pdata[i];
- const char *cc_name = bt_clock_class_get_name(
- bt_private_clock_class_as_clock_class(cc));
+ struct ctf_clock_class *cc = tc->clock_classes->pdata[i];
- BT_ASSERT(cc_name);
- if (strcmp(cc_name, name) == 0) {
+ BT_ASSERT(cc->name);
+ if (strcmp(cc->name->str, name) == 0) {
ret_cc = cc;
goto end;
}