Commit | Line | Data |
---|---|---|
834e9996 PP |
1 | #ifndef BABELTRACE_GRAPH_PRIVATE_COMPONENT_CLASS_SINK_H |
2 | #define BABELTRACE_GRAPH_PRIVATE_COMPONENT_CLASS_SINK_H | |
3 | ||
4 | /* | |
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 | ||
26 | #include <stdint.h> | |
27 | ||
28 | /* For enum bt_notification_array */ | |
29 | #include <babeltrace/graph/notification.h> | |
30 | ||
31 | /* For enum bt_self_component_status */ | |
32 | #include <babeltrace/graph/self-component.h> | |
33 | ||
34 | /* For enum bt_query_status */ | |
35 | #include <babeltrace/graph/query-executor.h> | |
36 | ||
37 | /* For struct bt_private_component_class_query_method_return */ | |
38 | #include <babeltrace/graph/private-component-class.h> | |
39 | ||
40 | #ifdef __cplusplus | |
41 | extern "C" { | |
42 | #endif | |
43 | ||
44 | struct bt_self_component_class_sink; | |
45 | struct bt_component_class_sink; | |
46 | struct bt_self_component_sink; | |
47 | struct bt_private_component_class; | |
48 | struct bt_private_component_class_sink; | |
49 | struct bt_self_component_port_input; | |
50 | struct bt_port_output; | |
51 | struct bt_query_executor; | |
52 | struct bt_value; | |
53 | ||
54 | typedef enum bt_self_component_status | |
55 | (*bt_private_component_class_sink_init_method)( | |
56 | struct bt_self_component_sink *self_component, | |
57 | struct bt_value *params, void *init_method_data); | |
58 | ||
59 | typedef void (*bt_private_component_class_sink_finalize_method)( | |
60 | struct bt_self_component_sink *self_component); | |
61 | ||
62 | typedef enum bt_query_status | |
63 | (*bt_private_component_class_sink_query_method)( | |
64 | struct bt_self_component_class_sink *comp_class, | |
65 | struct bt_query_executor *query_executor, | |
66 | const char *object, struct bt_value *params, | |
67 | struct bt_value **result); | |
68 | ||
69 | typedef enum bt_self_component_status | |
70 | (*bt_private_component_class_sink_accept_input_port_connection_method)( | |
71 | struct bt_self_component_sink *self_component, | |
72 | struct bt_self_component_port_input *self_port, | |
73 | struct bt_port_output *other_port); | |
74 | ||
75 | typedef enum bt_self_component_status | |
76 | (*bt_private_component_class_sink_input_port_connected_method)( | |
77 | struct bt_self_component_sink *self_component, | |
78 | struct bt_self_component_port_input *self_port, | |
79 | struct bt_port_output *other_port); | |
80 | ||
81 | typedef void | |
82 | (*bt_private_component_class_sink_input_port_disconnected_method)( | |
83 | struct bt_self_component_sink *self_component, | |
84 | struct bt_self_component_port_input *self_port); | |
85 | ||
86 | typedef enum bt_self_component_status | |
87 | (*bt_private_component_class_sink_consume_method)( | |
88 | struct bt_self_component_sink *self_component); | |
89 | ||
90 | static inline | |
91 | struct bt_private_component_class * | |
bb61965b | 92 | bt_private_component_class_sink_as_private_component_class( |
834e9996 PP |
93 | struct bt_private_component_class_sink *priv_comp_cls_sink) |
94 | { | |
95 | return (void *) priv_comp_cls_sink; | |
96 | } | |
97 | ||
98 | static inline | |
99 | struct bt_component_class_sink * | |
bb61965b | 100 | bt_private_component_class_sink_as_component_class_sink( |
834e9996 PP |
101 | struct bt_private_component_class_sink *priv_comp_cls_sink) |
102 | { | |
103 | return (void *) priv_comp_cls_sink; | |
104 | } | |
105 | ||
106 | extern | |
107 | struct bt_private_component_class_sink *bt_private_component_class_sink_create( | |
108 | const char *name, | |
109 | bt_private_component_class_sink_consume_method method); | |
110 | ||
111 | extern int bt_private_component_class_sink_set_init_method( | |
112 | struct bt_private_component_class_sink *comp_class, | |
113 | bt_private_component_class_sink_init_method method); | |
114 | ||
115 | extern int bt_private_component_class_sink_set_finalize_method( | |
116 | struct bt_private_component_class_sink *comp_class, | |
117 | bt_private_component_class_sink_finalize_method method); | |
118 | ||
119 | extern int bt_private_component_class_sink_set_accept_input_port_connection_method( | |
120 | struct bt_private_component_class_sink *comp_class, | |
121 | bt_private_component_class_sink_accept_input_port_connection_method method); | |
122 | ||
123 | extern int bt_private_component_class_sink_set_input_port_connected_method( | |
124 | struct bt_private_component_class_sink *comp_class, | |
125 | bt_private_component_class_sink_input_port_connected_method method); | |
126 | ||
127 | extern int bt_private_component_class_sink_set_input_port_disconnected_method( | |
128 | struct bt_private_component_class_sink *comp_class, | |
129 | bt_private_component_class_sink_input_port_disconnected_method method); | |
130 | ||
131 | extern int bt_private_component_class_sink_set_query_method( | |
132 | struct bt_private_component_class_sink *comp_class, | |
133 | bt_private_component_class_sink_query_method method); | |
134 | ||
135 | #ifdef __cplusplus | |
136 | } | |
137 | #endif | |
138 | ||
139 | #endif /* BABELTRACE_GRAPH_PRIVATE_COMPONENT_CLASS_SINK_H */ |