Commit | Line | Data |
---|---|---|
d94d92ac | 1 | /* |
0235b0db | 2 | * SPDX-License-Identifier: MIT |
d94d92ac | 3 | * |
0235b0db | 4 | * Copyright (C) 2010-2019 EfficiOS Inc. and Linux Foundation |
d94d92ac PP |
5 | */ |
6 | ||
0235b0db MJ |
7 | #ifndef BABELTRACE2_GRAPH_SELF_MESSAGE_ITERATOR_H |
8 | #define BABELTRACE2_GRAPH_SELF_MESSAGE_ITERATOR_H | |
9 | ||
f38da6ca SM |
10 | /* IWYU pragma: private, include <babeltrace2/babeltrace.h> */ |
11 | ||
4fa90f32 PP |
12 | #ifndef __BT_IN_BABELTRACE_H |
13 | # error "Please include <babeltrace2/babeltrace.h> instead." | |
14 | #endif | |
15 | ||
3fadfbc0 | 16 | #include <babeltrace2/types.h> |
b19ff26f | 17 | |
d94d92ac PP |
18 | #ifdef __cplusplus |
19 | extern "C" { | |
20 | #endif | |
21 | ||
43c59509 PP |
22 | /*! |
23 | @defgroup api-self-msg-iter Self message iterator | |
24 | @ingroup api-msg-iter-cls | |
25 | ||
26 | @brief | |
27 | Private view of a \bt_msg_iter for methods. | |
28 | ||
29 | The #bt_self_message_iterator type is a private view of a \bt_msg_iter | |
30 | from within a \bt_msg_iter_cls method. | |
31 | ||
32 | Borrow the \bt_comp which provides a message iterator with | |
33 | bt_self_message_iterator_borrow_component(). | |
34 | ||
35 | Borrow the \bt_oport on which a message iterator operates with | |
36 | bt_self_message_iterator_borrow_port(). | |
37 | ||
38 | Set and get user data attached to a message iterator with | |
39 | bt_self_message_iterator_set_data() and | |
40 | bt_self_message_iterator_get_data(). | |
41 | ||
42 | Check whether or not a message iterator is interrupted with | |
43 | bt_self_message_iterator_is_interrupted(). | |
44 | ||
45 | Set whether or not a message iterator can seek forward with | |
46 | bt_self_message_iterator_configuration_set_can_seek_forward(). | |
47 | */ | |
48 | ||
49 | /*! @{ */ | |
50 | ||
51 | /*! | |
52 | @name Types | |
53 | @{ | |
54 | ||
55 | @typedef struct bt_self_message_iterator bt_self_message_iterator; | |
56 | ||
57 | @brief | |
58 | Self \bt_msg_iter. | |
59 | ||
60 | @typedef struct bt_self_message_iterator_configuration bt_self_message_iterator_configuration; | |
9b4f9b42 | 61 | |
43c59509 PP |
62 | @brief |
63 | Self \bt_msg_iter configuration. | |
64 | ||
65 | @} | |
66 | */ | |
67 | ||
68 | /*! | |
69 | @name Component access | |
70 | @{ | |
71 | */ | |
72 | ||
73 | /*! | |
74 | @brief | |
75 | Borrows the \bt_comp which provides the \bt_msg_iter | |
76 | \bt_p{self_message_iterator}. | |
77 | ||
78 | @param[in] self_message_iterator | |
79 | Message iterator instance. | |
80 | ||
81 | @returns | |
82 | Component which provides \bt_p{self_message_iterator}. | |
83 | ||
84 | @bt_pre_not_null{self_message_iterator} | |
85 | */ | |
b19ff26f | 86 | extern bt_self_component * |
d6e69534 | 87 | bt_self_message_iterator_borrow_component( |
43c59509 | 88 | bt_self_message_iterator *self_message_iterator); |
d94d92ac | 89 | |
43c59509 PP |
90 | /*! @} */ |
91 | ||
92 | /*! | |
93 | @name Output port access | |
94 | @{ | |
95 | */ | |
96 | ||
97 | /*! | |
98 | @brief | |
99 | Borrows the \bt_oport on which the \bt_msg_iter | |
100 | \bt_p{self_message_iterator} operates. | |
101 | ||
102 | @param[in] self_message_iterator | |
103 | Message iterator instance. | |
104 | ||
105 | @returns | |
106 | Output port on which \bt_p{self_message_iterator} operates. | |
107 | ||
108 | @bt_pre_not_null{self_message_iterator} | |
109 | */ | |
50e763f6 | 110 | extern bt_self_component_port_output * |
d6e69534 | 111 | bt_self_message_iterator_borrow_port( |
43c59509 PP |
112 | bt_self_message_iterator *self_message_iterator); |
113 | ||
114 | /*! @} */ | |
d94d92ac | 115 | |
43c59509 PP |
116 | /*! |
117 | @name User data | |
118 | @{ | |
119 | */ | |
120 | ||
121 | /*! | |
122 | @brief | |
123 | Sets the user data of the \bt_msg_iter \bt_p{self_message_iterator} | |
124 | to \bt_p{data}. | |
125 | ||
126 | @param[in] self_message_iterator | |
127 | Message iterator instance. | |
128 | @param[in] user_data | |
129 | New user data of \bt_p{self_message_iterator}. | |
130 | ||
131 | @bt_pre_not_null{self_message_iterator} | |
132 | ||
133 | @sa bt_self_message_iterator_get_data() — | |
134 | Returns the user data of a message iterator. | |
135 | */ | |
d6e69534 | 136 | extern void bt_self_message_iterator_set_data( |
43c59509 | 137 | bt_self_message_iterator *self_message_iterator, |
d94d92ac PP |
138 | void *user_data); |
139 | ||
43c59509 PP |
140 | /*! |
141 | @brief | |
142 | Returns the user data of the \bt_msg_iter | |
143 | \bt_p{self_message_iterator}. | |
144 | ||
145 | @param[in] self_message_iterator | |
146 | Message iterator instance. | |
147 | ||
148 | @returns | |
149 | User data of \bt_p{self_message_iterator}. | |
150 | ||
151 | @bt_pre_not_null{self_message_iterator} | |
152 | ||
153 | @sa bt_self_message_iterator_set_data() — | |
154 | Sets the user data of a message iterator. | |
155 | */ | |
156 | extern | |
157 | void *bt_self_message_iterator_get_data( | |
158 | const bt_self_message_iterator *self_message_iterator); | |
159 | ||
160 | /*! @} */ | |
161 | ||
162 | /*! | |
163 | @name Interruption query | |
164 | @{ | |
165 | */ | |
166 | ||
167 | /*! | |
168 | @brief | |
169 | Returns whether or not the \bt_msg_iter \bt_p{self_message_iterator} | |
170 | is interrupted, that is, whether or not any of its \bt_p_intr | |
171 | is set. | |
172 | ||
173 | @param[in] self_message_iterator | |
174 | Message iterator instance. | |
175 | ||
176 | @returns | |
177 | #BT_TRUE if \bt_p{self_message_iterator} is interrupted (any of its | |
178 | interrupters is set). | |
d94d92ac | 179 | |
43c59509 PP |
180 | @bt_pre_not_null{self_message_iterator} |
181 | ||
182 | @sa bt_graph_borrow_default_interrupter() — | |
183 | Borrows a trace processing graph's default interrupter. | |
184 | @sa bt_graph_add_interrupter() — | |
185 | Adds an interrupter to a graph. | |
186 | */ | |
187 | extern bt_bool bt_self_message_iterator_is_interrupted( | |
188 | const bt_self_message_iterator *self_message_iterator); | |
189 | ||
190 | /*! @} */ | |
191 | ||
192 | /*! | |
193 | @name Configuration | |
194 | @{ | |
195 | */ | |
196 | ||
197 | /*! | |
198 | @brief | |
199 | Sets whether or not the \bt_msg_iter of which the configuration | |
200 | is \bt_p{configuration} can seek forward. | |
201 | ||
202 | A message iterator can seek forward if all the \bt_p_msg of its | |
203 | message sequence have some \bt_cs. | |
204 | ||
205 | @attention | |
206 | You can only call this function during the execution of a | |
207 | message iterator's | |
208 | \ref api-msg-iter-cls-meth-init "initialization method". | |
209 | ||
210 | @param[in] configuration | |
211 | Configuration of the message iterator of which to set whether or | |
212 | not it can seek forward. | |
213 | @param[in] can_seek_forward | |
214 | #BT_TRUE to make the message iterator of which the configuration is | |
215 | \bt_p{configuration} forward-seekable. | |
216 | ||
217 | @bt_pre_not_null{configuration} | |
218 | ||
219 | @sa bt_message_iterator_can_seek_forward() — | |
220 | Returns whether or not a message iterator can seek forward. | |
221 | */ | |
8d8b141d | 222 | extern void bt_self_message_iterator_configuration_set_can_seek_forward( |
43c59509 | 223 | bt_self_message_iterator_configuration *configuration, |
8d8b141d SM |
224 | bt_bool can_seek_forward); |
225 | ||
43c59509 PP |
226 | /*! @} */ |
227 | ||
228 | /*! @} */ | |
229 | ||
d94d92ac PP |
230 | #ifdef __cplusplus |
231 | } | |
232 | #endif | |
233 | ||
924dc299 | 234 | #endif /* BABELTRACE2_GRAPH_SELF_MESSAGE_ITERATOR_H */ |