struct test_event {
enum test_event_type type;
- struct bt_stream *stream;
- struct bt_packet *packet;
+ const struct bt_stream *stream;
+ const struct bt_packet *packet;
};
static bool debug = false;
static enum test current_test;
static GArray *test_events;
static struct bt_private_graph *graph;
-static struct bt_private_stream_class *src_stream_class;
-static struct bt_private_event_class *src_event_class;
-static struct bt_private_stream *src_stream1;
-static struct bt_private_stream *src_stream2;
-static struct bt_private_packet *src_stream1_packet1;
-static struct bt_private_packet *src_stream1_packet2;
-static struct bt_private_packet *src_stream2_packet1;
-static struct bt_private_packet *src_stream2_packet2;
-static struct bt_stream *pub_src_stream1;
-static struct bt_stream *pub_src_stream2;
-static struct bt_packet *pub_src_stream1_packet1;
-static struct bt_packet *pub_src_stream1_packet2;
-static struct bt_packet *pub_src_stream2_packet1;
-static struct bt_packet *pub_src_stream2_packet2;
+static struct bt_stream_class *src_stream_class;
+static struct bt_event_class *src_event_class;
+static struct bt_stream *src_stream1;
+static struct bt_stream *src_stream2;
+static struct bt_packet *src_stream1_packet1;
+static struct bt_packet *src_stream1_packet2;
+static struct bt_packet *src_stream2_packet1;
+static struct bt_packet *src_stream2_packet2;
+static const struct bt_stream *pub_src_stream1;
+static const struct bt_stream *pub_src_stream2;
+static const struct bt_packet *pub_src_stream1_packet1;
+static const struct bt_packet *pub_src_stream1_packet2;
+static const struct bt_packet *pub_src_stream2_packet1;
+static const struct bt_packet *pub_src_stream2_packet2;
enum {
SEQ_END = -1,
static
void init_static_data(void)
{
- struct bt_private_trace *trace;
+ struct bt_trace *trace;
/* Test events */
test_events = g_array_new(FALSE, TRUE, sizeof(struct test_event));
BT_ASSERT(test_events);
/* Metadata */
- trace = bt_private_trace_create();
+ trace = bt_trace_create();
BT_ASSERT(trace);
- src_stream_class = bt_private_stream_class_create(trace);
+ src_stream_class = bt_stream_class_create(trace);
BT_ASSERT(src_stream_class);
- src_event_class = bt_private_event_class_create(src_stream_class);
+ src_event_class = bt_event_class_create(src_stream_class);
BT_ASSERT(src_event_class);
- src_stream1 = bt_private_stream_create(src_stream_class);
+ src_stream1 = bt_stream_create(src_stream_class);
BT_ASSERT(src_stream1);
- pub_src_stream1 = bt_private_stream_borrow_stream(src_stream1);
- src_stream2 = bt_private_stream_create(src_stream_class);
+ pub_src_stream1 = src_stream1;
+ src_stream2 = bt_stream_create(src_stream_class);
BT_ASSERT(src_stream2);
- pub_src_stream2 = bt_private_stream_borrow_stream(src_stream2);
- src_stream1_packet1 = bt_private_packet_create(src_stream1);
+ pub_src_stream2 = src_stream2;
+ src_stream1_packet1 = bt_packet_create(src_stream1);
BT_ASSERT(src_stream1_packet1);
- pub_src_stream1_packet1 = bt_private_packet_borrow_packet(
- src_stream1_packet1);
- src_stream1_packet2 = bt_private_packet_create(src_stream1);
+ pub_src_stream1_packet1 = src_stream1_packet1;
+ src_stream1_packet2 = bt_packet_create(src_stream1);
BT_ASSERT(src_stream1_packet2);
- pub_src_stream1_packet2 = bt_private_packet_borrow_packet(
- src_stream1_packet2);
- src_stream2_packet1 = bt_private_packet_create(src_stream2);
+ pub_src_stream1_packet2 = src_stream1_packet2;
+ src_stream2_packet1 = bt_packet_create(src_stream2);
BT_ASSERT(src_stream2_packet1);
- pub_src_stream2_packet1 = bt_private_packet_borrow_packet(
- src_stream2_packet1);
- src_stream2_packet2 = bt_private_packet_create(src_stream2);
+ pub_src_stream2_packet1 = src_stream2_packet1;
+ src_stream2_packet2 = bt_packet_create(src_stream2);
BT_ASSERT(src_stream2_packet2);
- pub_src_stream2_packet2 = bt_private_packet_borrow_packet(
- src_stream2_packet2);
+ pub_src_stream2_packet2 = src_stream2_packet2;
if (debug) {
fprintf(stderr, ":: stream 1: %p\n", src_stream1);
struct src_iter_user_data *user_data,
struct bt_notification **notif)
{
- struct bt_private_packet *event_packet = NULL;
+ struct bt_packet *event_packet = NULL;
switch (user_data->seq[user_data->at]) {
case SEQ_STREAM1_BEGIN:
- *notif = bt_private_notification_borrow_notification(
+ *notif = bt_private_notification_as_notification(
bt_private_notification_stream_begin_create(
notif_iter, src_stream1));
break;
case SEQ_STREAM2_BEGIN:
- *notif = bt_private_notification_borrow_notification(
+ *notif = bt_private_notification_as_notification(
bt_private_notification_stream_begin_create(
notif_iter, src_stream2));
break;
case SEQ_STREAM1_END:
- *notif = bt_private_notification_borrow_notification(
+ *notif = bt_private_notification_as_notification(
bt_private_notification_stream_end_create(
notif_iter, src_stream1));
break;
case SEQ_STREAM2_END:
- *notif = bt_private_notification_borrow_notification(
+ *notif = bt_private_notification_as_notification(
bt_private_notification_stream_end_create(
notif_iter, src_stream2));
break;
case SEQ_STREAM1_PACKET1_BEGIN:
- *notif = bt_private_notification_borrow_notification(
+ *notif = bt_private_notification_as_notification(
bt_private_notification_packet_begin_create(
notif_iter, src_stream1_packet1));
break;
case SEQ_STREAM1_PACKET2_BEGIN:
- *notif = bt_private_notification_borrow_notification(
+ *notif = bt_private_notification_as_notification(
bt_private_notification_packet_begin_create(
notif_iter, src_stream1_packet2));
break;
case SEQ_STREAM2_PACKET1_BEGIN:
- *notif = bt_private_notification_borrow_notification(
+ *notif = bt_private_notification_as_notification(
bt_private_notification_packet_begin_create(
notif_iter, src_stream2_packet1));
break;
case SEQ_STREAM2_PACKET2_BEGIN:
- *notif = bt_private_notification_borrow_notification(
+ *notif = bt_private_notification_as_notification(
bt_private_notification_packet_begin_create(
notif_iter, src_stream2_packet2));
break;
case SEQ_STREAM1_PACKET1_END:
- *notif = bt_private_notification_borrow_notification(
+ *notif = bt_private_notification_as_notification(
bt_private_notification_packet_end_create(
notif_iter, src_stream1_packet1));
break;
case SEQ_STREAM1_PACKET2_END:
- *notif = bt_private_notification_borrow_notification(
+ *notif = bt_private_notification_as_notification(
bt_private_notification_packet_end_create(
notif_iter, src_stream1_packet2));
break;
case SEQ_STREAM2_PACKET1_END:
- *notif = bt_private_notification_borrow_notification(
+ *notif = bt_private_notification_as_notification(
bt_private_notification_packet_end_create(
notif_iter, src_stream2_packet1));
break;
case SEQ_STREAM2_PACKET2_END:
- *notif = bt_private_notification_borrow_notification(
+ *notif = bt_private_notification_as_notification(
bt_private_notification_packet_end_create(
notif_iter, src_stream2_packet2));
break;
}
if (event_packet) {
- *notif = bt_private_notification_borrow_notification(
+ *notif = bt_private_notification_as_notification(
bt_private_notification_event_create(
notif_iter, src_event_class, event_packet));
}
static
enum bt_self_component_status src_init(
struct bt_self_component_source *self_comp,
- struct bt_value *params, void *init_method_data)
+ const struct bt_value *params, void *init_method_data)
{
int ret;
switch (bt_notification_get_type(notification)) {
case BT_NOTIFICATION_TYPE_EVENT:
{
- struct bt_event *event;
+ const struct bt_event *event;
test_event.type = TEST_EV_TYPE_NOTIF_EVENT;
event = bt_notification_event_borrow_event(notification);
BT_ASSERT(event);
- test_event.packet = bt_event_borrow_packet(event);
+ test_event.packet = bt_event_borrow_packet_const(event);
BT_ASSERT(test_event.packet);
break;
}
case BT_NOTIFICATION_TYPE_STREAM_BEGIN:
test_event.type = TEST_EV_TYPE_NOTIF_STREAM_BEGIN;
test_event.stream =
- bt_notification_stream_begin_borrow_stream(notification);
+ bt_notification_stream_begin_borrow_stream(
+ notification);
BT_ASSERT(test_event.stream);
break;
case BT_NOTIFICATION_TYPE_STREAM_END:
case BT_NOTIFICATION_TYPE_PACKET_BEGIN:
test_event.type = TEST_EV_TYPE_NOTIF_PACKET_BEGIN;
test_event.packet =
- bt_notification_packet_begin_borrow_packet(notification);
+ bt_notification_packet_begin_borrow_packet(
+ notification);
BT_ASSERT(test_event.packet);
break;
case BT_NOTIFICATION_TYPE_PACKET_END:
}
if (test_event.packet) {
- test_event.stream = bt_packet_borrow_stream(test_event.packet);
+ test_event.stream = bt_packet_borrow_stream_const(
+ test_event.packet);
BT_ASSERT(test_event.stream);
}
enum bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK;
struct sink_user_data *user_data =
bt_self_component_get_data(
- bt_self_component_sink_borrow_self_component(
+ bt_self_component_sink_as_self_component(
self_comp));
enum bt_notification_iterator_status it_ret;
{
struct sink_user_data *user_data =
bt_self_component_get_data(
- bt_self_component_sink_borrow_self_component(
+ bt_self_component_sink_as_self_component(
self_comp));
BT_ASSERT(user_data);
static
enum bt_self_component_status sink_init(
struct bt_self_component_sink *self_comp,
- struct bt_value *params, void *init_method_data)
+ const struct bt_value *params, void *init_method_data)
{
struct sink_user_data *user_data = g_new0(struct sink_user_data, 1);
int ret;
BT_ASSERT(user_data);
bt_self_component_set_data(
- bt_self_component_sink_borrow_self_component(self_comp),
+ bt_self_component_sink_as_self_component(self_comp),
user_data);
ret = bt_self_component_sink_add_input_port(
self_comp, "in", NULL, NULL);
{
struct sink_user_data *user_data =
bt_self_component_get_data(
- bt_self_component_sink_borrow_self_component(
+ bt_self_component_sink_as_self_component(
self_comp));
if (user_data) {
src_comp_class, src_iter_finalize);
BT_ASSERT(ret == 0);
ret = bt_private_graph_add_source_component(graph,
- bt_private_component_class_source_borrow_component_class_source(
+ bt_private_component_class_source_as_component_class_source(
src_comp_class), "source", NULL, source);
BT_ASSERT(ret == 0);
bt_object_put_ref(src_comp_class);
sink_comp_class, sink_port_connected);
BT_ASSERT(ret == 0);
ret = bt_private_graph_add_sink_component(graph,
- bt_private_component_class_sink_borrow_component_class_sink(
+ bt_private_component_class_sink_as_component_class_sink(
sink_comp_class),
"sink", NULL, sink);
BT_ASSERT(ret == 0);
upstream_port = bt_component_source_borrow_output_port_by_name(
src_comp, "out");
notif_iter = bt_port_output_notification_iterator_create(graph,
- upstream_port, NULL);
+ upstream_port);
ok(notif_iter, "bt_private_output_port_notification_iterator_create() succeeds");
/* Consume the notification iterator */