lib: rename "self comp. input port message iter." -> "message iterator"
[babeltrace.git] / include / babeltrace2 / graph / message-iterator.h
CommitLineData
924dc299
PP
1#ifndef BABELTRACE2_GRAPH_MESSAGE_ITERATOR_H
2#define BABELTRACE2_GRAPH_MESSAGE_ITERATOR_H
d24d5663
PP
3
4/*
bbb7b5f0 5 * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
d24d5663
PP
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24 */
25
4fa90f32
PP
26#ifndef __BT_IN_BABELTRACE_H
27# error "Please include <babeltrace2/babeltrace.h> instead."
28#endif
d24d5663
PP
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34typedef enum bt_message_iterator_next_status {
35 BT_MESSAGE_ITERATOR_NEXT_STATUS_OK = __BT_FUNC_STATUS_OK,
36 BT_MESSAGE_ITERATOR_NEXT_STATUS_END = __BT_FUNC_STATUS_END,
37 BT_MESSAGE_ITERATOR_NEXT_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
38 BT_MESSAGE_ITERATOR_NEXT_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
39 BT_MESSAGE_ITERATOR_NEXT_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
40} bt_message_iterator_next_status;
41
42typedef enum bt_message_iterator_seek_beginning_status {
43 BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_OK = __BT_FUNC_STATUS_OK,
d24d5663
PP
44 BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
45 BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
46 BT_MESSAGE_ITERATOR_SEEK_BEGINNING_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
47} bt_message_iterator_seek_beginning_status;
48
49typedef enum bt_message_iterator_seek_ns_from_origin_status {
50 BT_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_STATUS_OK = __BT_FUNC_STATUS_OK,
d24d5663
PP
51 BT_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
52 BT_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
53 BT_MESSAGE_ITERATOR_SEEK_NS_FROM_ORIGIN_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
54} bt_message_iterator_seek_ns_from_origin_status;
55
f2fb1b32
SM
56typedef enum bt_message_iterator_can_seek_beginning_status {
57 BT_MESSAGE_ITERATOR_CAN_SEEK_BEGINNING_STATUS_OK = __BT_FUNC_STATUS_OK,
58 BT_MESSAGE_ITERATOR_CAN_SEEK_BEGINNING_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
59 BT_MESSAGE_ITERATOR_CAN_SEEK_BEGINNING_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
60 BT_MESSAGE_ITERATOR_CAN_SEEK_BEGINNING_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
61} bt_message_iterator_can_seek_beginning_status;
62
63typedef enum bt_message_iterator_can_seek_ns_from_origin_status {
64 BT_MESSAGE_ITERATOR_CAN_SEEK_NS_FROM_ORIGIN_STATUS_OK = __BT_FUNC_STATUS_OK,
65 BT_MESSAGE_ITERATOR_CAN_SEEK_NS_FROM_ORIGIN_STATUS_AGAIN = __BT_FUNC_STATUS_AGAIN,
66 BT_MESSAGE_ITERATOR_CAN_SEEK_NS_FROM_ORIGIN_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
67 BT_MESSAGE_ITERATOR_CAN_SEEK_NS_FROM_ORIGIN_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
68} bt_message_iterator_can_seek_ns_from_origin_status;
69
9a2c8b8e
PP
70typedef enum bt_message_iterator_create_from_message_iterator_status {
71 BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_OK = __BT_FUNC_STATUS_OK,
72 BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
73 BT_MESSAGE_ITERATOR_CREATE_FROM_MESSAGE_ITERATOR_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
74} bt_message_iterator_create_from_message_iterator_status;
75
76typedef enum bt_message_iterator_create_from_sink_component_status {
77 BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK = __BT_FUNC_STATUS_OK,
78 BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_ERROR = __BT_FUNC_STATUS_ERROR,
79 BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_MEMORY_ERROR = __BT_FUNC_STATUS_MEMORY_ERROR,
80} bt_message_iterator_create_from_sink_component_status;
81
82static inline
83bt_message_iterator *
84bt_message_iterator_as_message_iterator(
85 bt_message_iterator *iterator)
86{
87 return __BT_UPCAST(bt_message_iterator, iterator);
88}
89
90extern bt_message_iterator_create_from_message_iterator_status
91bt_message_iterator_create_from_message_iterator(
92 bt_self_message_iterator *self_msg_iter,
93 bt_self_component_port_input *input_port,
94 bt_message_iterator **message_iterator);
95
96extern bt_message_iterator_create_from_sink_component_status
97bt_message_iterator_create_from_sink_component(
98 bt_self_component_sink *self_comp,
99 bt_self_component_port_input *input_port,
100 bt_message_iterator **message_iterator);
101
102extern bt_component *
103bt_message_iterator_borrow_component(
104 bt_message_iterator *iterator);
105
106extern bt_message_iterator_next_status
107bt_message_iterator_next(
108 bt_message_iterator *iterator,
109 bt_message_array_const *msgs, uint64_t *count);
110
111extern bt_message_iterator_can_seek_ns_from_origin_status
112bt_message_iterator_can_seek_ns_from_origin(
113 bt_message_iterator *iterator,
114 int64_t ns_from_origin, bt_bool *can_seek);
115
116extern bt_message_iterator_can_seek_beginning_status
117bt_message_iterator_can_seek_beginning(
118 bt_message_iterator *iterator,
119 bt_bool *can_seek);
120
121extern bt_message_iterator_seek_ns_from_origin_status
122bt_message_iterator_seek_ns_from_origin(
123 bt_message_iterator *iterator,
124 int64_t ns_from_origin);
125
126extern bt_message_iterator_seek_beginning_status
127bt_message_iterator_seek_beginning(
128 bt_message_iterator *iterator);
129
130extern bt_bool
131bt_message_iterator_can_seek_forward(
132 bt_message_iterator *iterator);
133
134extern void bt_message_iterator_get_ref(
135 const bt_message_iterator *message_iterator);
136
137extern void bt_message_iterator_put_ref(
138 const bt_message_iterator *message_iterator);
139
140#define BT_MESSAGE_ITERATOR_PUT_REF_AND_RESET(_var) \
141 do { \
142 bt_message_iterator_put_ref(_var); \
143 (_var) = NULL; \
144 } while (0)
145
146#define BT_MESSAGE_ITERATOR_MOVE_REF(_var_dst, _var_src) \
147 do { \
148 bt_message_iterator_put_ref(_var_dst); \
149 (_var_dst) = (_var_src); \
150 (_var_src) = NULL; \
151 } while (0)
152
d24d5663
PP
153#ifdef __cplusplus
154}
155#endif
156
924dc299 157#endif /* BABELTRACE2_GRAPH_MESSAGE_ITERATOR_H */
This page took 0.043554 seconds and 4 git commands to generate.