lib: rename include dir to babeltrace2
[babeltrace.git] / lib / graph / iterator.c
index 11f17dcdea31d1e2b7371205ef362f39ec1f6fd4..aec91f114315dbe9eb83533588e92746988fc202 100644 (file)
  */
 
 #define BT_LOG_TAG "MSG-ITER"
-#include <babeltrace/lib-logging-internal.h>
-
-#include <babeltrace/compiler-internal.h>
-#include <babeltrace/trace-ir/clock-class-internal.h>
-#include <babeltrace/trace-ir/clock-snapshot-internal.h>
-#include <babeltrace/trace-ir/field.h>
-#include <babeltrace/trace-ir/event-const.h>
-#include <babeltrace/trace-ir/event-internal.h>
-#include <babeltrace/trace-ir/packet-const.h>
-#include <babeltrace/trace-ir/packet-internal.h>
-#include <babeltrace/trace-ir/stream-internal.h>
-#include <babeltrace/graph/connection-const.h>
-#include <babeltrace/graph/connection-internal.h>
-#include <babeltrace/graph/component-const.h>
-#include <babeltrace/graph/component-internal.h>
-#include <babeltrace/graph/component-source-internal.h>
-#include <babeltrace/graph/component-class-internal.h>
-#include <babeltrace/graph/component-class-sink-colander-internal.h>
-#include <babeltrace/graph/component-sink-const.h>
-#include <babeltrace/graph/component-sink-internal.h>
-#include <babeltrace/graph/message-const.h>
-#include <babeltrace/graph/message-iterator-const.h>
-#include <babeltrace/graph/message-iterator-internal.h>
-#include <babeltrace/graph/self-component-port-input-message-iterator.h>
-#include <babeltrace/graph/port-output-message-iterator.h>
-#include <babeltrace/graph/message-internal.h>
-#include <babeltrace/graph/message-event-const.h>
-#include <babeltrace/graph/message-event-internal.h>
-#include <babeltrace/graph/message-packet-beginning-const.h>
-#include <babeltrace/graph/message-packet-end-const.h>
-#include <babeltrace/graph/message-packet-internal.h>
-#include <babeltrace/graph/message-stream-beginning-const.h>
-#include <babeltrace/graph/message-stream-end-const.h>
-#include <babeltrace/graph/message-stream-internal.h>
-#include <babeltrace/graph/message-message-iterator-inactivity-internal.h>
-#include <babeltrace/graph/message-discarded-items-internal.h>
-#include <babeltrace/graph/message-stream-activity-internal.h>
-#include <babeltrace/graph/port-const.h>
-#include <babeltrace/graph/graph.h>
-#include <babeltrace/graph/graph-const.h>
-#include <babeltrace/graph/graph-internal.h>
-#include <babeltrace/types.h>
-#include <babeltrace/assert-internal.h>
-#include <babeltrace/assert-pre-internal.h>
+#include <babeltrace2/lib-logging-internal.h>
+
+#include <babeltrace2/compiler-internal.h>
+#include <babeltrace2/trace-ir/clock-class-internal.h>
+#include <babeltrace2/trace-ir/clock-snapshot-internal.h>
+#include <babeltrace2/trace-ir/field.h>
+#include <babeltrace2/trace-ir/event-const.h>
+#include <babeltrace2/trace-ir/event-internal.h>
+#include <babeltrace2/trace-ir/packet-const.h>
+#include <babeltrace2/trace-ir/packet-internal.h>
+#include <babeltrace2/trace-ir/stream-internal.h>
+#include <babeltrace2/graph/connection-const.h>
+#include <babeltrace2/graph/connection-internal.h>
+#include <babeltrace2/graph/component-const.h>
+#include <babeltrace2/graph/component-internal.h>
+#include <babeltrace2/graph/component-source-internal.h>
+#include <babeltrace2/graph/component-class-internal.h>
+#include <babeltrace2/graph/component-class-sink-colander-internal.h>
+#include <babeltrace2/graph/component-sink-const.h>
+#include <babeltrace2/graph/component-sink-internal.h>
+#include <babeltrace2/graph/message-const.h>
+#include <babeltrace2/graph/message-iterator-const.h>
+#include <babeltrace2/graph/message-iterator-internal.h>
+#include <babeltrace2/graph/self-component-port-input-message-iterator.h>
+#include <babeltrace2/graph/port-output-message-iterator.h>
+#include <babeltrace2/graph/message-internal.h>
+#include <babeltrace2/graph/message-event-const.h>
+#include <babeltrace2/graph/message-event-internal.h>
+#include <babeltrace2/graph/message-packet-beginning-const.h>
+#include <babeltrace2/graph/message-packet-end-const.h>
+#include <babeltrace2/graph/message-packet-internal.h>
+#include <babeltrace2/graph/message-stream-beginning-const.h>
+#include <babeltrace2/graph/message-stream-end-const.h>
+#include <babeltrace2/graph/message-stream-internal.h>
+#include <babeltrace2/graph/message-message-iterator-inactivity-internal.h>
+#include <babeltrace2/graph/message-discarded-items-internal.h>
+#include <babeltrace2/graph/message-stream-activity-internal.h>
+#include <babeltrace2/graph/port-const.h>
+#include <babeltrace2/graph/graph.h>
+#include <babeltrace2/graph/graph-const.h>
+#include <babeltrace2/graph/graph-internal.h>
+#include <babeltrace2/types.h>
+#include <babeltrace2/assert-internal.h>
+#include <babeltrace2/assert-pre-internal.h>
 #include <stdint.h>
 #include <inttypes.h>
 #include <stdlib.h>
@@ -84,7 +84,7 @@
                "Message iterator is in the wrong state: %!+i", _iter)
 
 static inline
-void _set_self_comp_port_input_msg_iterator_state(
+void set_self_comp_port_input_msg_iterator_state(
                struct bt_self_component_port_input_message_iterator *iterator,
                enum bt_self_component_port_input_message_iterator_state state)
 {
@@ -94,12 +94,6 @@ void _set_self_comp_port_input_msg_iterator_state(
        iterator->state = state;
 }
 
-#ifdef BT_DEV_MODE
-# define set_self_comp_port_input_msg_iterator_state _set_self_comp_port_input_msg_iterator_state
-#else
-# define set_self_comp_port_input_msg_iterator_state(_a, _b)
-#endif
-
 static
 void destroy_base_message_iterator(struct bt_object *obj)
 {
@@ -526,39 +520,6 @@ void bt_self_message_iterator_set_data(
                "%!+i, user-data-addr=%p", iterator, data);
 }
 
-BT_ASSERT_PRE_FUNC
-static inline
-void bt_message_borrow_packet_stream(const struct bt_message *msg,
-               const struct bt_stream **stream,
-               const struct bt_packet **packet)
-{
-       BT_ASSERT(msg);
-
-       switch (msg->type) {
-       case BT_MESSAGE_TYPE_EVENT:
-               *packet = bt_event_borrow_packet_const(
-                       bt_message_event_borrow_event_const(msg));
-               *stream = bt_packet_borrow_stream_const(*packet);
-               break;
-       case BT_MESSAGE_TYPE_STREAM_BEGINNING:
-               *stream = bt_message_stream_beginning_borrow_stream_const(msg);
-               break;
-       case BT_MESSAGE_TYPE_STREAM_END:
-               *stream = bt_message_stream_end_borrow_stream_const(msg);
-               break;
-       case BT_MESSAGE_TYPE_PACKET_BEGINNING:
-               *packet = bt_message_packet_beginning_borrow_packet_const(msg);
-               *stream = bt_packet_borrow_stream_const(*packet);
-               break;
-       case BT_MESSAGE_TYPE_PACKET_END:
-               *packet = bt_message_packet_end_borrow_packet_const(msg);
-               *stream = bt_packet_borrow_stream_const(*packet);
-               break;
-       default:
-               break;
-       }
-}
-
 enum bt_message_iterator_status
 bt_self_component_port_input_message_iterator_next(
                struct bt_self_component_port_input_message_iterator *iterator,
@@ -599,7 +560,6 @@ bt_self_component_port_input_message_iterator_next(
                goto end;
        }
 
-#ifdef BT_DEV_MODE
        /*
         * There is no way that this iterator could have been finalized
         * during its "next" method, as the only way to do this is to
@@ -611,7 +571,6 @@ bt_self_component_port_input_message_iterator_next(
         */
        BT_ASSERT(iterator->state ==
                BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE);
-#endif
 
        switch (status) {
        case BT_MESSAGE_ITERATOR_STATUS_OK:
@@ -824,11 +783,14 @@ bt_port_output_message_iterator_create(struct bt_graph *graph,
         */
        bt_graph_set_can_consume(iterator->graph, false);
 
-       /*
-        * Also set the graph as being configured: it has no active sink
-        * anyway, so we don't need to call bt_graph_configure().
-        */
-       graph->config_state = BT_GRAPH_CONFIGURATION_STATE_CONFIGURED;
+       /* Also set the graph as being configured. */
+       graph_status = bt_graph_configure(graph);
+       if (graph_status != BT_GRAPH_STATUS_OK) {
+               BT_LIB_LOGW("Cannot configure graph after having added colander: "
+                       "%![graph-]+g, status=%s", graph,
+                       bt_graph_status_string(graph_status));
+               goto error;
+       }
        goto end;
 
 error:
@@ -915,7 +877,7 @@ bt_bool bt_self_component_port_input_message_iterator_can_seek_beginning(
 }
 
 static inline
-void _set_iterator_state_after_seeking(
+void set_iterator_state_after_seeking(
                struct bt_self_component_port_input_message_iterator *iterator,
                enum bt_message_iterator_status status)
 {
@@ -943,12 +905,6 @@ void _set_iterator_state_after_seeking(
        set_self_comp_port_input_msg_iterator_state(iterator, new_state);
 }
 
-#ifdef BT_DEV_MODE
-# define set_iterator_state_after_seeking      _set_iterator_state_after_seeking
-#else
-# define set_iterator_state_after_seeking(_iter, _status)
-#endif
-
 enum bt_message_iterator_status
 bt_self_component_port_input_message_iterator_seek_beginning(
                struct bt_self_component_port_input_message_iterator *iterator)
@@ -1219,14 +1175,12 @@ enum bt_message_iterator_status find_message_ge_ns_from_origin(
                BT_LOGD("User method returned: status=%s",
                        bt_message_iterator_status_string(status));
 
-#ifdef BT_DEV_MODE
                /*
                 * The user's "next" method must not do any action which
                 * would change the iterator's state.
                 */
                BT_ASSERT(iterator->state ==
                        BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE);
-#endif
 
                switch (status) {
                case BT_MESSAGE_ITERATOR_STATUS_OK:
This page took 0.026905 seconds and 4 git commands to generate.