lib: create input port msg iterator from self {msg iterator, sink comp.}
[babeltrace.git] / src / lib / graph / message / iterator.h
index a174f3e9c17f99c4fb879c7db4c067c314250f5a..93d9aa23e122f81d8d0eef56c18bd07b7a3dc389 100644 (file)
 #include "lib/object.h"
 #include <babeltrace2/graph/connection-const.h>
 #include <babeltrace2/graph/message-const.h>
-#include <babeltrace2/graph/message-iterator-const.h>
 #include <babeltrace2/types.h>
 #include "common/assert.h"
 #include <stdbool.h>
+#include "common/uuid.h"
 
 struct bt_port;
 struct bt_graph;
@@ -76,15 +76,15 @@ struct bt_message_iterator {
        GPtrArray *msgs;
 };
 
-typedef enum bt_self_message_iterator_status
+typedef enum bt_component_class_message_iterator_next_method_status
 (*bt_self_component_port_input_message_iterator_next_method)(
                void *, bt_message_array_const, uint64_t, uint64_t *);
 
-typedef enum bt_self_message_iterator_status
+typedef enum bt_component_class_message_iterator_seek_ns_from_origin_method_status
 (*bt_self_component_port_input_message_iterator_seek_ns_from_origin_method)(
                void *, int64_t);
 
-typedef enum bt_self_message_iterator_status
+typedef enum bt_component_class_message_iterator_seek_beginning_method_status
 (*bt_self_component_port_input_message_iterator_seek_beginning_method)(
                void *);
 
@@ -103,6 +103,27 @@ struct bt_self_component_port_input_message_iterator {
        struct bt_connection *connection; /* Weak */
        struct bt_graph *graph; /* Weak */
 
+       /*
+        * Array of
+        * `struct bt_self_component_port_input_message_iterator *`
+        * (weak).
+        *
+        * This is an array of upstream message iterators on which this
+        * iterator depends. The references are weak: an upstream
+        * message iterator is responsible for removing its entry within
+        * this array on finalization/destruction.
+        */
+       GPtrArray *upstream_msg_iters;
+
+       /*
+        * Downstream message iterator which depends on this message
+        * iterator (weak).
+        *
+        * This can be `NULL` if this message iterator's owner is a sink
+        * component.
+        */
+       struct bt_self_component_port_input_message_iterator *downstream_msg_iter;
+
        struct {
                bt_self_component_port_input_message_iterator_next_method next;
                bt_self_component_port_input_message_iterator_seek_ns_from_origin_method seek_ns_from_origin;
@@ -113,6 +134,40 @@ struct bt_self_component_port_input_message_iterator {
 
        enum bt_self_component_port_input_message_iterator_state state;
 
+       /*
+        * Timestamp of the last received message (or INT64_MIN in the
+        * beginning, or after a seek to beginning).
+        */
+       int64_t last_ns_from_origin;
+
+       struct {
+               enum {
+                       /* We haven't recorded clock properties yet. */
+                       CLOCK_EXPECTATION_UNSET,
+
+                       /* Expect to have no clock. */
+                       CLOCK_EXPECTATION_NONE,
+
+                       /* Clock with origin_is_unix_epoch true.*/
+                       CLOCK_EXPECTATION_ORIGIN_UNIX,
+
+                       /* Clock with origin_is_unix_epoch false, with a UUID.*/
+                       CLOCK_EXPECTATION_ORIGIN_OTHER_UUID,
+
+                       /* Clock with origin_is_unix_epoch false, without a UUID.*/
+                       CLOCK_EXPECTATION_ORIGIN_OTHER_NO_UUID,
+               } type;
+
+               /*
+                * Expected UUID of the clock, if `type`is CLOCK_EXPECTATION_ORIGIN_OTHER_UUID.
+                *
+                * If the clock's origin is the unix epoch, the UUID is
+                * irrelevant (as the clock will be correlatable with other
+                * clocks having the same origin).
+                */
+               bt_uuid_t uuid;
+       } clock_expectation;
+
        /*
         * Data necessary for auto seek (the seek-to-beginning then fast-forward
         * seek strategy).
This page took 0.036082 seconds and 4 git commands to generate.