lib: simplify the public notification iterator interfaces
[babeltrace.git] / include / babeltrace / graph / notification-iterator-internal.h
index bf795a3a233c4662e61fa90346874eb6c8e61201..5cac60a621603691cf4d04364da16fb8fd5cdcc7 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef BABELTRACE_COMPONENT_NOTIFICATION_ITERATOR_INTERNAL_H
-#define BABELTRACE_COMPONENT_NOTIFICATION_ITERATOR_INTERNAL_H
+#ifndef BABELTRACE_GRAPH_NOTIFICATION_ITERATOR_INTERNAL_H
+#define BABELTRACE_GRAPH_NOTIFICATION_ITERATOR_INTERNAL_H
 
 /*
  * BabelTrace - Notification Iterator Internal
@@ -34,8 +34,8 @@
 #include <babeltrace/graph/notification-iterator.h>
 #include <babeltrace/graph/private-connection-private-notification-iterator.h>
 #include <babeltrace/types.h>
+#include <babeltrace/assert-internal.h>
 #include <stdbool.h>
-#include <assert.h>
 
 struct bt_port;
 struct bt_graph;
@@ -87,7 +87,6 @@ enum bt_private_connection_notification_iterator_state {
 struct bt_notification_iterator {
        struct bt_object base;
        enum bt_notification_iterator_type type;
-       struct bt_notification *current_notification; /* owned by this */
 };
 
 struct bt_notification_iterator_private_connection {
@@ -95,43 +94,28 @@ struct bt_notification_iterator_private_connection {
        struct bt_component *upstream_component; /* Weak */
        struct bt_port *upstream_port; /* Weak */
        struct bt_connection *connection; /* Weak */
-       GQueue *queue; /* struct bt_notification * (owned by this) */
+       struct bt_graph *graph; /* Weak */
 
        /*
         * This hash table keeps the state of a stream as viewed by
-        * this notification iterator. This is used to:
+        * this notification iterator. This is used to, in developer
+        * mode:
         *
         * * Automatically enqueue "stream begin", "packet begin",
         *   "packet end", and "stream end" notifications depending
         *   on the stream's state and on the next notification returned
         *   by the upstream component.
         *
-        * * Make sure that, once the notification iterator has seen
-        *   a "stream end" notification for a given stream, that no
-        *   other notifications which refer to this stream can be
-        *   delivered by this iterator.
+        * * Make sure that, once the notification iterator has seen a
+        *   "stream end" notification for a given stream, no other
+        *   notifications which refer to this stream can be delivered
+        *   by this iterator.
         *
-        * The key (struct bt_ctf_stream *) is not owned by this. The
+        * The key (struct bt_stream *) is not owned by this. The
         * value is an allocated state structure.
         */
        GHashTable *stream_states;
 
-       /*
-        * This is an array of actions which can be rolled back. It's
-        * similar to the memento pattern, but it's not exactly that. It
-        * is allocated once and reset for each notification to process.
-        * More details near the implementation.
-        */
-       GArray *actions;
-
-       /*
-        * This is a mask of notifications to which the user of this
-        * iterator is subscribed
-        * (see enum bt_private_connection_notification_iterator_notif_type
-        * above).
-        */
-       uint32_t subscription_mask;
-
        enum bt_private_connection_notification_iterator_state state;
        void *user_data;
 };
@@ -140,34 +124,10 @@ struct bt_notification_iterator_output_port {
        struct bt_notification_iterator base;
        struct bt_graph *graph; /* Owned by this */
        struct bt_component *colander; /* Owned by this */
-       struct bt_port *output_port; /* Owned by this */
-};
 
-static inline
-struct bt_notification *bt_notification_iterator_borrow_current_notification(
-               struct bt_notification_iterator *iterator)
-{
-       assert(iterator);
-       return iterator->current_notification;
-}
-
-static inline
-void bt_notification_iterator_replace_current_notification(
-               struct bt_notification_iterator *iterator,
-               struct bt_notification *notification)
-{
-       assert(iterator);
-       bt_put(iterator->current_notification);
-       iterator->current_notification = bt_get(notification);
-}
-
-static inline
-struct bt_notification_iterator_private_connection *
-bt_private_connection_notification_iterator_borrow_from_private(
-               struct bt_private_connection_private_notification_iterator *private_notification_iterator)
-{
-       return (void *) private_notification_iterator;
-}
+       /* Only used temporarily: should always be NULL */
+       struct bt_notification *notif;
+};
 
 static inline
 struct bt_private_connection_private_notification_iterator *
@@ -181,7 +141,6 @@ BT_HIDDEN
 enum bt_connection_status bt_private_connection_notification_iterator_create(
                struct bt_component *upstream_comp,
                struct bt_port *upstream_port,
-               const enum bt_notification_type *notification_types,
                struct bt_connection *connection,
                struct bt_notification_iterator_private_connection **iterator);
 
@@ -238,4 +197,4 @@ const char *bt_private_connection_notification_iterator_state_string(
        }
 };
 
-#endif /* BABELTRACE_COMPONENT_NOTIFICATION_ITERATOR_INTERNAL_H */
+#endif /* BABELTRACE_GRAPH_NOTIFICATION_ITERATOR_INTERNAL_H */
This page took 0.026191 seconds and 4 git commands to generate.