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 | /* | |
d3e4dcd8 PP |
5 | * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
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 | ||
7b53201c PP |
26 | #include <stdint.h> |
27 | ||
28 | /* For enum bt_notification_array_const */ | |
29 | #include <babeltrace/graph/notification-const.h> | |
30 | ||
31 | /* For enum bt_self_component_status */ | |
32 | #include <babeltrace/graph/self-component.h> | |
33 | ||
34 | /* For enum bt_self_notification_iterator_status */ | |
35 | #include <babeltrace/graph/self-notification-iterator.h> | |
36 | ||
37 | /* For enum bt_query_status */ | |
38 | #include <babeltrace/graph/component-class.h> | |
39 | ||
d3e4dcd8 PP |
40 | #ifdef __cplusplus |
41 | extern "C" { | |
42 | #endif | |
43 | ||
7b53201c PP |
44 | struct bt_self_component_class_source; |
45 | struct bt_component_class_source; | |
46 | struct bt_self_component_source; | |
834e9996 | 47 | struct bt_component_class_source; |
7b53201c PP |
48 | struct bt_self_component_port_output; |
49 | struct bt_port_input; | |
50 | struct bt_query_executor; | |
51 | struct bt_value; | |
52 | ||
53 | typedef enum bt_self_component_status | |
54 | (*bt_component_class_source_init_method)( | |
55 | struct bt_self_component_source *self_component, | |
56 | const struct bt_value *params, void *init_method_data); | |
57 | ||
58 | typedef void (*bt_component_class_source_finalize_method)( | |
59 | struct bt_self_component_source *self_component); | |
60 | ||
61 | typedef enum bt_self_notification_iterator_status | |
62 | (*bt_component_class_source_notification_iterator_init_method)( | |
63 | struct bt_self_notification_iterator *notification_iterator, | |
64 | struct bt_self_component_source *self_component, | |
65 | struct bt_self_component_port_output *port); | |
66 | ||
67 | typedef void | |
68 | (*bt_component_class_source_notification_iterator_finalize_method)( | |
69 | struct bt_self_notification_iterator *notification_iterator); | |
70 | ||
71 | typedef enum bt_self_notification_iterator_status | |
72 | (*bt_component_class_source_notification_iterator_next_method)( | |
73 | struct bt_self_notification_iterator *notification_iterator, | |
74 | bt_notification_array_const notifs, uint64_t capacity, | |
75 | uint64_t *count); | |
76 | ||
77 | typedef enum bt_query_status | |
78 | (*bt_component_class_source_query_method)( | |
79 | struct bt_self_component_class_source *comp_class, | |
80 | const struct bt_query_executor *query_executor, | |
81 | const char *object, const struct bt_value *params, | |
82 | const struct bt_value **result); | |
83 | ||
84 | typedef enum bt_self_component_status | |
85 | (*bt_component_class_source_accept_output_port_connection_method)( | |
86 | struct bt_self_component_source *self_component, | |
87 | struct bt_self_component_port_output *self_port, | |
88 | const struct bt_port_input *other_port); | |
89 | ||
90 | typedef enum bt_self_component_status | |
91 | (*bt_component_class_source_output_port_connected_method)( | |
92 | struct bt_self_component_source *self_component, | |
93 | struct bt_self_component_port_output *self_port, | |
94 | const struct bt_port_input *other_port); | |
95 | ||
96 | typedef void | |
97 | (*bt_component_class_source_output_port_disconnected_method)( | |
98 | struct bt_self_component_source *self_component, | |
99 | struct bt_self_component_port_output *self_port); | |
834e9996 PP |
100 | |
101 | static inline | |
7b53201c | 102 | struct bt_component_class *bt_component_class_source_as_component_class( |
834e9996 PP |
103 | struct bt_component_class_source *comp_cls_source) |
104 | { | |
105 | return (void *) comp_cls_source; | |
106 | } | |
d3eb6e8f | 107 | |
7b53201c PP |
108 | extern |
109 | struct bt_component_class_source *bt_component_class_source_create( | |
110 | const char *name, | |
111 | bt_component_class_source_notification_iterator_next_method method); | |
112 | ||
113 | extern int bt_component_class_source_set_init_method( | |
114 | struct bt_component_class_source *comp_class, | |
115 | bt_component_class_source_init_method method); | |
116 | ||
117 | extern int bt_component_class_source_set_finalize_method( | |
118 | struct bt_component_class_source *comp_class, | |
119 | bt_component_class_source_finalize_method method); | |
120 | ||
121 | extern int bt_component_class_source_set_accept_output_port_connection_method( | |
122 | struct bt_component_class_source *comp_class, | |
123 | bt_component_class_source_accept_output_port_connection_method method); | |
124 | ||
125 | extern int bt_component_class_source_set_output_port_connected_method( | |
126 | struct bt_component_class_source *comp_class, | |
127 | bt_component_class_source_output_port_connected_method method); | |
128 | ||
129 | extern int bt_component_class_source_set_output_port_disconnected_method( | |
130 | struct bt_component_class_source *comp_class, | |
131 | bt_component_class_source_output_port_disconnected_method method); | |
132 | ||
133 | extern int bt_component_class_source_set_query_method( | |
134 | struct bt_component_class_source *comp_class, | |
135 | bt_component_class_source_query_method method); | |
136 | ||
137 | extern int bt_component_class_source_set_notification_iterator_init_method( | |
138 | struct bt_component_class_source *comp_class, | |
139 | bt_component_class_source_notification_iterator_init_method method); | |
140 | ||
141 | extern int bt_component_class_source_set_notification_iterator_finalize_method( | |
142 | struct bt_component_class_source *comp_class, | |
143 | bt_component_class_source_notification_iterator_finalize_method method); | |
144 | ||
d3e4dcd8 PP |
145 | #ifdef __cplusplus |
146 | } | |
147 | #endif | |
148 | ||
1ca80abd | 149 | #endif /* BABELTRACE_GRAPH_COMPONENT_CLASS_SOURCE_H */ |