lib: create_packet_message(): use pool to determine beginning or end msg
[babeltrace.git] / lib / graph / message / stream-activity.c
index 79f4319e10cf2c2bccce1434259d04d4570de8b7..dbf88645ae0a29ff4ba76f3ddc90b20027328404 100644 (file)
@@ -48,6 +48,7 @@ void destroy_stream_activity_message(struct bt_object *obj)
 
        if (message->default_cs) {
                bt_clock_snapshot_recycle(message->default_cs);
+               message->default_cs = NULL;
        }
 
        g_free(message);
@@ -101,17 +102,17 @@ error:
 
 struct bt_message *bt_message_stream_activity_beginning_create(
                struct bt_self_message_iterator *self_msg_iter,
-               struct bt_stream *stream)
+               const struct bt_stream *stream)
 {
-       return create_stream_activity_message(self_msg_iter, stream,
+       return create_stream_activity_message(self_msg_iter, (void *) stream,
                BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING);
 }
 
 struct bt_message *bt_message_stream_activity_end_create(
                struct bt_self_message_iterator *self_msg_iter,
-               struct bt_stream *stream)
+               const struct bt_stream *stream)
 {
-       return create_stream_activity_message(self_msg_iter, stream,
+       return create_stream_activity_message(self_msg_iter, (void *) stream,
                BT_MESSAGE_TYPE_STREAM_ACTIVITY_END);
 }
 
@@ -268,3 +269,35 @@ void bt_message_stream_activity_end_set_default_clock_snapshot_state(
                BT_MESSAGE_TYPE_STREAM_ACTIVITY_END);
        set_stream_activity_message_default_clock_snapshot_state(msg, state);
 }
+
+static inline
+const struct bt_clock_class *
+borrow_stream_activity_message_stream_class_default_clock_class(
+               const struct bt_message *msg)
+{
+       struct bt_message_stream_activity *stream_act_msg = (void *) msg;
+
+       BT_ASSERT(msg);
+       return stream_act_msg->stream->class->default_clock_class;
+}
+
+const struct bt_clock_class *
+bt_message_stream_activity_beginning_borrow_stream_class_default_clock_class_const(
+               const struct bt_message *msg)
+{
+       BT_ASSERT_PRE_NON_NULL(msg, "Message");
+       BT_ASSERT_PRE_MSG_IS_TYPE(msg,
+               BT_MESSAGE_TYPE_STREAM_ACTIVITY_BEGINNING);
+       return borrow_stream_activity_message_stream_class_default_clock_class(
+               msg);
+}
+
+const struct bt_clock_class *
+bt_message_stream_activity_end_borrow_stream_class_default_clock_class_const(
+               const struct bt_message *msg)
+{
+       BT_ASSERT_PRE_NON_NULL(msg, "Message");
+       BT_ASSERT_PRE_MSG_IS_TYPE(msg, BT_MESSAGE_TYPE_STREAM_ACTIVITY_END);
+       return borrow_stream_activity_message_stream_class_default_clock_class(
+               msg);
+}
This page took 0.025979 seconds and 4 git commands to generate.