lib: pass config object to message iterator init method, add can seek forward property
[babeltrace.git] / src / lib / graph / iterator.c
index 983f5c100ab5d1a5482742bd080739589f90128c..8af6166a0dd47d5759219c2c4a1d96220a780ffe 100644 (file)
@@ -299,7 +299,7 @@ int create_self_component_input_port_message_iterator(
                struct bt_self_component_port_input_message_iterator **message_iterator)
 {
        typedef enum bt_component_class_message_iterator_init_method_status (*init_method_t)(
-                       void *, void *, void *);
+                       void *, void *, void *, void *);
 
        init_method_t init_method = NULL;
        struct bt_self_component_port_input_message_iterator *iterator =
@@ -472,7 +472,7 @@ int create_self_component_input_port_message_iterator(
                enum bt_component_class_message_iterator_init_method_status iter_status;
 
                BT_LIB_LOGD("Calling user's initialization method: %!+i", iterator);
-               iter_status = init_method(iterator, upstream_comp,
+               iter_status = init_method(iterator, &iterator->config, upstream_comp,
                        upstream_port);
                BT_LOGD("User method returned: status=%s",
                        bt_common_func_status_string(iter_status));
@@ -485,6 +485,8 @@ int create_self_component_input_port_message_iterator(
                        status = iter_status;
                        goto error;
                }
+
+               iterator->config.frozen = true;
        }
 
        if (downstream_msg_iter) {
@@ -561,6 +563,16 @@ void bt_self_message_iterator_set_data(
                "%!+i, user-data-addr=%p", iterator, data);
 }
 
+void bt_self_message_iterator_configuration_set_can_seek_forward(
+               bt_self_message_iterator_configuration *config,
+               bt_bool can_seek_forward)
+{
+       BT_ASSERT_PRE_NON_NULL(config, "Message iterator configuration");
+       BT_ASSERT_PRE_DEV_HOT(config, "Message iterator configuration", "");
+
+       config->can_seek_forward = can_seek_forward;
+}
+
 /*
  * Validate that the default clock snapshot in `msg` doesn't make us go back in
  * time.
@@ -1150,6 +1162,15 @@ bt_self_component_port_input_message_iterator_seek_beginning(
        return status;
 }
 
+bt_bool
+bt_self_component_port_input_message_iterator_can_seek_forward(
+               bt_self_component_port_input_message_iterator *iterator)
+{
+       BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
+
+       return iterator->config.can_seek_forward;
+}
+
 /*
  * Structure used to record the state of a given stream during the fast-forward
  * phase of an auto-seek.
This page took 0.024566 seconds and 4 git commands to generate.