1 #ifndef BABELTRACE_GRAPH_COMPONENT_CLASS_SINK_H
2 #define BABELTRACE_GRAPH_COMPONENT_CLASS_SINK_H
5 * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
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:
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
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
28 /* For enum bt_self_component_status */
29 #include <babeltrace/graph/self-component.h>
31 /* For enum bt_query_status */
32 #include <babeltrace/graph/component-class.h>
38 struct bt_component_class
;
39 struct bt_component_class_sink
;
40 struct bt_port_output
;
41 struct bt_query_executor
;
42 struct bt_self_component_class_sink
;
43 struct bt_self_component_port_input
;
44 struct bt_self_component_sink
;
47 typedef enum bt_self_component_status
48 (*bt_component_class_sink_init_method
)(
49 struct bt_self_component_sink
*self_component
,
50 const struct bt_value
*params
, void *init_method_data
);
52 typedef void (*bt_component_class_sink_finalize_method
)(
53 struct bt_self_component_sink
*self_component
);
55 typedef enum bt_query_status
56 (*bt_component_class_sink_query_method
)(
57 struct bt_self_component_class_sink
*comp_class
,
58 const struct bt_query_executor
*query_executor
,
59 const char *object
, const struct bt_value
*params
,
60 const struct bt_value
**result
);
62 typedef enum bt_self_component_status
63 (*bt_component_class_sink_accept_input_port_connection_method
)(
64 struct bt_self_component_sink
*self_component
,
65 struct bt_self_component_port_input
*self_port
,
66 const struct bt_port_output
*other_port
);
68 typedef enum bt_self_component_status
69 (*bt_component_class_sink_input_port_connected_method
)(
70 struct bt_self_component_sink
*self_component
,
71 struct bt_self_component_port_input
*self_port
,
72 const struct bt_port_output
*other_port
);
75 (*bt_component_class_sink_input_port_disconnected_method
)(
76 struct bt_self_component_sink
*self_component
,
77 struct bt_self_component_port_input
*self_port
);
79 typedef enum bt_self_component_status
80 (*bt_component_class_sink_consume_method
)(
81 struct bt_self_component_sink
*self_component
);
84 struct bt_component_class
*bt_component_class_sink_as_component_class(
85 struct bt_component_class_sink
*comp_cls_sink
)
87 return (void *) comp_cls_sink
;
91 struct bt_component_class_sink
*bt_component_class_sink_create(
93 bt_component_class_sink_consume_method method
);
95 extern int bt_component_class_sink_set_init_method(
96 struct bt_component_class_sink
*comp_class
,
97 bt_component_class_sink_init_method method
);
99 extern int bt_component_class_sink_set_finalize_method(
100 struct bt_component_class_sink
*comp_class
,
101 bt_component_class_sink_finalize_method method
);
103 extern int bt_component_class_sink_set_accept_input_port_connection_method(
104 struct bt_component_class_sink
*comp_class
,
105 bt_component_class_sink_accept_input_port_connection_method method
);
107 extern int bt_component_class_sink_set_input_port_connected_method(
108 struct bt_component_class_sink
*comp_class
,
109 bt_component_class_sink_input_port_connected_method method
);
111 extern int bt_component_class_sink_set_input_port_disconnected_method(
112 struct bt_component_class_sink
*comp_class
,
113 bt_component_class_sink_input_port_disconnected_method method
);
115 extern int bt_component_class_sink_set_query_method(
116 struct bt_component_class_sink
*comp_class
,
117 bt_component_class_sink_query_method method
);
123 #endif /* BABELTRACE_GRAPH_COMPONENT_CLASS_SINK_H */