babeltrace2/graph/self-component-class-source.h \
babeltrace2/graph/self-component-class.h \
babeltrace2/graph/self-component-filter.h \
- babeltrace2/graph/self-component-port-input-message-iterator.h \
babeltrace2/graph/self-component-port-input.h \
babeltrace2/graph/self-component-port-output.h \
babeltrace2/graph/self-component-port.h \
/* Message iterator API */
#include <babeltrace2/graph/message-iterator.h>
-#include <babeltrace2/graph/self-component-port-input-message-iterator.h>
#include <babeltrace2/graph/self-message-iterator.h>
/* Message API */
typedef bt_graph_simple_sink_component_initialize_func_status
(*bt_graph_simple_sink_component_initialize_func)(
- bt_self_component_port_input_message_iterator *iterator,
+ bt_message_iterator *iterator,
void *data);
typedef enum bt_graph_simple_sink_component_consume_func_status {
typedef bt_graph_simple_sink_component_consume_func_status
(*bt_graph_simple_sink_component_consume_func)(
- bt_self_component_port_input_message_iterator *iterator,
+ bt_message_iterator *iterator,
void *data);
typedef void (*bt_graph_simple_sink_component_finalize_func)(void *data);
BT_MESSAGE_ITERATOR_CAN_SEEK_NS_FROM_ORIGIN_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
} bt_message_iterator_can_seek_ns_from_origin_status;
+typedef enum bt_message_iterator_create_from_message_iterator_status {
+ BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_message_iterator_create_from_message_iterator_status;
+
+typedef enum bt_message_iterator_create_from_sink_component_status {
+ BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK = __BT_FUNC_STATUS_OK,
+ BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
+ BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
+} bt_message_iterator_create_from_sink_component_status;
+
+static inline
+bt_message_iterator *
+bt_message_iterator_as_message_iterator(
+ bt_message_iterator *iterator)
+{
+ return __BT_UPCAST(bt_message_iterator, iterator);
+}
+
+extern bt_message_iterator_create_from_message_iterator_status
+bt_message_iterator_create_from_message_iterator(
+ bt_self_message_iterator *self_msg_iter,
+ bt_self_component_port_input *input_port,
+ bt_message_iterator **message_iterator);
+
+extern bt_message_iterator_create_from_sink_component_status
+bt_message_iterator_create_from_sink_component(
+ bt_self_component_sink *self_comp,
+ bt_self_component_port_input *input_port,
+ bt_message_iterator **message_iterator);
+
+extern bt_component *
+bt_message_iterator_borrow_component(
+ bt_message_iterator *iterator);
+
+extern bt_message_iterator_next_status
+bt_message_iterator_next(
+ bt_message_iterator *iterator,
+ bt_message_array_const *msgs, uint64_t *count);
+
+extern bt_message_iterator_can_seek_ns_from_origin_status
+bt_message_iterator_can_seek_ns_from_origin(
+ bt_message_iterator *iterator,
+ int64_t ns_from_origin, bt_bool *can_seek);
+
+extern bt_message_iterator_can_seek_beginning_status
+bt_message_iterator_can_seek_beginning(
+ bt_message_iterator *iterator,
+ bt_bool *can_seek);
+
+extern bt_message_iterator_seek_ns_from_origin_status
+bt_message_iterator_seek_ns_from_origin(
+ bt_message_iterator *iterator,
+ int64_t ns_from_origin);
+
+extern bt_message_iterator_seek_beginning_status
+bt_message_iterator_seek_beginning(
+ bt_message_iterator *iterator);
+
+extern bt_bool
+bt_message_iterator_can_seek_forward(
+ bt_message_iterator *iterator);
+
+extern void bt_message_iterator_get_ref(
+ const bt_message_iterator *message_iterator);
+
+extern void bt_message_iterator_put_ref(
+ const bt_message_iterator *message_iterator);
+
+#define BT_MESSAGE_ITERATOR_PUT_REF_AND_RESET(_var) \
+ do { \
+ bt_message_iterator_put_ref(_var); \
+ (_var) = NULL; \
+ } while (0)
+
+#define BT_MESSAGE_ITERATOR_MOVE_REF(_var_dst, _var_src) \
+ do { \
+ bt_message_iterator_put_ref(_var_dst); \
+ (_var_dst) = (_var_src); \
+ (_var_src) = NULL; \
+ } while (0)
+
#ifdef __cplusplus
}
#endif
+++ /dev/null
-#ifndef BABELTRACE2_GRAPH_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_H
-#define BABELTRACE2_GRAPH_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_H
-
-/*
- * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#ifndef __BT_IN_BABELTRACE_H
-# error "Please include <babeltrace2/babeltrace.h> instead."
-#endif
-
-#include <stdint.h>
-
-#include <babeltrace2/graph/message-iterator.h>
-#include <babeltrace2/types.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef enum bt_self_component_port_input_message_iterator_create_from_message_iterator_status {
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK = __BT_FUNC_STATUS_OK,
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
-} bt_self_component_port_input_message_iterator_create_from_message_iterator_status;
-
-typedef enum bt_self_component_port_input_message_iterator_create_from_sink_component_status {
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK = __BT_FUNC_STATUS_OK,
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
-} bt_self_component_port_input_message_iterator_create_from_sink_component_status;
-
-static inline
-bt_message_iterator *
-bt_self_component_port_input_message_iterator_as_message_iterator(
- bt_self_component_port_input_message_iterator *iterator)
-{
- return __BT_UPCAST(bt_message_iterator, iterator);
-}
-
-extern bt_self_component_port_input_message_iterator_create_from_message_iterator_status
-bt_self_component_port_input_message_iterator_create_from_message_iterator(
- bt_self_message_iterator *self_msg_iter,
- bt_self_component_port_input *input_port,
- bt_self_component_port_input_message_iterator **message_iterator);
-
-extern bt_self_component_port_input_message_iterator_create_from_sink_component_status
-bt_self_component_port_input_message_iterator_create_from_sink_component(
- bt_self_component_sink *self_comp,
- bt_self_component_port_input *input_port,
- bt_self_component_port_input_message_iterator **message_iterator);
-
-extern bt_component *
-bt_self_component_port_input_message_iterator_borrow_component(
- bt_self_component_port_input_message_iterator *iterator);
-
-extern bt_message_iterator_next_status
-bt_self_component_port_input_message_iterator_next(
- bt_self_component_port_input_message_iterator *iterator,
- bt_message_array_const *msgs, uint64_t *count);
-
-extern bt_message_iterator_can_seek_ns_from_origin_status
-bt_self_component_port_input_message_iterator_can_seek_ns_from_origin(
- bt_self_component_port_input_message_iterator *iterator,
- int64_t ns_from_origin, bt_bool *can_seek);
-
-extern bt_message_iterator_can_seek_beginning_status
-bt_self_component_port_input_message_iterator_can_seek_beginning(
- bt_self_component_port_input_message_iterator *iterator,
- bt_bool *can_seek);
-
-extern bt_message_iterator_seek_ns_from_origin_status
-bt_self_component_port_input_message_iterator_seek_ns_from_origin(
- bt_self_component_port_input_message_iterator *iterator,
- int64_t ns_from_origin);
-
-extern bt_message_iterator_seek_beginning_status
-bt_self_component_port_input_message_iterator_seek_beginning(
- bt_self_component_port_input_message_iterator *iterator);
-
-extern bt_bool
-bt_self_component_port_input_message_iterator_can_seek_forward(
- bt_self_component_port_input_message_iterator *iterator);
-
-extern void bt_self_component_port_input_message_iterator_get_ref(
- const bt_self_component_port_input_message_iterator *self_component_port_input_message_iterator);
-
-extern void bt_self_component_port_input_message_iterator_put_ref(
- const bt_self_component_port_input_message_iterator *self_component_port_input_message_iterator);
-
-#define BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_PUT_REF_AND_RESET(_var) \
- do { \
- bt_self_component_port_input_message_iterator_put_ref(_var); \
- (_var) = NULL; \
- } while (0)
-
-#define BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_MOVE_REF(_var_dst, _var_src) \
- do { \
- bt_self_component_port_input_message_iterator_put_ref(_var_dst); \
- (_var_dst) = (_var_src); \
- (_var_src) = NULL; \
- } while (0)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE2_GRAPH_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_H */
typedef struct bt_self_component_filter_configuration bt_self_component_filter_configuration;
typedef struct bt_self_component_port bt_self_component_port;
typedef struct bt_self_component_port_input bt_self_component_port_input;
-typedef struct bt_self_component_port_input_message_iterator bt_self_component_port_input_message_iterator;
+typedef struct bt_message_iterator bt_message_iterator;
typedef struct bt_self_component_port_output bt_self_component_port_output;
typedef struct bt_self_component_sink bt_self_component_sink;
typedef struct bt_self_component_sink_configuration bt_self_component_sink_configuration;
assert self_port_ptr
return bt2_port._UserComponentInputPort._create_from_ptr(self_port_ptr)
- def _create_input_port_message_iterator(self, input_port):
+ def _create_message_iterator(self, input_port):
utils._check_type(input_port, bt2_port._UserComponentInputPort)
(
status,
msg_iter_ptr,
- ) = native_bt.bt2_self_component_port_input_message_iterator_create_from_sink_component(
+ ) = native_bt.bt2_message_iterator_create_from_sink_component(
self._bt_ptr, input_port._ptr
)
utils._handle_func_status(status, 'cannot create message iterator object')
class _UserComponentInputPortMessageIterator(object._SharedObject, _MessageIterator):
- _get_ref = staticmethod(
- native_bt.self_component_port_input_message_iterator_get_ref
- )
- _put_ref = staticmethod(
- native_bt.self_component_port_input_message_iterator_put_ref
- )
+ _get_ref = staticmethod(native_bt.message_iterator_get_ref)
+ _put_ref = staticmethod(native_bt.message_iterator_put_ref)
def __init__(self, ptr):
self._current_msgs = []
return bt2_message._create_from_ptr(msg_ptr)
def can_seek_beginning(self):
- (
- status,
- res,
- ) = native_bt.self_component_port_input_message_iterator_can_seek_beginning(
- self._ptr
- )
+ (status, res) = native_bt.message_iterator_can_seek_beginning(self._ptr)
utils._handle_func_status(
status,
'cannot check whether or not message iterator can seek its beginning',
self._current_msgs.clear()
self._at = 0
- status = native_bt.self_component_port_input_message_iterator_seek_beginning(
- self._ptr
- )
+ status = native_bt.message_iterator_seek_beginning(self._ptr)
utils._handle_func_status(status, 'cannot seek message iterator beginning')
def can_seek_ns_from_origin(self, ns_from_origin):
utils._check_int64(ns_from_origin)
- (
- status,
- res,
- ) = native_bt.self_component_port_input_message_iterator_can_seek_ns_from_origin(
+ (status, res) = native_bt.message_iterator_can_seek_ns_from_origin(
self._ptr, ns_from_origin
)
utils._handle_func_status(
self._current_msgs.clear()
self._at = 0
- status = native_bt.self_component_port_input_message_iterator_seek_ns_from_origin(
+ status = native_bt.message_iterator_seek_ns_from_origin(
self._ptr, ns_from_origin
)
utils._handle_func_status(
@property
def can_seek_forward(self):
- return native_bt.self_component_port_input_message_iterator_can_seek_forward(
- self._ptr
- )
+ return native_bt.message_iterator_can_seek_forward(self._ptr)
class _MessageIteratorConfiguration:
def _bt_seek_ns_from_origin_from_native(self, ns_from_origin):
self._user_seek_ns_from_origin(ns_from_origin)
- def _create_input_port_message_iterator(self, input_port):
+ def _create_message_iterator(self, input_port):
utils._check_type(input_port, bt2_port._UserComponentInputPort)
(
status,
msg_iter_ptr,
- ) = native_bt.bt2_self_component_port_input_message_iterator_create_from_message_iterator(
+ ) = native_bt.bt2_message_iterator_create_from_message_iterator(
self._bt_ptr, input_port._ptr
)
utils._handle_func_status(status, 'cannot create message iterator object')
/* Output argument typemap for message_iterator (always appends) */
%typemap(in, numinputs=0)
- (bt_self_component_port_input_message_iterator **)
- (bt_self_component_port_input_message_iterator *temp_msg_iter = NULL) {
+ (bt_message_iterator **)
+ (bt_message_iterator *temp_msg_iter = NULL) {
$1 = &temp_msg_iter;
}
%typemap(argout)
- (bt_self_component_port_input_message_iterator **) {
+ (bt_message_iterator **) {
if (*$1) {
/* SWIG_Python_AppendOutput() steals the created object */
$result = SWIG_Python_AppendOutput($result,
SWIG_NewPointerObj(SWIG_as_voidptr(*$1),
- SWIGTYPE_p_bt_self_component_port_input_message_iterator, 0));
+ SWIGTYPE_p_bt_message_iterator, 0));
} else {
/* SWIG_Python_AppendOutput() steals Py_None */
Py_INCREF(Py_None);
}
%include <babeltrace2/graph/message-iterator.h>
-%include <babeltrace2/graph/self-component-port-input-message-iterator.h>
%include <babeltrace2/graph/self-message-iterator.h>
/* Helper functions for Python */
#include "native_bt_message_iterator.i.h"
%}
-bt_self_component_port_input_message_iterator_create_from_message_iterator_status
-bt_bt2_self_component_port_input_message_iterator_create_from_message_iterator(
+bt_message_iterator_create_from_message_iterator_status
+bt_bt2_message_iterator_create_from_message_iterator(
bt_self_message_iterator *self_msg_iter,
bt_self_component_port_input *input_port,
- bt_self_component_port_input_message_iterator **message_iterator);
-bt_self_component_port_input_message_iterator_create_from_sink_component_status
-bt_bt2_self_component_port_input_message_iterator_create_from_sink_component(
+ bt_message_iterator **message_iterator);
+bt_message_iterator_create_from_sink_component_status
+bt_bt2_message_iterator_create_from_sink_component(
bt_self_component_sink *self_comp,
bt_self_component_port_input *input_port,
- bt_self_component_port_input_message_iterator **message_iterator);
+ bt_message_iterator **message_iterator);
PyObject *bt_bt2_get_user_component_from_user_msg_iter(
bt_self_message_iterator *self_message_iterator);
PyObject *bt_bt2_self_component_port_input_get_msg_range(
- bt_self_component_port_input_message_iterator *iter);
+ bt_message_iterator *iter);
*/
static
-bt_self_component_port_input_message_iterator_create_from_message_iterator_status
-bt_bt2_self_component_port_input_message_iterator_create_from_message_iterator(
+bt_message_iterator_create_from_message_iterator_status
+bt_bt2_message_iterator_create_from_message_iterator(
bt_self_message_iterator *self_msg_iter,
bt_self_component_port_input *input_port,
- bt_self_component_port_input_message_iterator **message_iterator)
+ bt_message_iterator **message_iterator)
{
- bt_self_component_port_input_message_iterator_create_from_message_iterator_status
+ bt_message_iterator_create_from_message_iterator_status
status;
- status = bt_self_component_port_input_message_iterator_create_from_message_iterator(
+ status = bt_message_iterator_create_from_message_iterator(
self_msg_iter, input_port, message_iterator);
- if (status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK) {
+ if (status != BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK) {
*message_iterator = NULL;
}
}
static
-bt_self_component_port_input_message_iterator_create_from_sink_component_status
-bt_bt2_self_component_port_input_message_iterator_create_from_sink_component(
+bt_message_iterator_create_from_sink_component_status
+bt_bt2_message_iterator_create_from_sink_component(
bt_self_component_sink *self_comp,
bt_self_component_port_input *input_port,
- bt_self_component_port_input_message_iterator **message_iterator)
+ bt_message_iterator **message_iterator)
{
- bt_self_component_port_input_message_iterator_create_from_sink_component_status
+ bt_message_iterator_create_from_sink_component_status
status;
- status = bt_self_component_port_input_message_iterator_create_from_sink_component(
+ status = bt_message_iterator_create_from_sink_component(
self_comp, input_port, message_iterator);
- if (status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) {
+ if (status != BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) {
*message_iterator = NULL;
}
}
static PyObject *bt_bt2_self_component_port_input_get_msg_range(
- bt_self_component_port_input_message_iterator *iter)
+ bt_message_iterator *iter)
{
bt_message_array_const messages;
uint64_t message_count = 0;
bt_message_iterator_next_status status;
- status = bt_self_component_port_input_message_iterator_next(iter,
+ status = bt_message_iterator_next(iter,
&messages, &message_count);
return get_msg_range_common(status, messages, message_count);
}
self._add_input_port('in')
def _user_graph_is_configured(self):
- self._msg_iter = self._create_input_port_message_iterator(
- self._input_ports['in']
- )
+ self._msg_iter = self._create_message_iterator(self._input_ports['in'])
def _user_consume(self):
assert self._msg_list[0] is None
const char *file_name, uint64_t line_no)
{
struct bt_error_cause_message_iterator_actor *cause;
- struct bt_self_component_port_input_message_iterator *input_port_iter;
+ struct bt_message_iterator *input_port_iter;
int ret;
BT_LOGD_STR("Creating error cause object (message iterator actor).");
#include <babeltrace2/graph/component-class-sink.h>
#include <babeltrace2/graph/self-component-sink.h>
#include <babeltrace2/graph/self-component-port.h>
-#include <babeltrace2/graph/self-component-port-input-message-iterator.h>
#include <babeltrace2/graph/self-component.h>
#include <glib.h>
struct bt_component_class_sink *simple_comp_cls;
struct simple_sink_data {
- bt_self_component_port_input_message_iterator *msg_iter;
+ bt_message_iterator *msg_iter;
struct simple_sink_init_method_data init_method_data;
};
bt_self_component_sink *self_comp)
{
bt_component_class_sink_graph_is_configured_method_status status;
- bt_self_component_port_input_message_iterator_create_from_sink_component_status
+ bt_message_iterator_create_from_sink_component_status
msg_iter_status;
struct simple_sink_data *data = bt_self_component_get_data(
bt_self_component_sink_as_self_component(self_comp));
}
BT_ASSERT(data);
- msg_iter_status = bt_self_component_port_input_message_iterator_create_from_sink_component(
+ msg_iter_status = bt_message_iterator_create_from_sink_component(
self_comp, self_port, &data->msg_iter);
- if (msg_iter_status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) {
+ if (msg_iter_status != BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) {
BT_LIB_LOGE_APPEND_CAUSE(
"Cannot create input port message iterator: "
"%![comp-]+c, %![port-]+p", self_comp, self_port);
* which is on graph destruction.
*/
for (i = 0; i < conn->iterators->len; i++) {
- struct bt_self_component_port_input_message_iterator *iterator =
+ struct bt_message_iterator *iterator =
g_ptr_array_index(conn->iterators, i);
BT_LIB_LOGD("Finalizing message iterator created by "
"this ended connection: %![iter-]+i", iterator);
- bt_self_component_port_input_message_iterator_try_finalize(
+ bt_message_iterator_try_finalize(
iterator);
/*
* from this connection's iterators on destruction
* because this connection won't exist anymore.
*/
- bt_self_component_port_input_message_iterator_set_connection(
+ bt_message_iterator_set_connection(
iterator, NULL);
}
BT_HIDDEN
void bt_connection_remove_iterator(struct bt_connection *conn,
- struct bt_self_component_port_input_message_iterator *iterator)
+ struct bt_message_iterator *iterator)
{
g_ptr_array_remove(conn->iterators, iterator);
BT_LIB_LOGD("Removed message iterator from connection: "
BT_HIDDEN
void bt_connection_remove_iterator(struct bt_connection *conn,
- struct bt_self_component_port_input_message_iterator *iterator);
+ struct bt_message_iterator *iterator);
static inline
struct bt_graph *bt_connection_borrow_graph(struct bt_connection *conn)
#include <babeltrace2/graph/component-sink-const.h>
#include <babeltrace2/graph/message-const.h>
#include <babeltrace2/graph/message-iterator.h>
-#include <babeltrace2/graph/self-component-port-input-message-iterator.h>
#include <babeltrace2/graph/message-event-const.h>
#include <babeltrace2/graph/message-message-iterator-inactivity-const.h>
#include <babeltrace2/graph/message-packet-beginning.h>
#define MSG_BATCH_SIZE 15
#define BT_ASSERT_PRE_ITER_HAS_STATE_TO_SEEK(_iter) \
- BT_ASSERT_PRE((_iter)->state == BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE || \
- (_iter)->state == BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ENDED || \
- (_iter)->state == BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_AGAIN || \
- (_iter)->state == BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_ERROR, \
+ BT_ASSERT_PRE((_iter)->state == BT_MESSAGE_ITERATOR_STATE_ACTIVE || \
+ (_iter)->state == BT_MESSAGE_ITERATOR_STATE_ENDED || \
+ (_iter)->state == BT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_AGAIN || \
+ (_iter)->state == BT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_ERROR, \
"Message iterator is in the wrong state: %!+i", _iter)
static inline
-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)
+void set_msg_iterator_state(struct bt_message_iterator *iterator,
+ enum bt_message_iterator_state state)
{
BT_ASSERT_DBG(iterator);
BT_LIB_LOGD("Updating message iterator's state: new-state=%s",
- bt_self_component_port_input_message_iterator_state_string(state));
+ bt_message_iterator_state_string(state));
iterator->state = state;
}
static
-void bt_self_component_port_input_message_iterator_destroy(struct bt_object *obj)
+void bt_message_iterator_destroy(struct bt_object *obj)
{
- struct bt_self_component_port_input_message_iterator *iterator;
+ struct bt_message_iterator *iterator;
BT_ASSERT(obj);
iterator = (void *) obj;
BT_LIB_LOGI("Destroying self component input port message iterator object: "
"%!+i", iterator);
- bt_self_component_port_input_message_iterator_try_finalize(iterator);
+ bt_message_iterator_try_finalize(iterator);
if (iterator->connection) {
/*
}
BT_HIDDEN
-void bt_self_component_port_input_message_iterator_try_finalize(
- struct bt_self_component_port_input_message_iterator *iterator)
+void bt_message_iterator_try_finalize(
+ struct bt_message_iterator *iterator)
{
uint64_t i;
bool call_user_finalize = true;
BT_ASSERT(iterator);
switch (iterator->state) {
- case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_NON_INITIALIZED:
+ case BT_MESSAGE_ITERATOR_STATE_NON_INITIALIZED:
/*
* If this function is called while the iterator is in the
* NON_INITIALIZED state, it means the user initialization
*/
call_user_finalize = false;
break;
- case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZED:
+ case BT_MESSAGE_ITERATOR_STATE_FINALIZED:
/* Already finalized */
BT_LIB_LOGD("Not finalizing message iterator: already finalized: "
"%!+i", iterator);
goto end;
- case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZING:
+ case BT_MESSAGE_ITERATOR_STATE_FINALIZING:
/* Finalizing */
BT_LIB_LOGF("Message iterator is already being finalized: "
"%!+i", iterator);
}
BT_LIB_LOGD("Finalizing message iterator: %!+i", iterator);
- set_self_comp_port_input_msg_iterator_state(iterator,
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZING);
+ set_msg_iterator_state(iterator,
+ BT_MESSAGE_ITERATOR_STATE_FINALIZING);
BT_ASSERT(iterator->upstream_component);
/* Call user-defined destroy method */
/* Detach upstream message iterators */
for (i = 0; i < iterator->upstream_msg_iters->len; i++) {
- struct bt_self_component_port_input_message_iterator *upstream_msg_iter =
+ struct bt_message_iterator *upstream_msg_iter =
iterator->upstream_msg_iters->pdata[i];
upstream_msg_iter->downstream_msg_iter = NULL;
iterator->upstream_component = NULL;
iterator->upstream_port = NULL;
- set_self_comp_port_input_msg_iterator_state(iterator,
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZED);
+ set_msg_iterator_state(iterator,
+ BT_MESSAGE_ITERATOR_STATE_FINALIZED);
BT_LIB_LOGD("Finalized message iterator: %!+i", iterator);
end:
}
BT_HIDDEN
-void bt_self_component_port_input_message_iterator_set_connection(
- struct bt_self_component_port_input_message_iterator *iterator,
+void bt_message_iterator_set_connection(
+ struct bt_message_iterator *iterator,
struct bt_connection *connection)
{
BT_ASSERT(iterator);
static
enum bt_message_iterator_can_seek_beginning_status can_seek_ns_from_origin_true(
- struct bt_self_component_port_input_message_iterator *iterator,
+ struct bt_message_iterator *iterator,
int64_t ns_from_origin, bt_bool *can_seek)
{
*can_seek = BT_TRUE;
static
enum bt_message_iterator_can_seek_beginning_status can_seek_beginning_true(
- struct bt_self_component_port_input_message_iterator *iterator,
+ struct bt_message_iterator *iterator,
bt_bool *can_seek)
{
*can_seek = BT_TRUE;
int create_self_component_input_port_message_iterator(
struct bt_self_message_iterator *self_downstream_msg_iter,
struct bt_self_component_port_input *self_port,
- struct bt_self_component_port_input_message_iterator **message_iterator)
+ struct bt_message_iterator **message_iterator)
{
bt_message_iterator_class_initialize_method init_method = NULL;
- struct bt_self_component_port_input_message_iterator *iterator =
+ struct bt_message_iterator *iterator =
NULL;
- struct bt_self_component_port_input_message_iterator *downstream_msg_iter =
+ struct bt_message_iterator *downstream_msg_iter =
(void *) self_downstream_msg_iter;
struct bt_port *port = (void *) self_port;
struct bt_port *upstream_port;
BT_LIB_LOGI("Creating message iterator on self component input port: "
"%![up-comp-]+c, %![up-port-]+p", upstream_comp, upstream_port);
iterator = g_new0(
- struct bt_self_component_port_input_message_iterator, 1);
+ struct bt_message_iterator, 1);
if (!iterator) {
BT_LIB_LOGE_APPEND_CAUSE(
"Failed to allocate one self component input port "
}
bt_object_init_shared(&iterator->base,
- bt_self_component_port_input_message_iterator_destroy);
+ bt_message_iterator_destroy);
iterator->msgs = g_ptr_array_new();
if (!iterator->msgs) {
BT_LIB_LOGE_APPEND_CAUSE("Failed to allocate a GPtrArray.");
iterator->upstream_port = upstream_port;
iterator->connection = iterator->upstream_port->connection;
iterator->graph = bt_component_borrow_graph(upstream_comp);
- set_self_comp_port_input_msg_iterator_state(iterator,
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_NON_INITIALIZED);
+ set_msg_iterator_state(iterator,
+ BT_MESSAGE_ITERATOR_STATE_NON_INITIALIZED);
/* Copy methods from the message iterator class to the message iterator. */
BT_ASSERT(bt_component_class_has_message_iterator_class(upstream_comp_cls));
struct bt_component_class_with_iterator_class, parent);
iterator->methods.next =
- (bt_self_component_port_input_message_iterator_next_method)
+ (bt_message_iterator_next_method)
upstream_comp_cls_with_iter_cls->msg_iter_cls->methods.next;
iterator->methods.seek_ns_from_origin =
- (bt_self_component_port_input_message_iterator_seek_ns_from_origin_method)
+ (bt_message_iterator_seek_ns_from_origin_method)
upstream_comp_cls_with_iter_cls->msg_iter_cls->methods.seek_ns_from_origin;
iterator->methods.seek_beginning =
- (bt_self_component_port_input_message_iterator_seek_beginning_method)
+ (bt_message_iterator_seek_beginning_method)
upstream_comp_cls_with_iter_cls->msg_iter_cls->methods.seek_beginning;
iterator->methods.can_seek_ns_from_origin =
- (bt_self_component_port_input_message_iterator_can_seek_ns_from_origin_method)
+ (bt_message_iterator_can_seek_ns_from_origin_method)
upstream_comp_cls_with_iter_cls->msg_iter_cls->methods.can_seek_ns_from_origin;
iterator->methods.can_seek_beginning =
- (bt_self_component_port_input_message_iterator_can_seek_beginning_method)
+ (bt_message_iterator_can_seek_beginning_method)
upstream_comp_cls_with_iter_cls->msg_iter_cls->methods.can_seek_beginning;
if (iterator->methods.seek_ns_from_origin &&
!iterator->methods.can_seek_ns_from_origin) {
iterator->methods.can_seek_ns_from_origin =
- (bt_self_component_port_input_message_iterator_can_seek_ns_from_origin_method)
+ (bt_message_iterator_can_seek_ns_from_origin_method)
can_seek_ns_from_origin_true;
}
if (iterator->methods.seek_beginning &&
!iterator->methods.can_seek_beginning) {
iterator->methods.can_seek_beginning =
- (bt_self_component_port_input_message_iterator_can_seek_beginning_method)
+ (bt_message_iterator_can_seek_beginning_method)
can_seek_beginning_true;
}
iterator);
}
- set_self_comp_port_input_msg_iterator_state(iterator,
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE);
+ set_msg_iterator_state(iterator,
+ BT_MESSAGE_ITERATOR_STATE_ACTIVE);
g_ptr_array_add(port->connection->iterators, iterator);
BT_LIB_LOGI("Created message iterator on self component input port: "
"%![up-port-]+p, %![up-comp-]+c, %![iter-]+i",
return status;
}
-bt_self_component_port_input_message_iterator_create_from_message_iterator_status
-bt_self_component_port_input_message_iterator_create_from_message_iterator(
+bt_message_iterator_create_from_message_iterator_status
+bt_message_iterator_create_from_message_iterator(
struct bt_self_message_iterator *self_msg_iter,
struct bt_self_component_port_input *input_port,
- struct bt_self_component_port_input_message_iterator **message_iterator)
+ struct bt_message_iterator **message_iterator)
{
BT_ASSERT_PRE_NO_ERROR();
BT_ASSERT_PRE_NON_NULL(self_msg_iter, "Message iterator");
input_port, message_iterator);
}
-bt_self_component_port_input_message_iterator_create_from_sink_component_status
-bt_self_component_port_input_message_iterator_create_from_sink_component(
+bt_message_iterator_create_from_sink_component_status
+bt_message_iterator_create_from_sink_component(
struct bt_self_component_sink *self_comp,
struct bt_self_component_port_input *input_port,
- struct bt_self_component_port_input_message_iterator **message_iterator)
+ struct bt_message_iterator **message_iterator)
{
BT_ASSERT_PRE_NO_ERROR();
BT_ASSERT_PRE_NON_NULL(self_comp, "Sink component");
void *bt_self_message_iterator_get_data(
const struct bt_self_message_iterator *self_iterator)
{
- struct bt_self_component_port_input_message_iterator *iterator =
+ struct bt_message_iterator *iterator =
(void *) self_iterator;
BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator");
void bt_self_message_iterator_set_data(
struct bt_self_message_iterator *self_iterator, void *data)
{
- struct bt_self_component_port_input_message_iterator *iterator =
+ struct bt_message_iterator *iterator =
(void *) self_iterator;
BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator");
BT_ASSERT_POST_DEV_FUNC
static
bool clock_snapshots_are_monotonic_one(
- struct bt_self_component_port_input_message_iterator *iterator,
+ struct bt_message_iterator *iterator,
const bt_message *msg)
{
const struct bt_clock_snapshot *clock_snapshot = NULL;
BT_ASSERT_POST_DEV_FUNC
static
bool clock_snapshots_are_monotonic(
- struct bt_self_component_port_input_message_iterator *iterator,
+ struct bt_message_iterator *iterator,
bt_message_array_const msgs, uint64_t msg_count)
{
uint64_t i;
BT_ASSERT_POST_DEV_FUNC
static
-bool clock_classes_are_compatible_one(struct bt_self_component_port_input_message_iterator *iterator,
+bool clock_classes_are_compatible_one(struct bt_message_iterator *iterator,
const struct bt_message *msg)
{
enum bt_message_type message_type = bt_message_get_type(msg);
BT_ASSERT_POST_DEV_FUNC
static
bool clock_classes_are_compatible(
- struct bt_self_component_port_input_message_iterator *iterator,
+ struct bt_message_iterator *iterator,
bt_message_array_const msgs, uint64_t msg_count)
{
uint64_t i;
static
enum bt_message_iterator_class_next_method_status
call_iterator_next_method(
- struct bt_self_component_port_input_message_iterator *iterator,
+ struct bt_message_iterator *iterator,
bt_message_array_const msgs, uint64_t capacity, uint64_t *user_count)
{
enum bt_message_iterator_class_next_method_status status;
}
enum bt_message_iterator_next_status
-bt_self_component_port_input_message_iterator_next(
- struct bt_self_component_port_input_message_iterator *iterator,
+bt_message_iterator_next(
+ struct bt_message_iterator *iterator,
bt_message_array_const *msgs, uint64_t *user_count)
{
enum bt_message_iterator_next_status status = BT_FUNC_STATUS_OK;
BT_ASSERT_PRE_DEV_NON_NULL(msgs, "Message array (output)");
BT_ASSERT_PRE_DEV_NON_NULL(user_count, "Message count (output)");
BT_ASSERT_PRE_DEV(iterator->state ==
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE,
+ BT_MESSAGE_ITERATOR_STATE_ACTIVE,
"Message iterator's \"next\" called, but "
"message iterator is in the wrong state: %!+i", iterator);
BT_ASSERT_DBG(iterator->upstream_component);
* have seeked (cannot seek a self message iterator).
*/
BT_ASSERT_DBG(iterator->state ==
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE);
+ BT_MESSAGE_ITERATOR_STATE_ACTIVE);
switch (status) {
case BT_FUNC_STATUS_OK:
case BT_FUNC_STATUS_AGAIN:
goto end;
case BT_FUNC_STATUS_END:
- set_self_comp_port_input_msg_iterator_state(iterator,
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ENDED);
+ set_msg_iterator_state(iterator,
+ BT_MESSAGE_ITERATOR_STATE_ENDED);
goto end;
default:
/* Unknown non-error status */
}
struct bt_component *
-bt_self_component_port_input_message_iterator_borrow_component(
- struct bt_self_component_port_input_message_iterator *iterator)
+bt_message_iterator_borrow_component(
+ struct bt_message_iterator *iterator)
{
BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator");
return iterator->upstream_component;
struct bt_self_component *bt_self_message_iterator_borrow_component(
struct bt_self_message_iterator *self_iterator)
{
- struct bt_self_component_port_input_message_iterator *iterator =
+ struct bt_message_iterator *iterator =
(void *) self_iterator;
BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator");
struct bt_self_component_port_output *bt_self_message_iterator_borrow_port(
struct bt_self_message_iterator *self_iterator)
{
- struct bt_self_component_port_input_message_iterator *iterator =
+ struct bt_message_iterator *iterator =
(void *) self_iterator;
BT_ASSERT_PRE_DEV_NON_NULL(iterator, "Message iterator");
}
enum bt_message_iterator_can_seek_ns_from_origin_status
-bt_self_component_port_input_message_iterator_can_seek_ns_from_origin(
- struct bt_self_component_port_input_message_iterator *iterator,
+bt_message_iterator_can_seek_ns_from_origin(
+ struct bt_message_iterator *iterator,
int64_t ns_from_origin, bt_bool *can_seek)
{
enum bt_message_iterator_can_seek_ns_from_origin_status status;
* iterator supports forward seeking then we can automatically seek to
* any timestamp.
*/
- status = (int) bt_self_component_port_input_message_iterator_can_seek_beginning(
+ status = (int) bt_message_iterator_can_seek_beginning(
iterator, can_seek);
if (status != BT_FUNC_STATUS_OK) {
goto end;
}
enum bt_message_iterator_can_seek_beginning_status
-bt_self_component_port_input_message_iterator_can_seek_beginning(
- struct bt_self_component_port_input_message_iterator *iterator,
+bt_message_iterator_can_seek_beginning(
+ struct bt_message_iterator *iterator,
bt_bool *can_seek)
{
enum bt_message_iterator_can_seek_beginning_status status;
static inline
void set_iterator_state_after_seeking(
- struct bt_self_component_port_input_message_iterator *iterator,
+ struct bt_message_iterator *iterator,
int status)
{
- enum bt_self_component_port_input_message_iterator_state new_state = 0;
+ enum bt_message_iterator_state new_state = 0;
/* Set iterator's state depending on seeking status */
switch (status) {
case BT_FUNC_STATUS_OK:
- new_state = BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE;
+ new_state = BT_MESSAGE_ITERATOR_STATE_ACTIVE;
break;
case BT_FUNC_STATUS_AGAIN:
- new_state = BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_AGAIN;
+ new_state = BT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_AGAIN;
break;
case BT_FUNC_STATUS_ERROR:
case BT_FUNC_STATUS_MEMORY_ERROR:
- new_state = BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_ERROR;
+ new_state = BT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_ERROR;
break;
case BT_FUNC_STATUS_END:
- new_state = BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ENDED;
+ new_state = BT_MESSAGE_ITERATOR_STATE_ENDED;
break;
default:
bt_common_abort();
}
- set_self_comp_port_input_msg_iterator_state(iterator, new_state);
+ set_msg_iterator_state(iterator, new_state);
}
static
void reset_iterator_expectations(
- struct bt_self_component_port_input_message_iterator *iterator)
+ struct bt_message_iterator *iterator)
{
iterator->last_ns_from_origin = INT64_MIN;
iterator->clock_expectation.type = CLOCK_EXPECTATION_UNSET;
static
bool message_iterator_can_seek_beginning(
- struct bt_self_component_port_input_message_iterator *iterator)
+ struct bt_message_iterator *iterator)
{
enum bt_message_iterator_can_seek_beginning_status status;
bt_bool can_seek;
- status = bt_self_component_port_input_message_iterator_can_seek_beginning(
+ status = bt_message_iterator_can_seek_beginning(
iterator, &can_seek);
if (status != BT_FUNC_STATUS_OK) {
can_seek = BT_FALSE;
}
enum bt_message_iterator_seek_beginning_status
-bt_self_component_port_input_message_iterator_seek_beginning(
- struct bt_self_component_port_input_message_iterator *iterator)
+bt_message_iterator_seek_beginning(
+ struct bt_message_iterator *iterator)
{
int status;
reset_iterator_expectations(iterator);
BT_LIB_LOGD("Calling user's \"seek beginning\" method: %!+i", iterator);
- set_self_comp_port_input_msg_iterator_state(iterator,
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_SEEKING);
+ set_msg_iterator_state(iterator,
+ BT_MESSAGE_ITERATOR_STATE_SEEKING);
status = iterator->methods.seek_beginning(iterator);
BT_LOGD("User method returned: status=%s",
bt_common_func_status_string(status));
}
bt_bool
-bt_self_component_port_input_message_iterator_can_seek_forward(
- bt_self_component_port_input_message_iterator *iterator)
+bt_message_iterator_can_seek_forward(
+ bt_message_iterator *iterator)
{
BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
static inline
int auto_seek_handle_message(
- struct bt_self_component_port_input_message_iterator *iterator,
+ struct bt_message_iterator *iterator,
int64_t ns_from_origin, const struct bt_message *msg,
bool *got_first, GHashTable *stream_states)
{
static
int find_message_ge_ns_from_origin(
- struct bt_self_component_port_input_message_iterator *iterator,
+ struct bt_message_iterator *iterator,
int64_t ns_from_origin, GHashTable *stream_states)
{
int status = BT_FUNC_STATUS_OK;
- enum bt_self_component_port_input_message_iterator_state init_state =
+ enum bt_message_iterator_state init_state =
iterator->state;
const struct bt_message *messages[MSG_BATCH_SIZE];
uint64_t user_count = 0;
* Make this iterator temporarily active (not seeking) to call
* the "next" method.
*/
- set_self_comp_port_input_msg_iterator_state(iterator,
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE);
+ set_msg_iterator_state(iterator,
+ BT_MESSAGE_ITERATOR_STATE_ACTIVE);
BT_ASSERT_DBG(iterator->methods.next);
* would change the iterator's state.
*/
BT_ASSERT_DBG(iterator->state ==
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE);
+ BT_MESSAGE_ITERATOR_STATE_ACTIVE);
switch (status) {
case BT_FUNC_STATUS_OK:
}
}
- set_self_comp_port_input_msg_iterator_state(iterator, init_state);
+ set_msg_iterator_state(iterator, init_state);
return status;
}
static
enum bt_message_iterator_class_next_method_status post_auto_seek_next(
- struct bt_self_component_port_input_message_iterator *iterator,
+ struct bt_message_iterator *iterator,
bt_message_array_const msgs, uint64_t capacity,
uint64_t *count)
{
static
bool message_iterator_can_seek_ns_from_origin(
- struct bt_self_component_port_input_message_iterator *iterator,
+ struct bt_message_iterator *iterator,
int64_t ns_from_origin)
{
enum bt_message_iterator_can_seek_ns_from_origin_status status;
bt_bool can_seek;
- status = bt_self_component_port_input_message_iterator_can_seek_ns_from_origin(
+ status = bt_message_iterator_can_seek_ns_from_origin(
iterator, ns_from_origin, &can_seek);
if (status != BT_FUNC_STATUS_OK) {
can_seek = BT_FALSE;
}
enum bt_message_iterator_seek_ns_from_origin_status
-bt_self_component_port_input_message_iterator_seek_ns_from_origin(
- struct bt_self_component_port_input_message_iterator *iterator,
+bt_message_iterator_seek_ns_from_origin(
+ struct bt_message_iterator *iterator,
int64_t ns_from_origin)
{
int status;
message_iterator_can_seek_ns_from_origin(iterator, ns_from_origin),
"Message iterator cannot seek nanoseconds from origin: %!+i, "
"ns-from-origin=%" PRId64, iterator, ns_from_origin);
- set_self_comp_port_input_msg_iterator_state(iterator,
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_SEEKING);
+ set_msg_iterator_state(iterator,
+ BT_MESSAGE_ITERATOR_STATE_SEEKING);
/*
* We are seeking, reset our expectations about how the following
iterator->auto_seek.original_next_callback = iterator->methods.next;
iterator->methods.next =
- (bt_self_component_port_input_message_iterator_next_method)
+ (bt_message_iterator_next_method)
post_auto_seek_next;
}
bt_bool bt_self_message_iterator_is_interrupted(
const struct bt_self_message_iterator *self_msg_iter)
{
- const struct bt_self_component_port_input_message_iterator *iterator =
+ const struct bt_message_iterator *iterator =
(const void *) self_msg_iter;
BT_ASSERT_PRE_NON_NULL(iterator, "Message iterator");
return (bt_bool) bt_graph_is_interrupted(iterator->graph);
}
-void bt_self_component_port_input_message_iterator_get_ref(
- const struct bt_self_component_port_input_message_iterator *iterator)
+void bt_message_iterator_get_ref(
+ const struct bt_message_iterator *iterator)
{
bt_object_get_ref(iterator);
}
-void bt_self_component_port_input_message_iterator_put_ref(
- const struct bt_self_component_port_input_message_iterator *iterator)
+void bt_message_iterator_put_ref(
+ const struct bt_message_iterator *iterator)
{
bt_object_put_ref(iterator);
}
const struct bt_stream *c_stream, bool with_cs,
uint64_t raw_value)
{
- struct bt_self_component_port_input_message_iterator *msg_iter =
+ struct bt_message_iterator *msg_iter =
(void *) self_msg_iter;
struct bt_message_event *message = NULL;
struct bt_event_class *event_class = (void *) c_event_class;
struct bt_port;
struct bt_graph;
-enum bt_self_component_port_input_message_iterator_state {
+enum bt_message_iterator_state {
/* Iterator is not initialized */
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_NON_INITIALIZED,
+ BT_MESSAGE_ITERATOR_STATE_NON_INITIALIZED,
/* Iterator is active, not at the end yet, and not finalized */
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE,
+ BT_MESSAGE_ITERATOR_STATE_ACTIVE,
/*
* Iterator is ended, not finalized yet: the "next" method
* returns BT_MESSAGE_ITERATOR_STATUS_END.
*/
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ENDED,
+ BT_MESSAGE_ITERATOR_STATE_ENDED,
/* Iterator is currently being finalized */
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZING,
+ BT_MESSAGE_ITERATOR_STATE_FINALIZING,
/* Iterator is finalized */
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZED,
+ BT_MESSAGE_ITERATOR_STATE_FINALIZED,
/* Iterator is seeking */
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_SEEKING,
+ BT_MESSAGE_ITERATOR_STATE_SEEKING,
/* Iterator did seek, but returned `BT_MESSAGE_ITERATOR_STATUS_AGAIN` */
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_AGAIN,
+ BT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_AGAIN,
/* Iterator did seek, but returned error status */
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_ERROR,
+ BT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_ERROR,
};
typedef enum bt_message_iterator_class_next_method_status
-(*bt_self_component_port_input_message_iterator_next_method)(
+(*bt_message_iterator_next_method)(
void *, bt_message_array_const, uint64_t, uint64_t *);
typedef enum bt_message_iterator_class_seek_ns_from_origin_method_status
-(*bt_self_component_port_input_message_iterator_seek_ns_from_origin_method)(
+(*bt_message_iterator_seek_ns_from_origin_method)(
void *, int64_t);
typedef enum bt_message_iterator_class_seek_beginning_method_status
-(*bt_self_component_port_input_message_iterator_seek_beginning_method)(
+(*bt_message_iterator_seek_beginning_method)(
void *);
typedef enum bt_message_iterator_class_can_seek_ns_from_origin_method_status
-(*bt_self_component_port_input_message_iterator_can_seek_ns_from_origin_method)(
+(*bt_message_iterator_can_seek_ns_from_origin_method)(
void *, int64_t, bt_bool *);
typedef enum bt_message_iterator_class_can_seek_beginning_method_status
-(*bt_self_component_port_input_message_iterator_can_seek_beginning_method)(
+(*bt_message_iterator_can_seek_beginning_method)(
void *, bt_bool *);
struct bt_self_message_iterator_configuration {
bool can_seek_forward;
};
-struct bt_self_component_port_input_message_iterator {
+struct bt_message_iterator {
struct bt_object base;
GPtrArray *msgs;
struct bt_component *upstream_component; /* Weak */
/*
* Array of
- * `struct bt_self_component_port_input_message_iterator *`
+ * `struct bt_message_iterator *`
* (weak).
*
* This is an array of upstream message iterators on which this
* 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_message_iterator *downstream_msg_iter;
struct {
- bt_self_component_port_input_message_iterator_next_method next;
+ bt_message_iterator_next_method next;
/* These two are always both set or both unset. */
- bt_self_component_port_input_message_iterator_seek_ns_from_origin_method seek_ns_from_origin;
- bt_self_component_port_input_message_iterator_can_seek_ns_from_origin_method can_seek_ns_from_origin;
+ bt_message_iterator_seek_ns_from_origin_method seek_ns_from_origin;
+ bt_message_iterator_can_seek_ns_from_origin_method can_seek_ns_from_origin;
/* These two are always both set or both unset. */
- bt_self_component_port_input_message_iterator_seek_beginning_method seek_beginning;
- bt_self_component_port_input_message_iterator_can_seek_beginning_method can_seek_beginning;
+ bt_message_iterator_seek_beginning_method seek_beginning;
+ bt_message_iterator_can_seek_beginning_method can_seek_beginning;
} methods;
- enum bt_self_component_port_input_message_iterator_state state;
+ enum bt_message_iterator_state state;
/*
* Timestamp of the last received message (or INT64_MIN in the
};
BT_HIDDEN
-void bt_self_component_port_input_message_iterator_try_finalize(
- struct bt_self_component_port_input_message_iterator *iterator);
+void bt_message_iterator_try_finalize(
+ struct bt_message_iterator *iterator);
BT_HIDDEN
-void bt_self_component_port_input_message_iterator_set_connection(
- struct bt_self_component_port_input_message_iterator *iterator,
+void bt_message_iterator_set_connection(
+ struct bt_message_iterator *iterator,
struct bt_connection *connection);
static inline
-const char *bt_self_component_port_input_message_iterator_state_string(
- enum bt_self_component_port_input_message_iterator_state state)
+const char *bt_message_iterator_state_string(
+ enum bt_message_iterator_state state)
{
switch (state) {
- case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ACTIVE:
+ case BT_MESSAGE_ITERATOR_STATE_ACTIVE:
return "ACTIVE";
- case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_ENDED:
+ case BT_MESSAGE_ITERATOR_STATE_ENDED:
return "ENDED";
- case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZING:
+ case BT_MESSAGE_ITERATOR_STATE_FINALIZING:
return "FINALIZING";
- case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_FINALIZED:
+ case BT_MESSAGE_ITERATOR_STATE_FINALIZED:
return "FINALIZED";
- case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_SEEKING:
+ case BT_MESSAGE_ITERATOR_STATE_SEEKING:
return "SEEKING";
- case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_AGAIN:
+ case BT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_AGAIN:
return "LAST_SEEKING_RETURNED_AGAIN";
- case BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_ERROR:
+ case BT_MESSAGE_ITERATOR_STATE_LAST_SEEKING_RETURNED_ERROR:
return "LAST_SEEKING_RETURNED_ERROR";
default:
return "(unknown)";
const struct bt_clock_class *default_clock_class,
uint64_t value_cycles)
{
- struct bt_self_component_port_input_message_iterator *msg_iter =
+ struct bt_message_iterator *msg_iter =
(void *) self_msg_iter;
struct bt_message_message_iterator_inactivity *message;
struct bt_message *ret_msg = NULL;
static inline
struct bt_message *create_packet_message(
- struct bt_self_component_port_input_message_iterator *msg_iter,
+ struct bt_message_iterator *msg_iter,
struct bt_packet *packet, struct bt_object_pool *pool,
bool with_cs, uint64_t raw_value)
{
struct bt_self_message_iterator *self_msg_iter,
const struct bt_packet *packet)
{
- struct bt_self_component_port_input_message_iterator *msg_iter =
+ struct bt_message_iterator *msg_iter =
(void *) self_msg_iter;
BT_ASSERT_PRE_DEV_NO_ERROR();
struct bt_self_message_iterator *self_msg_iter,
const struct bt_packet *packet, uint64_t raw_value)
{
- struct bt_self_component_port_input_message_iterator *msg_iter =
+ struct bt_message_iterator *msg_iter =
(void *) self_msg_iter;
BT_ASSERT_PRE_DEV_NO_ERROR();
struct bt_self_message_iterator *self_msg_iter,
const struct bt_packet *packet)
{
- struct bt_self_component_port_input_message_iterator *msg_iter =
+ struct bt_message_iterator *msg_iter =
(void *) self_msg_iter;
BT_ASSERT_PRE_DEV_NO_ERROR();
struct bt_self_message_iterator *self_msg_iter,
const struct bt_packet *packet, uint64_t raw_value)
{
- struct bt_self_component_port_input_message_iterator *msg_iter =
+ struct bt_message_iterator *msg_iter =
(void *) self_msg_iter;
BT_ASSERT_PRE_DEV_NO_ERROR();
const struct bt_message_iterator *iterator)
{
char tmp_prefix[TMP_PREFIX_LEN];
- const struct bt_self_component_port_input_message_iterator *
+ const struct bt_message_iterator *
port_in_iter = (const void *) iterator;
if (port_in_iter->upstream_component) {
fs_sink->traces = NULL;
}
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_PUT_REF_AND_RESET(
+ BT_MESSAGE_ITERATOR_PUT_REF_AND_RESET(
fs_sink->upstream_iter);
g_free(fs_sink);
BT_ASSERT_DBG(fs_sink->upstream_iter);
/* Consume messages */
- next_status = bt_self_component_port_input_message_iterator_next(
+ next_status = bt_message_iterator_next(
fs_sink->upstream_iter, &msgs, &msg_count);
if (next_status < 0) {
status = (int) next_status;
bt_self_component_sink *self_comp)
{
bt_component_class_sink_graph_is_configured_method_status status;
- bt_self_component_port_input_message_iterator_create_from_sink_component_status
+ bt_message_iterator_create_from_sink_component_status
msg_iter_status;
struct fs_sink_comp *fs_sink = bt_self_component_get_data(
bt_self_component_sink_as_self_component(self_comp));
msg_iter_status =
- bt_self_component_port_input_message_iterator_create_from_sink_component(
+ bt_message_iterator_create_from_sink_component(
self_comp,
bt_self_component_sink_borrow_input_port_by_name(
self_comp, in_port_name), &fs_sink->upstream_iter);
- if (msg_iter_status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) {
+ if (msg_iter_status != BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) {
status = (int) msg_iter_status;
goto end;
}
bt_self_component *self_comp;
/* Owned by this */
- bt_self_component_port_input_message_iterator *upstream_iter;
+ bt_message_iterator *upstream_iter;
/* Base output directory path */
GString *output_dir_path;
struct debug_info_component *debug_info_component;
bt_self_message_iterator *input_iterator;
bt_self_component *self_comp;
- bt_self_component_port_input_message_iterator *msg_iter;
+ bt_message_iterator *msg_iter;
struct trace_ir_maps *ir_maps;
/* in_trace -> debug_info_mapping. */
const bt_message_array_const msgs, uint64_t capacity,
uint64_t *count)
{
- bt_self_component_port_input_message_iterator *upstream_iterator = NULL;
+ bt_message_iterator *upstream_iterator = NULL;
bt_message_iterator_next_status upstream_iterator_ret_status;
struct debug_info_msg_iter *debug_info_msg_iter;
struct debug_info_component *debug_info = NULL;
BT_ASSERT_DBG(upstream_iterator);
upstream_iterator_ret_status =
- bt_self_component_port_input_message_iterator_next(
+ bt_message_iterator_next(
upstream_iterator, &input_msgs, count);
if (upstream_iterator_ret_status !=
BT_MESSAGE_ITERATOR_NEXT_STATUS_OK) {
}
if (debug_info_msg_iter->msg_iter) {
- bt_self_component_port_input_message_iterator_put_ref(
+ bt_message_iterator_put_ref(
debug_info_msg_iter->msg_iter);
}
bt_self_component_port_output *self_port)
{
bt_message_iterator_class_initialize_method_status status;
- bt_self_component_port_input_message_iterator_create_from_message_iterator_status
+ bt_message_iterator_create_from_message_iterator_status
msg_iter_status;
struct bt_self_component_port_input *input_port = NULL;
- bt_self_component_port_input_message_iterator *upstream_iterator = NULL;
+ bt_message_iterator *upstream_iterator = NULL;
struct debug_info_msg_iter *debug_info_msg_iter = NULL;
gchar *debug_info_field_name;
int ret;
}
/* Create an iterator on the upstream component. */
- msg_iter_status = bt_self_component_port_input_message_iterator_create_from_message_iterator(
+ msg_iter_status = bt_message_iterator_create_from_message_iterator(
self_msg_iter, input_port, &upstream_iterator);
- if (msg_iter_status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK) {
+ if (msg_iter_status != BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK) {
status = (int) msg_iter_status;
goto error;
}
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_MOVE_REF(
+ BT_MESSAGE_ITERATOR_MOVE_REF(
debug_info_msg_iter->msg_iter, upstream_iterator);
/* Create hashtable that will contain debug info mapping. */
}
bt_self_message_iterator_configuration_set_can_seek_forward(config,
- bt_self_component_port_input_message_iterator_can_seek_forward(
+ bt_message_iterator_can_seek_forward(
debug_info_msg_iter->msg_iter));
bt_self_message_iterator_set_data(self_msg_iter, debug_info_msg_iter);
bt_self_message_iterator_get_data(self_msg_iter);
BT_ASSERT(debug_info_msg_iter);
- return (int) bt_self_component_port_input_message_iterator_can_seek_beginning(
+ return (int) bt_message_iterator_can_seek_beginning(
debug_info_msg_iter->msg_iter, can_seek);
}
BT_ASSERT(debug_info_msg_iter);
/* Ask the upstream component to seek to the beginning. */
- seek_beg_status = bt_self_component_port_input_message_iterator_seek_beginning(
+ seek_beg_status = bt_message_iterator_seek_beginning(
debug_info_msg_iter->msg_iter);
if (seek_beg_status != BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_OK) {
status = (int) seek_beg_status;
details_comp->str = NULL;
}
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_PUT_REF_AND_RESET(
+ BT_MESSAGE_ITERATOR_PUT_REF_AND_RESET(
details_comp->msg_iter);
g_free(details_comp);
details_graph_is_configured(bt_self_component_sink *comp)
{
bt_component_class_sink_graph_is_configured_method_status status;
- bt_self_component_port_input_message_iterator_create_from_sink_component_status
+ bt_message_iterator_create_from_sink_component_status
msg_iter_status;
- bt_self_component_port_input_message_iterator *iterator;
+ bt_message_iterator *iterator;
struct details_comp *details_comp;
bt_self_component_port_input *in_port;
goto end;
}
- msg_iter_status = bt_self_component_port_input_message_iterator_create_from_sink_component(
+ msg_iter_status = bt_message_iterator_create_from_sink_component(
comp, bt_self_component_sink_borrow_input_port_by_name(comp,
IN_PORT_NAME), &iterator);
- if (msg_iter_status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) {
+ if (msg_iter_status != BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) {
status = (int) msg_iter_status;
goto end;
}
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_MOVE_REF(
+ BT_MESSAGE_ITERATOR_MOVE_REF(
details_comp->msg_iter, iterator);
status = BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_OK;
BT_ASSERT_DBG(details_comp->msg_iter);
/* Consume messages */
- next_status = bt_self_component_port_input_message_iterator_next(
+ next_status = bt_message_iterator_next(
details_comp->msg_iter, &msgs, &count);
switch (next_status) {
case BT_MESSAGE_ITERATOR_NEXT_STATUS_OK:
uint32_t next_unique_trace_id;
/* Upstream message iterator */
- bt_self_component_port_input_message_iterator *msg_iter;
+ bt_message_iterator *msg_iter;
/*
* True if this component printed something. This is used to
goto end;
}
- bt_self_component_port_input_message_iterator_put_ref(pretty->iterator);
+ bt_message_iterator_put_ref(pretty->iterator);
if (pretty->string) {
(void) g_string_free(pretty->string, TRUE);
pretty_graph_is_configured(bt_self_component_sink *comp)
{
bt_component_class_sink_graph_is_configured_method_status status;
- bt_self_component_port_input_message_iterator_create_from_sink_component_status
+ bt_message_iterator_create_from_sink_component_status
msg_iter_status;
struct pretty_component *pretty;
bt_self_component_sink_as_self_component(comp));
BT_ASSERT(pretty);
BT_ASSERT(!pretty->iterator);
- msg_iter_status = bt_self_component_port_input_message_iterator_create_from_sink_component(
+ msg_iter_status = bt_message_iterator_create_from_sink_component(
comp, bt_self_component_sink_borrow_input_port_by_name(comp,
in_port_name), &pretty->iterator);
- if (msg_iter_status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) {
+ if (msg_iter_status != BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) {
status = (int) msg_iter_status;
goto end;
}
bt_component_class_sink_consume_method_status ret =
BT_COMPONENT_CLASS_SINK_CONSUME_METHOD_STATUS_OK;
bt_message_array_const msgs;
- bt_self_component_port_input_message_iterator *it;
+ bt_message_iterator *it;
struct pretty_component *pretty = bt_self_component_get_data(
bt_self_component_sink_as_self_component(comp));
bt_message_iterator_next_status next_status;
uint64_t i = 0;
it = pretty->iterator;
- next_status = bt_self_component_port_input_message_iterator_next(it,
+ next_status = bt_message_iterator_next(it,
&msgs, &count);
switch (next_status) {
goto end;
case BT_MESSAGE_ITERATOR_NEXT_STATUS_END:
ret = (int) next_status;
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_PUT_REF_AND_RESET(
+ BT_MESSAGE_ITERATOR_PUT_REF_AND_RESET(
pretty->iterator);
goto end;
default:
struct pretty_component {
struct pretty_options options;
- bt_self_component_port_input_message_iterator *iterator;
+ bt_message_iterator *iterator;
FILE *out, *err;
int depth; /* nesting, used for tabulation alignment. */
bool start_line;
void destroy_private_counter_data(struct counter *counter)
{
if (counter) {
- bt_self_component_port_input_message_iterator_put_ref(
+ bt_message_iterator_put_ref(
counter->msg_iter);
g_free(counter);
}
bt_self_component_sink_as_self_component(comp));
BT_ASSERT(counter);
try_print_last(counter);
- bt_self_component_port_input_message_iterator_put_ref(counter->msg_iter);
+ bt_message_iterator_put_ref(counter->msg_iter);
g_free(counter);
}
bt_self_component_sink *comp)
{
bt_component_class_sink_graph_is_configured_method_status status;
- bt_self_component_port_input_message_iterator_create_from_sink_component_status
+ bt_message_iterator_create_from_sink_component_status
msg_iter_status;
struct counter *counter;
- bt_self_component_port_input_message_iterator *iterator;
+ bt_message_iterator *iterator;
counter = bt_self_component_get_data(
bt_self_component_sink_as_self_component(comp));
BT_ASSERT(counter);
- msg_iter_status = bt_self_component_port_input_message_iterator_create_from_sink_component(
+ msg_iter_status = bt_message_iterator_create_from_sink_component(
comp, bt_self_component_sink_borrow_input_port_by_name(comp,
in_port_name), &iterator);
- if (msg_iter_status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) {
+ if (msg_iter_status != BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) {
status = (int) msg_iter_status;
goto end;
}
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_MOVE_REF(
+ BT_MESSAGE_ITERATOR_MOVE_REF(
counter->msg_iter, iterator);
status = BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_OK;
}
/* Consume messages */
- next_status = bt_self_component_port_input_message_iterator_next(
+ next_status = bt_message_iterator_next(
counter->msg_iter, &msgs, &msg_count);
if (next_status < 0) {
status = (int) next_status;
#include "common/macros.h"
struct counter {
- bt_self_component_port_input_message_iterator *msg_iter;
+ bt_message_iterator *msg_iter;
struct {
uint64_t event;
uint64_t stream_begin;
static
void destroy_private_dummy_data(struct dummy *dummy)
{
- bt_self_component_port_input_message_iterator_put_ref(dummy->msg_iter);
+ bt_message_iterator_put_ref(dummy->msg_iter);
g_free(dummy);
}
bt_self_component_sink *comp)
{
bt_component_class_sink_graph_is_configured_method_status status;
- bt_self_component_port_input_message_iterator_create_from_sink_component_status
+ bt_message_iterator_create_from_sink_component_status
msg_iter_status;
struct dummy *dummy;
- bt_self_component_port_input_message_iterator *iterator;
+ bt_message_iterator *iterator;
dummy = bt_self_component_get_data(
bt_self_component_sink_as_self_component(comp));
BT_ASSERT(dummy);
- msg_iter_status = bt_self_component_port_input_message_iterator_create_from_sink_component(
+ msg_iter_status = bt_message_iterator_create_from_sink_component(
comp, bt_self_component_sink_borrow_input_port_by_name(comp,
in_port_name), &iterator);
- if (msg_iter_status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) {
+ if (msg_iter_status != BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK) {
status = (int) msg_iter_status;
goto end;
}
- BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_MOVE_REF(
+ BT_MESSAGE_ITERATOR_MOVE_REF(
dummy->msg_iter, iterator);
status = BT_COMPONENT_CLASS_SINK_GRAPH_IS_CONFIGURED_METHOD_STATUS_OK;
}
/* Consume one message */
- next_status = bt_self_component_port_input_message_iterator_next(
+ next_status = bt_message_iterator_next(
dummy->msg_iter, &msgs, &count);
switch (next_status) {
case BT_MESSAGE_ITERATOR_NEXT_STATUS_OK:
#include "common/macros.h"
struct dummy {
- bt_self_component_port_input_message_iterator *msg_iter;
+ bt_message_iterator *msg_iter;
};
BT_HIDDEN
struct muxer_comp *muxer_comp;
/* Owned by this, NULL if ended */
- bt_self_component_port_input_message_iterator *msg_iter;
+ bt_message_iterator *msg_iter;
/* Contains `const bt_message *`, owned by this */
GQueue *msgs;
muxer_upstream_msg_iter,
muxer_upstream_msg_iter->msg_iter,
muxer_upstream_msg_iter->msgs->length);
- bt_self_component_port_input_message_iterator_put_ref(
+ bt_message_iterator_put_ref(
muxer_upstream_msg_iter->msg_iter);
if (muxer_upstream_msg_iter->msgs) {
static
int muxer_msg_iter_add_upstream_msg_iter(struct muxer_msg_iter *muxer_msg_iter,
- bt_self_component_port_input_message_iterator *self_msg_iter)
+ bt_message_iterator *self_msg_iter)
{
int ret = 0;
struct muxer_upstream_msg_iter *muxer_upstream_msg_iter =
muxer_upstream_msg_iter->muxer_comp = muxer_comp;
muxer_upstream_msg_iter->msg_iter = self_msg_iter;
- bt_self_component_port_input_message_iterator_get_ref(muxer_upstream_msg_iter->msg_iter);
+ bt_message_iterator_get_ref(muxer_upstream_msg_iter->msg_iter);
muxer_upstream_msg_iter->msgs = g_queue_new();
if (!muxer_upstream_msg_iter->msgs) {
BT_COMP_LOGE_STR("Failed to allocate a GQueue.");
}
static
-bt_self_component_port_input_message_iterator_create_from_message_iterator_status
+bt_message_iterator_create_from_message_iterator_status
create_msg_iter_on_input_port(struct muxer_comp *muxer_comp,
struct muxer_msg_iter *muxer_msg_iter,
bt_self_component_port_input *self_port,
- bt_self_component_port_input_message_iterator **msg_iter)
+ bt_message_iterator **msg_iter)
{
const bt_port *port = bt_self_component_port_as_port(
bt_self_component_port_input_as_self_component_port(
self_port));
- bt_self_component_port_input_message_iterator_create_from_message_iterator_status
+ bt_message_iterator_create_from_message_iterator_status
status;
BT_ASSERT(port);
// TODO: Advance the iterator to >= the time of the latest
// returned message by the muxer message
// iterator which creates it.
- status = bt_self_component_port_input_message_iterator_create_from_message_iterator(
+ status = bt_message_iterator_create_from_message_iterator(
muxer_msg_iter->self_msg_iter, self_port, msg_iter);
- if (status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK) {
+ if (status != BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK) {
BT_COMP_LOGE("Cannot create upstream message iterator on input port: "
"port-addr=%p, port-name=\"%s\"",
port, bt_port_get_name(port));
"muxer-upstream-msg-iter-wrap-addr=%p, msg-iter-addr=%p",
muxer_upstream_msg_iter,
muxer_upstream_msg_iter->msg_iter);
- input_port_iter_status = bt_self_component_port_input_message_iterator_next(
+ input_port_iter_status = bt_message_iterator_next(
muxer_upstream_msg_iter->msg_iter, &msgs, &count);
BT_COMP_LOGD("Upstream message iterator's \"next\" method returned: "
"status=%s",
}
for (i = 0; i < count; i++) {
- bt_self_component_port_input_message_iterator *upstream_msg_iter;
+ bt_message_iterator *upstream_msg_iter;
bt_self_component_port_input *self_port =
bt_self_component_filter_borrow_input_port_by_index(
muxer_comp->self_comp_flt, i);
const bt_port *port;
- bt_self_component_port_input_message_iterator_create_from_message_iterator_status
+ bt_message_iterator_create_from_message_iterator_status
msg_iter_status;
int int_status;
msg_iter_status = create_msg_iter_on_input_port(muxer_comp,
muxer_msg_iter, self_port, &upstream_msg_iter);
- if (msg_iter_status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK) {
+ if (msg_iter_status != BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK) {
/* create_msg_iter_on_input_port() logs errors */
status = (int) msg_iter_status;
goto end;
int_status = muxer_msg_iter_add_upstream_msg_iter(muxer_msg_iter,
upstream_msg_iter);
- bt_self_component_port_input_message_iterator_put_ref(
+ bt_message_iterator_put_ref(
upstream_msg_iter);
if (int_status) {
status = BT_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_STATUS_ERROR;
}
can_seek_forward = can_seek_forward &&
- bt_self_component_port_input_message_iterator_can_seek_forward(
+ bt_message_iterator_can_seek_forward(
upstream_msg_iter);
}
for (i = 0; i < muxer_upstream_msg_iters->len; i++) {
struct muxer_upstream_msg_iter *upstream_msg_iter =
muxer_upstream_msg_iters->pdata[i];
- status = (int) bt_self_component_port_input_message_iterator_can_seek_beginning(
+ status = (int) bt_message_iterator_can_seek_beginning(
upstream_msg_iter->msg_iter, can_seek);
if (status != BT_MESSAGE_ITERATOR_CLASS_CAN_SEEK_BEGINNING_METHOD_STATUS_OK) {
goto end;
struct muxer_upstream_msg_iter *upstream_msg_iter =
muxer_msg_iter->ended_muxer_upstream_msg_iters->pdata[i];
- seek_beg_status = bt_self_component_port_input_message_iterator_seek_beginning(
+ seek_beg_status = bt_message_iterator_seek_beginning(
upstream_msg_iter->msg_iter);
if (seek_beg_status != BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_OK) {
status = (int) seek_beg_status;
struct muxer_upstream_msg_iter *upstream_msg_iter =
muxer_msg_iter->active_muxer_upstream_msg_iters->pdata[i];
- seek_beg_status = bt_self_component_port_input_message_iterator_seek_beginning(
+ seek_beg_status = bt_message_iterator_seek_beginning(
upstream_msg_iter->msg_iter);
if (seek_beg_status != BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_OK) {
status = (int) seek_beg_status;
enum trimmer_iterator_state state;
/* Owned by this */
- bt_self_component_port_input_message_iterator *upstream_iter;
+ bt_message_iterator *upstream_iter;
struct trimmer_bound begin, end;
/*
goto end;
}
- bt_self_component_port_input_message_iterator_put_ref(
+ bt_message_iterator_put_ref(
trimmer_it->upstream_iter);
if (trimmer_it->output_messages) {
bt_self_component_port_output *port)
{
bt_message_iterator_class_initialize_method_status status;
- bt_self_component_port_input_message_iterator_create_from_message_iterator_status
+ bt_message_iterator_create_from_message_iterator_status
msg_iter_status;
struct trimmer_iterator *trimmer_it;
trimmer_it->begin = trimmer_it->trimmer_comp->begin;
trimmer_it->end = trimmer_it->trimmer_comp->end;
msg_iter_status =
- bt_self_component_port_input_message_iterator_create_from_message_iterator(
+ bt_message_iterator_create_from_message_iterator(
self_msg_iter,
bt_self_component_filter_borrow_input_port_by_name(
trimmer_it->trimmer_comp->self_comp_filter, in_port_name),
&trimmer_it->upstream_iter);
- if (msg_iter_status != BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK) {
+ if (msg_iter_status != BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK) {
status = (int) msg_iter_status;
goto error;
}
while (true) {
upstream_iter_status =
- bt_self_component_port_input_message_iterator_next(
+ bt_message_iterator_next(
trimmer_it->upstream_iter, &msgs, &count);
if (upstream_iter_status != BT_MESSAGE_ITERATOR_NEXT_STATUS_OK) {
goto end;
if (trimmer_it->begin.is_infinite) {
bt_bool can_seek;
- status = (int) bt_self_component_port_input_message_iterator_can_seek_beginning(
+ status = (int) bt_message_iterator_can_seek_beginning(
trimmer_it->upstream_iter, &can_seek);
if (status != BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_OK) {
if (status < 0) {
goto end;
}
- status = (int) bt_self_component_port_input_message_iterator_seek_beginning(
+ status = (int) bt_message_iterator_seek_beginning(
trimmer_it->upstream_iter);
} else {
bt_bool can_seek;
- status = (int) bt_self_component_port_input_message_iterator_can_seek_ns_from_origin(
+ status = (int) bt_message_iterator_can_seek_ns_from_origin(
trimmer_it->upstream_iter, trimmer_it->begin.ns_from_origin,
&can_seek);
goto end;
}
- status = (int) bt_self_component_port_input_message_iterator_seek_ns_from_origin(
+ status = (int) bt_message_iterator_seek_ns_from_origin(
trimmer_it->upstream_iter, trimmer_it->begin.ns_from_origin);
}
bool reached_end = false;
while (g_queue_is_empty(trimmer_it->output_messages)) {
- status = (int) bt_self_component_port_input_message_iterator_next(
+ status = (int) bt_message_iterator_next(
trimmer_it->upstream_iter, &my_msgs, &my_count);
if (G_UNLIKELY(status != BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_OK)) {
if (status == BT_MESSAGE_ITERATOR_CLASS_NEXT_METHOD_STATUS_END) {
self._in = self._add_input_port('in')
def _user_graph_is_configured(self):
- self._iter = self._create_input_port_message_iterator(self._in)
+ self._iter = self._create_message_iterator(self._in)
def _user_consume(self):
next(self._iter)
self._in = self._add_input_port('in')
def _user_graph_is_configured(self):
- self._iter = self._create_input_port_message_iterator(self._in)
+ self._iter = self._create_message_iterator(self._in)
def _user_consume(self):
try:
next(self._msg_iter)
def _user_graph_is_configured(self):
- self._msg_iter = self._create_input_port_message_iterator(
- self._input_ports['in']
- )
+ self._msg_iter = self._create_message_iterator(self._input_ports['in'])
# add two interrupters, set one of them
interrupter1 = bt2.Interrupter()
return next(self._msg_iter)
def _user_graph_is_configured(self):
- self._msg_iter = self._create_input_port_message_iterator(
- self._input_ports['in']
- )
+ self._msg_iter = self._create_message_iterator(self._input_ports['in'])
graph = self._graph
up = self._graph.add_component(MySource, 'down')
comp_self._at += 1
def _user_graph_is_configured(self):
- self._msg_iter = self._create_input_port_message_iterator(
- self._input_port
- )
+ self._msg_iter = self._create_message_iterator(self._input_port)
src = self._graph.add_component(MySource, 'src')
sink = self._graph.add_component(MySink, 'sink')
comp_self._at += 1
def _user_graph_is_configured(self):
- self._msg_iter = self._create_input_port_message_iterator(
- self._input_port
- )
+ self._msg_iter = self._create_message_iterator(self._input_port)
src = self._graph.add_component(MySource, 'src')
sink = self._graph.add_component(MySink, 'sink')
comp_self._at += 1
def _user_graph_is_configured(self):
- self._msg_iter = self._create_input_port_message_iterator(
- self._input_port
- )
+ self._msg_iter = self._create_message_iterator(self._input_port)
src = self._graph.add_component(MySource, 'src')
sink = self._graph.add_component(MySink, 'sink')
next(self._msg_iter)
def _user_graph_is_configured(self):
- self._msg_iter = self._create_input_port_message_iterator(
- self._input_ports['in']
- )
+ self._msg_iter = self._create_message_iterator(self._input_ports['in'])
def _create_graph(src_comp_cls, sink_comp_cls, flt_comp_cls=None):
def __init__(self, config, self_port_output):
nonlocal flt_iter_initialized
flt_iter_initialized = True
- self._up_iter = self._create_input_port_message_iterator(
+ self._up_iter = self._create_message_iterator(
self._component._input_ports['in']
)
def test_create_user_error(self):
# This tests both error handling by
- # _UserSinkComponent._create_input_port_message_iterator
- # and _UserMessageIterator._create_input_port_message_iterator, as they
+ # _UserSinkComponent._create_message_iterator
+ # and _UserMessageIterator._create_message_iterator, as they
# are both used in the graph.
class MySourceIter(bt2._UserMessageIterator):
def __init__(self, config, self_port_output):
def __init__(self, config, self_port_output):
# This is expected to raise because of the error in
# MySourceIter.__init__.
- self._create_input_port_message_iterator(
- self._component._input_ports['in']
- )
+ self._create_message_iterator(self._component._input_ports['in'])
class MyFilter(bt2._UserFilterComponent, message_iterator_class=MyFilterIter):
def __init__(self, config, params, obj):
self._add_input_port('in')
def _user_graph_is_configured(self):
- self._msg_iter = self._create_input_port_message_iterator(
- self._input_ports['in']
- )
+ self._msg_iter = self._create_message_iterator(self._input_ports['in'])
def _user_consume(self):
nonlocal can_seek_forward
class MyFilterIter(bt2._UserMessageIterator):
def __init__(self, port):
input_port = port.user_data
- self._upstream_iter = self._create_input_port_message_iterator(
- input_port
- )
+ self._upstream_iter = self._create_message_iterator(input_port)
def __next__(self):
return next(self._upstream_iter)
class MyFilterIter(bt2._UserMessageIterator):
def __init__(self, config, port):
# First, create an upstream iterator.
- self._upstream_iter = self._create_input_port_message_iterator(
+ self._upstream_iter = self._create_message_iterator(
self._component._input_ports['in']
)
self._input_port = self._add_input_port('in')
def _user_graph_is_configured(self):
- self._upstream_iter = self._create_input_port_message_iterator(
- self._input_port
- )
+ self._upstream_iter = self._create_message_iterator(self._input_port)
def _user_consume(self):
# We should not reach this.
class MyFilterIter(bt2._UserMessageIterator):
def __init__(self, config, port):
- self._upstream_iter = self._create_input_port_message_iterator(
+ self._upstream_iter = self._create_message_iterator(
self._component._input_ports['in']
)
config.can_seek_forward = self._upstream_iter.can_seek_forward
self._add_input_port('in')
def _user_graph_is_configured(self):
- self._msg_iter = self._create_input_port_message_iterator(
- self._input_ports['in']
- )
+ self._msg_iter = self._create_message_iterator(self._input_ports['in'])
def _user_consume(self):
nonlocal can_seek_beginning
self._add_input_port('in')
def _user_graph_is_configured(self):
- self._msg_iter = self._create_input_port_message_iterator(
- self._input_ports['in']
- )
+ self._msg_iter = self._create_message_iterator(self._input_ports['in'])
def _user_consume(self):
nonlocal can_seek_beginning
self._add_input_port('in')
def _user_graph_is_configured(self):
- self._msg_iter = self._create_input_port_message_iterator(
- self._input_ports['in']
- )
+ self._msg_iter = self._create_message_iterator(self._input_ports['in'])
def _user_consume(self):
nonlocal can_seek_beginning
self._add_input_port('in')
def _user_graph_is_configured(self):
- self._msg_iter = self._create_input_port_message_iterator(
- self._input_ports['in']
- )
+ self._msg_iter = self._create_message_iterator(self._input_ports['in'])
def _user_consume(self):
# This is expected to raise.
self._add_input_port('in')
def _user_graph_is_configured(self):
- self._msg_iter = self._create_input_port_message_iterator(
- self._input_ports['in']
- )
+ self._msg_iter = self._create_message_iterator(self._input_ports['in'])
def _user_consume(self):
# This is expected to raise.
self._add_input_port('in')
def _user_graph_is_configured(self):
- self._msg_iter = self._create_input_port_message_iterator(
- self._input_ports['in']
- )
+ self._msg_iter = self._create_message_iterator(self._input_ports['in'])
def _user_consume(self):
nonlocal do_seek_beginning
self._add_input_port('in')
def _user_graph_is_configured(self):
- self._msg_iter = self._create_input_port_message_iterator(
- self._input_ports['in']
- )
+ self._msg_iter = self._create_message_iterator(self._input_ports['in'])
def _user_consume(self):
self._msg_iter.seek_beginning()
self._add_input_port('in')
def _user_graph_is_configured(self):
- self._msg_iter = self._create_input_port_message_iterator(
- self._input_ports['in']
- )
+ self._msg_iter = self._create_message_iterator(self._input_ports['in'])
def _user_consume(self):
nonlocal can_seek_ns_from_origin
self._add_input_port('in')
def _user_graph_is_configured(self):
- self._msg_iter = self._create_input_port_message_iterator(
- self._input_ports['in']
- )
+ self._msg_iter = self._create_message_iterator(self._input_ports['in'])
def _user_consume(self):
# This is expected to raise.
self._add_input_port('in')
def _user_graph_is_configured(self):
- self._msg_iter = self._create_input_port_message_iterator(
- self._input_ports['in']
- )
+ self._msg_iter = self._create_message_iterator(self._input_ports['in'])
def _user_consume(self):
# This is expected to raise.
self._add_input_port('in')
def _user_graph_is_configured(self):
- self._msg_iter = self._create_input_port_message_iterator(
- self._input_ports['in']
- )
+ self._msg_iter = self._create_message_iterator(self._input_ports['in'])
def _user_consume(self):
self._msg_iter.seek_ns_from_origin(17)
self._add_input_port('in')
def _user_graph_is_configured(self):
- self._msg_iter = self._create_input_port_message_iterator(
- self._input_ports['in']
- )
+ self._msg_iter = self._create_message_iterator(self._input_ports['in'])
def _user_consume(self):
assert self._msg_list[0] is None
static
bt_graph_simple_sink_component_initialize_func_status simple_INITIALIZE_func(
- bt_self_component_port_input_message_iterator *iterator,
+ bt_message_iterator *iterator,
void *data)
{
struct test_data *test_data = data;
static
bt_graph_simple_sink_component_consume_func_status simple_consume_func(
- bt_self_component_port_input_message_iterator *iterator,
+ bt_message_iterator *iterator,
void *data)
{
struct test_data *test_data = data;