#include "ctf-meta-visitors.h"
static inline
-bt_field_class *ctf_field_class_to_ir(struct ctf_field_class *fc,
+bt_field_class *ctf_field_class_to_ir(bt_trace_class *ir_tc,
+ struct ctf_field_class *fc,
struct ctf_trace_class *tc,
struct ctf_stream_class *sc,
struct ctf_event_class *ec);
}
static inline
-bt_field_class *ctf_field_class_int_to_ir(
+bt_field_class *ctf_field_class_int_to_ir(bt_trace_class *ir_tc,
struct ctf_field_class_int *fc)
{
bt_field_class *ir_fc;
if (fc->is_signed) {
- ir_fc = bt_field_class_signed_integer_create();
+ ir_fc = bt_field_class_signed_integer_create(ir_tc);
} else {
- ir_fc = bt_field_class_unsigned_integer_create();
+ ir_fc = bt_field_class_unsigned_integer_create(ir_tc);
}
BT_ASSERT(ir_fc);
}
static inline
-bt_field_class *ctf_field_class_enum_to_ir(
+bt_field_class *ctf_field_class_enum_to_ir(bt_trace_class *ir_tc,
struct ctf_field_class_enum *fc)
{
int ret;
uint64_t i;
if (fc->base.is_signed) {
- ir_fc = bt_field_class_signed_enumeration_create();
+ ir_fc = bt_field_class_signed_enumeration_create(ir_tc);
} else {
- ir_fc = bt_field_class_unsigned_enumeration_create();
+ ir_fc = bt_field_class_unsigned_enumeration_create(ir_tc);
}
BT_ASSERT(ir_fc);
}
static inline
-bt_field_class *ctf_field_class_float_to_ir(
+bt_field_class *ctf_field_class_float_to_ir(bt_trace_class *ir_tc,
struct ctf_field_class_float *fc)
{
bt_field_class *ir_fc;
- ir_fc = bt_field_class_real_create();
+ ir_fc = bt_field_class_real_create(ir_tc);
BT_ASSERT(ir_fc);
if (fc->base.size == 32) {
}
static inline
-bt_field_class *ctf_field_class_string_to_ir(
+bt_field_class *ctf_field_class_string_to_ir(bt_trace_class *ir_tc,
struct ctf_field_class_string *fc)
{
- bt_field_class *ir_fc =
- bt_field_class_string_create();
+ bt_field_class *ir_fc = bt_field_class_string_create(ir_tc);
BT_ASSERT(ir_fc);
return ir_fc;
}
static inline
-bt_field_class *ctf_field_class_struct_to_ir(
+bt_field_class *ctf_field_class_struct_to_ir(bt_trace_class *ir_tc,
struct ctf_field_class_struct *fc,
struct ctf_trace_class *tc,
struct ctf_stream_class *sc,
struct ctf_event_class *ec)
{
int ret;
- bt_field_class *ir_fc =
- bt_field_class_structure_create();
+ bt_field_class *ir_fc = bt_field_class_structure_create(ir_tc);
uint64_t i;
BT_ASSERT(ir_fc);
continue;
}
- member_ir_fc = ctf_field_class_to_ir(named_fc->fc, tc, sc, ec);
+ member_ir_fc = ctf_field_class_to_ir(ir_tc, named_fc->fc,
+ tc, sc, ec);
BT_ASSERT(member_ir_fc);
ret = bt_field_class_structure_append_member(
ir_fc, named_fc->name->str, member_ir_fc);
}
static inline
-bt_field_class *borrow_ir_ft_from_field_path(
- struct ctf_field_path *field_path,
+bt_field_class *borrow_ir_ft_from_field_path(struct ctf_field_path *field_path,
struct ctf_trace_class *tc,
struct ctf_stream_class *sc,
struct ctf_event_class *ec)
}
static inline
-bt_field_class *ctf_field_class_variant_to_ir(
+bt_field_class *ctf_field_class_variant_to_ir(bt_trace_class *ir_tc,
struct ctf_field_class_variant *fc,
struct ctf_trace_class *tc,
struct ctf_stream_class *sc,
struct ctf_event_class *ec)
{
int ret;
- bt_field_class *ir_fc =
- bt_field_class_variant_create();
+ bt_field_class *ir_fc = bt_field_class_variant_create(ir_tc);
uint64_t i;
BT_ASSERT(ir_fc);
bt_field_class *option_ir_fc;
BT_ASSERT(named_fc->fc->in_ir);
- option_ir_fc = ctf_field_class_to_ir(named_fc->fc, tc, sc, ec);
+ option_ir_fc = ctf_field_class_to_ir(ir_tc, named_fc->fc,
+ tc, sc, ec);
BT_ASSERT(option_ir_fc);
ret = bt_field_class_variant_append_option(
ir_fc, named_fc->name->str, option_ir_fc);
}
static inline
-bt_field_class *ctf_field_class_array_to_ir(
+bt_field_class *ctf_field_class_array_to_ir(bt_trace_class *ir_tc,
struct ctf_field_class_array *fc,
struct ctf_trace_class *tc,
struct ctf_stream_class *sc,
bt_field_class *elem_ir_fc;
if (fc->base.is_text) {
- ir_fc = bt_field_class_string_create();
+ ir_fc = bt_field_class_string_create(ir_tc);
BT_ASSERT(ir_fc);
goto end;
}
- elem_ir_fc = ctf_field_class_to_ir(fc->base.elem_fc, tc, sc, ec);
+ elem_ir_fc = ctf_field_class_to_ir(ir_tc, fc->base.elem_fc, tc, sc, ec);
BT_ASSERT(elem_ir_fc);
- ir_fc = bt_field_class_static_array_create(elem_ir_fc,
+ ir_fc = bt_field_class_static_array_create(ir_tc, elem_ir_fc,
fc->length);
BT_ASSERT(ir_fc);
bt_field_class_put_ref(elem_ir_fc);
}
static inline
-bt_field_class *ctf_field_class_sequence_to_ir(
+bt_field_class *ctf_field_class_sequence_to_ir(bt_trace_class *ir_tc,
struct ctf_field_class_sequence *fc,
struct ctf_trace_class *tc,
struct ctf_stream_class *sc,
bt_field_class *elem_ir_fc;
if (fc->base.is_text) {
- ir_fc = bt_field_class_string_create();
+ ir_fc = bt_field_class_string_create(ir_tc);
BT_ASSERT(ir_fc);
goto end;
}
- elem_ir_fc = ctf_field_class_to_ir(fc->base.elem_fc, tc, sc, ec);
+ elem_ir_fc = ctf_field_class_to_ir(ir_tc, fc->base.elem_fc, tc, sc, ec);
BT_ASSERT(elem_ir_fc);
- ir_fc = bt_field_class_dynamic_array_create(elem_ir_fc);
+ ir_fc = bt_field_class_dynamic_array_create(ir_tc, elem_ir_fc);
BT_ASSERT(ir_fc);
bt_field_class_put_ref(elem_ir_fc);
BT_ASSERT(ir_fc);
}
static inline
-bt_field_class *ctf_field_class_to_ir(struct ctf_field_class *fc,
+bt_field_class *ctf_field_class_to_ir(bt_trace_class *ir_tc,
+ struct ctf_field_class *fc,
struct ctf_trace_class *tc,
struct ctf_stream_class *sc,
struct ctf_event_class *ec)
switch (fc->type) {
case CTF_FIELD_CLASS_TYPE_INT:
- ir_fc = ctf_field_class_int_to_ir((void *) fc);
+ ir_fc = ctf_field_class_int_to_ir(ir_tc, (void *) fc);
break;
case CTF_FIELD_CLASS_TYPE_ENUM:
- ir_fc = ctf_field_class_enum_to_ir((void *) fc);
+ ir_fc = ctf_field_class_enum_to_ir(ir_tc, (void *) fc);
break;
case CTF_FIELD_CLASS_TYPE_FLOAT:
- ir_fc = ctf_field_class_float_to_ir((void *) fc);
+ ir_fc = ctf_field_class_float_to_ir(ir_tc, (void *) fc);
break;
case CTF_FIELD_CLASS_TYPE_STRING:
- ir_fc = ctf_field_class_string_to_ir((void *) fc);
+ ir_fc = ctf_field_class_string_to_ir(ir_tc, (void *) fc);
break;
case CTF_FIELD_CLASS_TYPE_STRUCT:
- ir_fc = ctf_field_class_struct_to_ir((void *) fc, tc, sc, ec);
+ ir_fc = ctf_field_class_struct_to_ir(ir_tc, (void *) fc,
+ tc, sc, ec);
break;
case CTF_FIELD_CLASS_TYPE_ARRAY:
- ir_fc = ctf_field_class_array_to_ir((void *) fc, tc, sc, ec);
+ ir_fc = ctf_field_class_array_to_ir(ir_tc, (void *) fc,
+ tc, sc, ec);
break;
case CTF_FIELD_CLASS_TYPE_SEQUENCE:
- ir_fc = ctf_field_class_sequence_to_ir((void *) fc, tc, sc, ec);
+ ir_fc = ctf_field_class_sequence_to_ir(ir_tc, (void *) fc,
+ tc, sc, ec);
break;
case CTF_FIELD_CLASS_TYPE_VARIANT:
- ir_fc = ctf_field_class_variant_to_ir((void *) fc, tc, sc, ec);
+ ir_fc = ctf_field_class_variant_to_ir(ir_tc, (void *) fc,
+ tc, sc, ec);
break;
default:
abort();
}
static inline
-bt_field_class *scope_ctf_field_class_to_ir(struct ctf_field_class *fc,
- struct ctf_trace_class *tc,
- struct ctf_stream_class *sc,
- struct ctf_event_class *ec)
+bt_field_class *scope_ctf_field_class_to_ir(bt_trace_class *ir_tc,
+ struct ctf_field_class *fc,
+ struct ctf_trace_class *tc,
+ struct ctf_stream_class *sc,
+ struct ctf_event_class *ec)
{
bt_field_class *ir_fc = NULL;
goto end;
}
- ir_fc = ctf_field_class_to_ir(fc, tc, sc, ec);
+ ir_fc = ctf_field_class_to_ir(ir_tc, fc, tc, sc, ec);
end:
return ir_fc;
{
int ret;
bt_event_class *ir_ec = NULL;
+ bt_trace_class *ir_tc = bt_stream_class_borrow_trace_class(ir_sc);
if (ec->is_translated) {
ir_ec = bt_stream_class_borrow_event_class_by_id(
bt_event_class_put_ref(ir_ec);
if (ec->spec_context_fc) {
- bt_field_class *ir_fc = scope_ctf_field_class_to_ir(
+ bt_field_class *ir_fc = scope_ctf_field_class_to_ir(ir_tc,
ec->spec_context_fc, tc, sc, ec);
if (ir_fc) {
}
if (ec->payload_fc) {
- bt_field_class *ir_fc = scope_ctf_field_class_to_ir(
+ bt_field_class *ir_fc = scope_ctf_field_class_to_ir(ir_tc,
ec->payload_fc, tc, sc, ec);
if (ir_fc) {
bt_stream_class_put_ref(ir_sc);
if (sc->packet_context_fc) {
- bt_field_class *ir_fc = scope_ctf_field_class_to_ir(
+ bt_field_class *ir_fc = scope_ctf_field_class_to_ir(ir_tc,
sc->packet_context_fc, tc, sc, NULL);
if (ir_fc) {
}
if (sc->event_header_fc) {
- bt_field_class *ir_fc = scope_ctf_field_class_to_ir(
+ bt_field_class *ir_fc = scope_ctf_field_class_to_ir(ir_tc,
sc->event_header_fc, tc, sc, NULL);
if (ir_fc) {
}
if (sc->event_common_context_fc) {
- bt_field_class *ir_fc = scope_ctf_field_class_to_ir(
+ bt_field_class *ir_fc = scope_ctf_field_class_to_ir(ir_tc,
sc->event_common_context_fc, tc, sc, NULL);
if (ir_fc) {
bt_stream_class_set_assigns_automatic_stream_id(ir_sc, BT_FALSE);
if (sc->default_clock_class) {
+ BT_ASSERT(sc->default_clock_class->ir_cc);
ret = bt_stream_class_set_default_clock_class(ir_sc,
- sc->default_clock_class);
+ sc->default_clock_class->ir_cc);
BT_ASSERT(ret == 0);
}
"timestamp_begin");
if (int_fc) {
if (int_fc->meaning == CTF_FIELD_CLASS_MEANING_PACKET_BEGINNING_TIME) {
- bt_stream_class_set_packets_have_default_beginning_clock_value(
+ bt_stream_class_set_packets_have_default_beginning_clock_snapshot(
ir_sc, BT_TRUE);
}
}
"timestamp_end");
if (int_fc) {
if (int_fc->meaning == CTF_FIELD_CLASS_MEANING_PACKET_END_TIME) {
- bt_stream_class_set_packets_have_default_end_clock_value(
+ bt_stream_class_set_packets_have_default_end_clock_snapshot(
ir_sc, BT_TRUE);
}
}
}
static inline
-int ctf_trace_class_to_ir(bt_trace_class *ir_tc,
- struct ctf_trace_class *tc)
+void ctf_clock_class_to_ir(bt_clock_class *ir_cc, struct ctf_clock_class *cc)
+{
+ int ret;
+
+ if (strlen(cc->name->str) > 0) {
+ ret = bt_clock_class_set_name(ir_cc, cc->name->str);
+ BT_ASSERT(ret == 0);
+ }
+
+ if (strlen(cc->description->str) > 0) {
+ ret = bt_clock_class_set_description(ir_cc, cc->description->str);
+ BT_ASSERT(ret == 0);
+ }
+
+ bt_clock_class_set_frequency(ir_cc, cc->frequency);
+ bt_clock_class_set_precision(ir_cc, cc->precision);
+ bt_clock_class_set_offset(ir_cc, cc->offset_seconds, cc->offset_cycles);
+
+ if (cc->has_uuid) {
+ bt_clock_class_set_uuid(ir_cc, cc->uuid);
+ }
+
+ bt_clock_class_set_is_absolute(ir_cc, cc->is_absolute);
+}
+
+static inline
+int ctf_trace_class_to_ir(bt_trace_class *ir_tc, struct ctf_trace_class *tc)
{
int ret = 0;
uint64_t i;
}
if (tc->packet_header_fc) {
- bt_field_class *ir_fc = scope_ctf_field_class_to_ir(
+ bt_field_class *ir_fc = scope_ctf_field_class_to_ir(ir_tc,
tc->packet_header_fc, tc, NULL, NULL);
if (ir_fc) {
}
}
+ for (i = 0; i < tc->clock_classes->len; i++) {
+ struct ctf_clock_class *cc = tc->clock_classes->pdata[i];
+
+ cc->ir_cc = bt_clock_class_create(ir_tc);
+ ctf_clock_class_to_ir(cc->ir_cc, cc);
+ }
+
bt_trace_class_set_assigns_automatic_stream_class_id(ir_tc,
BT_FALSE);
tc->is_translated = true;