Commit | Line | Data |
---|---|---|
924dc299 PP |
1 | #ifndef BABELTRACE2_GRAPH_COMPONENT_CLASS_SOURCE_H |
2 | #define BABELTRACE2_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 | ||
4fa90f32 PP |
27 | #ifndef __BT_IN_BABELTRACE_H |
28 | # error "Please include <babeltrace2/babeltrace.h> instead." | |
29 | #endif | |
30 | ||
0d72b8c3 PP |
31 | #include <stdint.h> |
32 | ||
3fadfbc0 | 33 | #include <babeltrace2/graph/component-class.h> |
3fadfbc0 | 34 | #include <babeltrace2/types.h> |
f4e38e70 PP |
35 | #include <babeltrace2/logging.h> |
36 | ||
d3e4dcd8 PP |
37 | #ifdef __cplusplus |
38 | extern "C" { | |
39 | #endif | |
40 | ||
d24d5663 | 41 | typedef bt_component_class_init_method_status |
0d72b8c3 | 42 | (*bt_component_class_source_init_method)( |
b19ff26f PP |
43 | bt_self_component_source *self_component, |
44 | const bt_value *params, void *init_method_data); | |
0d72b8c3 PP |
45 | |
46 | typedef void (*bt_component_class_source_finalize_method)( | |
b19ff26f | 47 | bt_self_component_source *self_component); |
0d72b8c3 | 48 | |
d24d5663 | 49 | typedef bt_component_class_message_iterator_init_method_status |
d6e69534 PP |
50 | (*bt_component_class_source_message_iterator_init_method)( |
51 | bt_self_message_iterator *message_iterator, | |
b19ff26f PP |
52 | bt_self_component_source *self_component, |
53 | bt_self_component_port_output *port); | |
0d72b8c3 PP |
54 | |
55 | typedef void | |
d6e69534 PP |
56 | (*bt_component_class_source_message_iterator_finalize_method)( |
57 | bt_self_message_iterator *message_iterator); | |
0d72b8c3 | 58 | |
d24d5663 | 59 | typedef bt_component_class_message_iterator_next_method_status |
d6e69534 PP |
60 | (*bt_component_class_source_message_iterator_next_method)( |
61 | bt_self_message_iterator *message_iterator, | |
62 | bt_message_array_const msgs, uint64_t capacity, | |
0d72b8c3 PP |
63 | uint64_t *count); |
64 | ||
d24d5663 | 65 | typedef bt_component_class_message_iterator_seek_ns_from_origin_method_status |
7474e7d3 PP |
66 | (*bt_component_class_source_message_iterator_seek_ns_from_origin_method)( |
67 | bt_self_message_iterator *message_iterator, | |
68 | int64_t ns_from_origin); | |
69 | ||
d24d5663 | 70 | typedef bt_component_class_message_iterator_seek_beginning_method_status |
7474e7d3 PP |
71 | (*bt_component_class_source_message_iterator_seek_beginning_method)( |
72 | bt_self_message_iterator *message_iterator); | |
73 | ||
74 | typedef bt_bool | |
75 | (*bt_component_class_source_message_iterator_can_seek_ns_from_origin_method)( | |
76 | bt_self_message_iterator *message_iterator, | |
77 | int64_t ns_from_origin); | |
78 | ||
79 | typedef bt_bool | |
80 | (*bt_component_class_source_message_iterator_can_seek_beginning_method)( | |
81 | bt_self_message_iterator *message_iterator); | |
82 | ||
d24d5663 PP |
83 | typedef bt_component_class_query_method_status |
84 | (*bt_component_class_source_query_method)( | |
b19ff26f PP |
85 | bt_self_component_class_source *comp_class, |
86 | const bt_query_executor *query_executor, | |
87 | const char *object, const bt_value *params, | |
f4e38e70 | 88 | bt_logging_level logging_level, |
b19ff26f | 89 | const bt_value **result); |
0d72b8c3 | 90 | |
d24d5663 | 91 | typedef bt_component_class_port_connected_method_status |
0d72b8c3 | 92 | (*bt_component_class_source_output_port_connected_method)( |
b19ff26f PP |
93 | bt_self_component_source *self_component, |
94 | bt_self_component_port_output *self_port, | |
95 | const bt_port_input *other_port); | |
0d72b8c3 | 96 | |
d94d92ac | 97 | static inline |
b19ff26f PP |
98 | bt_component_class *bt_component_class_source_as_component_class( |
99 | bt_component_class_source *comp_cls_source) | |
d94d92ac | 100 | { |
005f1204 | 101 | return __BT_UPCAST(bt_component_class, comp_cls_source); |
d94d92ac | 102 | } |
d3eb6e8f | 103 | |
0d72b8c3 | 104 | extern |
b19ff26f | 105 | bt_component_class_source *bt_component_class_source_create( |
0d72b8c3 | 106 | const char *name, |
d6e69534 | 107 | bt_component_class_source_message_iterator_next_method method); |
0d72b8c3 | 108 | |
d24d5663 | 109 | extern bt_component_class_set_method_status |
d0cf29ee | 110 | bt_component_class_source_set_init_method( |
b19ff26f | 111 | bt_component_class_source *comp_class, |
0d72b8c3 PP |
112 | bt_component_class_source_init_method method); |
113 | ||
d24d5663 | 114 | extern bt_component_class_set_method_status |
d0cf29ee | 115 | bt_component_class_source_set_finalize_method( |
b19ff26f | 116 | bt_component_class_source *comp_class, |
0d72b8c3 PP |
117 | bt_component_class_source_finalize_method method); |
118 | ||
d24d5663 | 119 | extern bt_component_class_set_method_status |
d0cf29ee | 120 | bt_component_class_source_set_output_port_connected_method( |
b19ff26f | 121 | bt_component_class_source *comp_class, |
0d72b8c3 PP |
122 | bt_component_class_source_output_port_connected_method method); |
123 | ||
d24d5663 | 124 | extern bt_component_class_set_method_status |
d0cf29ee | 125 | bt_component_class_source_set_query_method( |
b19ff26f | 126 | bt_component_class_source *comp_class, |
0d72b8c3 PP |
127 | bt_component_class_source_query_method method); |
128 | ||
d24d5663 | 129 | extern bt_component_class_set_method_status |
d0cf29ee | 130 | bt_component_class_source_set_message_iterator_init_method( |
b19ff26f | 131 | bt_component_class_source *comp_class, |
d6e69534 | 132 | bt_component_class_source_message_iterator_init_method method); |
0d72b8c3 | 133 | |
d24d5663 | 134 | extern bt_component_class_set_method_status |
d0cf29ee | 135 | bt_component_class_source_set_message_iterator_finalize_method( |
b19ff26f | 136 | bt_component_class_source *comp_class, |
d6e69534 | 137 | bt_component_class_source_message_iterator_finalize_method method); |
0d72b8c3 | 138 | |
d24d5663 | 139 | extern bt_component_class_set_method_status |
7474e7d3 PP |
140 | bt_component_class_source_set_message_iterator_seek_ns_from_origin_method( |
141 | bt_component_class_source *comp_class, | |
142 | bt_component_class_source_message_iterator_seek_ns_from_origin_method method); | |
143 | ||
d24d5663 | 144 | extern bt_component_class_set_method_status |
7474e7d3 PP |
145 | bt_component_class_source_set_message_iterator_seek_beginning_method( |
146 | bt_component_class_source *comp_class, | |
147 | bt_component_class_source_message_iterator_seek_beginning_method method); | |
148 | ||
d24d5663 | 149 | extern bt_component_class_set_method_status |
7474e7d3 PP |
150 | bt_component_class_source_set_message_iterator_can_seek_ns_from_origin_method( |
151 | bt_component_class_source *comp_class, | |
152 | bt_component_class_source_message_iterator_can_seek_ns_from_origin_method method); | |
153 | ||
d24d5663 | 154 | extern bt_component_class_set_method_status |
7474e7d3 PP |
155 | bt_component_class_source_set_message_iterator_can_seek_beginning_method( |
156 | bt_component_class_source *comp_class, | |
157 | bt_component_class_source_message_iterator_can_seek_beginning_method method); | |
158 | ||
d3e4dcd8 PP |
159 | #ifdef __cplusplus |
160 | } | |
161 | #endif | |
162 | ||
924dc299 | 163 | #endif /* BABELTRACE2_GRAPH_COMPONENT_CLASS_SOURCE_H */ |