Commit | Line | Data |
---|---|---|
1ca80abd PP |
1 | #ifndef BABELTRACE_GRAPH_COMPONENT_CLASS_SOURCE_H |
2 | #define BABELTRACE_GRAPH_COMPONENT_CLASS_SOURCE_H | |
d3e4dcd8 PP |
3 | |
4 | /* | |
e2f7325d | 5 | * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com> |
d3e4dcd8 PP |
6 | * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
7 | * | |
8 | * Permission is hereby granted, free of charge, to any person obtaining a copy | |
9 | * of this software and associated documentation files (the "Software"), to deal | |
10 | * in the Software without restriction, including without limitation the rights | |
11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
12 | * copies of the Software, and to permit persons to whom the Software is | |
13 | * furnished to do so, subject to the following conditions: | |
14 | * | |
15 | * The above copyright notice and this permission notice shall be included in | |
16 | * all copies or substantial portions of the Software. | |
17 | * | |
18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |
24 | * SOFTWARE. | |
25 | */ | |
26 | ||
0d72b8c3 PP |
27 | #include <stdint.h> |
28 | ||
4cdfc5e8 | 29 | /* For bt_self_component_status */ |
0d72b8c3 PP |
30 | #include <babeltrace/graph/self-component.h> |
31 | ||
4cdfc5e8 | 32 | /* For bt_self_message_iterator_status */ |
d6e69534 | 33 | #include <babeltrace/graph/self-message-iterator.h> |
0d72b8c3 | 34 | |
4cdfc5e8 | 35 | /* For bt_query_status */ |
0d72b8c3 PP |
36 | #include <babeltrace/graph/component-class.h> |
37 | ||
d0cf29ee PP |
38 | /* For bt_component_class_status */ |
39 | #include <babeltrace/graph/component-class-const.h> | |
40 | ||
b19ff26f PP |
41 | /* |
42 | * For bt_component_class, bt_component_class_source, bt_port_input, | |
43 | * bt_query_executor, bt_self_component_class_source, | |
44 | * bt_self_component_source, bt_self_component_port_output, bt_value, | |
d6e69534 | 45 | * bt_message_array_const |
b19ff26f PP |
46 | */ |
47 | #include <babeltrace/types.h> | |
48 | ||
d3e4dcd8 PP |
49 | #ifdef __cplusplus |
50 | extern "C" { | |
51 | #endif | |
52 | ||
4cdfc5e8 | 53 | typedef bt_self_component_status |
0d72b8c3 | 54 | (*bt_component_class_source_init_method)( |
b19ff26f PP |
55 | bt_self_component_source *self_component, |
56 | const bt_value *params, void *init_method_data); | |
0d72b8c3 PP |
57 | |
58 | typedef void (*bt_component_class_source_finalize_method)( | |
b19ff26f | 59 | bt_self_component_source *self_component); |
0d72b8c3 | 60 | |
4cdfc5e8 | 61 | typedef bt_self_message_iterator_status |
d6e69534 PP |
62 | (*bt_component_class_source_message_iterator_init_method)( |
63 | bt_self_message_iterator *message_iterator, | |
b19ff26f PP |
64 | bt_self_component_source *self_component, |
65 | bt_self_component_port_output *port); | |
0d72b8c3 PP |
66 | |
67 | typedef void | |
d6e69534 PP |
68 | (*bt_component_class_source_message_iterator_finalize_method)( |
69 | bt_self_message_iterator *message_iterator); | |
0d72b8c3 | 70 | |
4cdfc5e8 | 71 | typedef bt_self_message_iterator_status |
d6e69534 PP |
72 | (*bt_component_class_source_message_iterator_next_method)( |
73 | bt_self_message_iterator *message_iterator, | |
74 | bt_message_array_const msgs, uint64_t capacity, | |
0d72b8c3 PP |
75 | uint64_t *count); |
76 | ||
4cdfc5e8 | 77 | typedef bt_query_status (*bt_component_class_source_query_method)( |
b19ff26f PP |
78 | bt_self_component_class_source *comp_class, |
79 | const bt_query_executor *query_executor, | |
80 | const char *object, const bt_value *params, | |
81 | const bt_value **result); | |
0d72b8c3 | 82 | |
4cdfc5e8 | 83 | typedef bt_self_component_status |
0d72b8c3 | 84 | (*bt_component_class_source_accept_output_port_connection_method)( |
b19ff26f PP |
85 | bt_self_component_source *self_component, |
86 | bt_self_component_port_output *self_port, | |
87 | const bt_port_input *other_port); | |
0d72b8c3 | 88 | |
4cdfc5e8 | 89 | typedef bt_self_component_status |
0d72b8c3 | 90 | (*bt_component_class_source_output_port_connected_method)( |
b19ff26f PP |
91 | bt_self_component_source *self_component, |
92 | bt_self_component_port_output *self_port, | |
93 | const bt_port_input *other_port); | |
0d72b8c3 | 94 | |
d94d92ac | 95 | static inline |
b19ff26f PP |
96 | bt_component_class *bt_component_class_source_as_component_class( |
97 | bt_component_class_source *comp_cls_source) | |
d94d92ac PP |
98 | { |
99 | return (void *) comp_cls_source; | |
100 | } | |
d3eb6e8f | 101 | |
0d72b8c3 | 102 | extern |
b19ff26f | 103 | bt_component_class_source *bt_component_class_source_create( |
0d72b8c3 | 104 | const char *name, |
d6e69534 | 105 | bt_component_class_source_message_iterator_next_method method); |
0d72b8c3 | 106 | |
d0cf29ee PP |
107 | extern bt_component_class_status |
108 | bt_component_class_source_set_init_method( | |
b19ff26f | 109 | bt_component_class_source *comp_class, |
0d72b8c3 PP |
110 | bt_component_class_source_init_method method); |
111 | ||
d0cf29ee PP |
112 | extern bt_component_class_status |
113 | bt_component_class_source_set_finalize_method( | |
b19ff26f | 114 | bt_component_class_source *comp_class, |
0d72b8c3 PP |
115 | bt_component_class_source_finalize_method method); |
116 | ||
d0cf29ee PP |
117 | extern bt_component_class_status |
118 | bt_component_class_source_set_accept_output_port_connection_method( | |
b19ff26f | 119 | bt_component_class_source *comp_class, |
0d72b8c3 PP |
120 | bt_component_class_source_accept_output_port_connection_method method); |
121 | ||
d0cf29ee PP |
122 | extern bt_component_class_status |
123 | bt_component_class_source_set_output_port_connected_method( | |
b19ff26f | 124 | bt_component_class_source *comp_class, |
0d72b8c3 PP |
125 | bt_component_class_source_output_port_connected_method method); |
126 | ||
d0cf29ee PP |
127 | extern bt_component_class_status |
128 | bt_component_class_source_set_query_method( | |
b19ff26f | 129 | bt_component_class_source *comp_class, |
0d72b8c3 PP |
130 | bt_component_class_source_query_method method); |
131 | ||
d0cf29ee PP |
132 | extern bt_component_class_status |
133 | bt_component_class_source_set_message_iterator_init_method( | |
b19ff26f | 134 | bt_component_class_source *comp_class, |
d6e69534 | 135 | bt_component_class_source_message_iterator_init_method method); |
0d72b8c3 | 136 | |
d0cf29ee PP |
137 | extern bt_component_class_status |
138 | bt_component_class_source_set_message_iterator_finalize_method( | |
b19ff26f | 139 | bt_component_class_source *comp_class, |
d6e69534 | 140 | bt_component_class_source_message_iterator_finalize_method method); |
0d72b8c3 | 141 | |
d3e4dcd8 PP |
142 | #ifdef __cplusplus |
143 | } | |
144 | #endif | |
145 | ||
1ca80abd | 146 | #endif /* BABELTRACE_GRAPH_COMPONENT_CLASS_SOURCE_H */ |