#include <babeltrace/ctf-writer/stream-class-internal.h>
#include <babeltrace/ctf-writer/trace-internal.h>
#include <babeltrace/ctf-writer/validation-internal.h>
-#include <babeltrace/ref.h>
+#include <babeltrace/object.h>
#include <babeltrace/values.h>
/*
}
/* Own the type parameters */
- bt_get(packet_header_type);
- bt_get(packet_context_type);
- bt_get(event_header_type);
- bt_get(stream_event_ctx_type);
- bt_get(event_context_type);
- bt_get(event_payload_type);
+ bt_object_get_ref(packet_header_type);
+ bt_object_get_ref(packet_context_type);
+ bt_object_get_ref(event_header_type);
+ bt_object_get_ref(stream_event_ctx_type);
+ bt_object_get_ref(event_context_type);
+ bt_object_get_ref(event_payload_type);
/* Validate trace */
if ((validate_flags & BT_CTF_VALIDATION_FLAG_TRACE) && !trace_valid) {
} else if (!contains_seq_var) {
/* No copy is needed */
packet_header_type_copy = packet_header_type;
- bt_get(packet_header_type_copy);
+ bt_object_get_ref(packet_header_type_copy);
goto skip_packet_header_type_copy;
}
skip_packet_header_type_copy:
/* Put original reference and move copy */
- BT_MOVE(packet_header_type, packet_header_type_copy);
+ BT_OBJECT_MOVE_REF(packet_header_type, packet_header_type_copy);
/* Validate trace field types */
valid_ret = validate_trace_types(environment,
} else if (!contains_seq_var) {
/* No copy is needed */
packet_context_type_copy = packet_context_type;
- bt_get(packet_context_type_copy);
+ bt_object_get_ref(packet_context_type_copy);
goto skip_packet_context_type_copy;
}
} else if (!contains_seq_var) {
/* No copy is needed */
event_header_type_copy = event_header_type;
- bt_get(event_header_type_copy);
+ bt_object_get_ref(event_header_type_copy);
goto skip_event_header_type_copy;
}
/* No copy is needed */
stream_event_ctx_type_copy =
stream_event_ctx_type;
- bt_get(stream_event_ctx_type_copy);
+ bt_object_get_ref(stream_event_ctx_type_copy);
goto skip_stream_event_ctx_type_copy;
}
skip_stream_event_ctx_type_copy:
/* Put original references and move copies */
- BT_MOVE(packet_context_type, packet_context_type_copy);
- BT_MOVE(event_header_type, event_header_type_copy);
- BT_MOVE(stream_event_ctx_type, stream_event_ctx_type_copy);
+ BT_OBJECT_MOVE_REF(packet_context_type, packet_context_type_copy);
+ BT_OBJECT_MOVE_REF(event_header_type, event_header_type_copy);
+ BT_OBJECT_MOVE_REF(stream_event_ctx_type, stream_event_ctx_type_copy);
/* Validate stream class field types */
valid_ret = validate_stream_class_types(environment,
goto sc_validation_done;
sc_validation_error:
- BT_PUT(packet_context_type_copy);
- BT_PUT(event_header_type_copy);
- BT_PUT(stream_event_ctx_type_copy);
+ BT_OBJECT_PUT_REF_AND_RESET(packet_context_type_copy);
+ BT_OBJECT_PUT_REF_AND_RESET(event_header_type_copy);
+ BT_OBJECT_PUT_REF_AND_RESET(stream_event_ctx_type_copy);
ret = -1;
goto error;
}
} else if (!contains_seq_var) {
/* No copy is needed */
event_context_type_copy = event_context_type;
- bt_get(event_context_type_copy);
+ bt_object_get_ref(event_context_type_copy);
goto skip_event_context_type_copy;
}
} else if (!contains_seq_var) {
/* No copy is needed */
event_payload_type_copy = event_payload_type;
- bt_get(event_payload_type_copy);
+ bt_object_get_ref(event_payload_type_copy);
goto skip_event_payload_type_copy;
}
skip_event_payload_type_copy:
/* Put original references and move copies */
- BT_MOVE(event_context_type, event_context_type_copy);
- BT_MOVE(event_payload_type, event_payload_type_copy);
+ BT_OBJECT_MOVE_REF(event_context_type, event_context_type_copy);
+ BT_OBJECT_MOVE_REF(event_payload_type, event_payload_type_copy);
/* Validate event class field types */
valid_ret = validate_event_class_types(environment,
goto ec_validation_done;
ec_validation_error:
- BT_PUT(event_context_type_copy);
- BT_PUT(event_payload_type_copy);
+ BT_OBJECT_PUT_REF_AND_RESET(event_context_type_copy);
+ BT_OBJECT_PUT_REF_AND_RESET(event_payload_type_copy);
ret = -1;
goto error;
}
* to validate (and that were possibly altered by the validation
* process) to the output values.
*/
- BT_MOVE(output->packet_header_type, packet_header_type);
- BT_MOVE(output->packet_context_type, packet_context_type);
- BT_MOVE(output->event_header_type, event_header_type);
- BT_MOVE(output->stream_event_ctx_type, stream_event_ctx_type);
- BT_MOVE(output->event_context_type, event_context_type);
- BT_MOVE(output->event_payload_type, event_payload_type);
+ BT_OBJECT_MOVE_REF(output->packet_header_type, packet_header_type);
+ BT_OBJECT_MOVE_REF(output->packet_context_type, packet_context_type);
+ BT_OBJECT_MOVE_REF(output->event_header_type, event_header_type);
+ BT_OBJECT_MOVE_REF(output->stream_event_ctx_type, stream_event_ctx_type);
+ BT_OBJECT_MOVE_REF(output->event_context_type, event_context_type);
+ BT_OBJECT_MOVE_REF(output->event_payload_type, event_payload_type);
return ret;
error:
- BT_PUT(packet_header_type);
- BT_PUT(packet_context_type);
- BT_PUT(event_header_type);
- BT_PUT(stream_event_ctx_type);
- BT_PUT(event_context_type);
- BT_PUT(event_payload_type);
+ BT_OBJECT_PUT_REF_AND_RESET(packet_header_type);
+ BT_OBJECT_PUT_REF_AND_RESET(packet_context_type);
+ BT_OBJECT_PUT_REF_AND_RESET(event_header_type);
+ BT_OBJECT_PUT_REF_AND_RESET(stream_event_ctx_type);
+ BT_OBJECT_PUT_REF_AND_RESET(event_context_type);
+ BT_OBJECT_PUT_REF_AND_RESET(event_payload_type);
return ret;
}
{
if ((replace_flags & BT_CTF_VALIDATION_FLAG_TRACE) && trace) {
bt_ctf_field_type_common_freeze(trace->packet_header_field_type);
- BT_MOVE(trace->packet_header_field_type,
+ BT_OBJECT_MOVE_REF(trace->packet_header_field_type,
output->packet_header_type);
}
bt_ctf_field_type_common_freeze(stream_class->packet_context_field_type);
bt_ctf_field_type_common_freeze(stream_class->event_header_field_type);
bt_ctf_field_type_common_freeze(stream_class->event_context_field_type);
- BT_MOVE(stream_class->packet_context_field_type,
+ BT_OBJECT_MOVE_REF(stream_class->packet_context_field_type,
output->packet_context_type);
- BT_MOVE(stream_class->event_header_field_type,
+ BT_OBJECT_MOVE_REF(stream_class->event_header_field_type,
output->event_header_type);
- BT_MOVE(stream_class->event_context_field_type,
+ BT_OBJECT_MOVE_REF(stream_class->event_context_field_type,
output->stream_event_ctx_type);
}
if ((replace_flags & BT_CTF_VALIDATION_FLAG_EVENT) && event_class) {
bt_ctf_field_type_common_freeze(event_class->context_field_type);
bt_ctf_field_type_common_freeze(event_class->payload_field_type);
- BT_MOVE(event_class->context_field_type, output->event_context_type);
- BT_MOVE(event_class->payload_field_type, output->event_payload_type);
+ BT_OBJECT_MOVE_REF(event_class->context_field_type, output->event_context_type);
+ BT_OBJECT_MOVE_REF(event_class->payload_field_type, output->event_payload_type);
}
}
void bt_ctf_validation_output_put_types(
struct bt_ctf_validation_output *output)
{
- BT_PUT(output->packet_header_type);
- BT_PUT(output->packet_context_type);
- BT_PUT(output->event_header_type);
- BT_PUT(output->stream_event_ctx_type);
- BT_PUT(output->event_context_type);
- BT_PUT(output->event_payload_type);
+ BT_OBJECT_PUT_REF_AND_RESET(output->packet_header_type);
+ BT_OBJECT_PUT_REF_AND_RESET(output->packet_context_type);
+ BT_OBJECT_PUT_REF_AND_RESET(output->event_header_type);
+ BT_OBJECT_PUT_REF_AND_RESET(output->stream_event_ctx_type);
+ BT_OBJECT_PUT_REF_AND_RESET(output->event_context_type);
+ BT_OBJECT_PUT_REF_AND_RESET(output->event_payload_type);
}