lib: make graph API const-correct
[babeltrace.git] / include / babeltrace / graph / component-class-sink.h
CommitLineData
1ca80abd
PP
1#ifndef BABELTRACE_GRAPH_COMPONENT_CLASS_SINK_H
2#define BABELTRACE_GRAPH_COMPONENT_CLASS_SINK_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
0d72b8c3
PP
26#include <stdint.h>
27
28/* For enum bt_self_component_status */
29#include <babeltrace/graph/self-component.h>
30
31/* For enum bt_query_status */
32#include <babeltrace/graph/component-class.h>
33
d3e4dcd8
PP
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38struct bt_component_class;
d94d92ac 39struct bt_component_class_sink;
0d72b8c3
PP
40struct bt_port_output;
41struct bt_query_executor;
42struct bt_self_component_class_sink;
43struct bt_self_component_port_input;
44struct bt_self_component_sink;
45struct bt_value;
46
47typedef 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);
51
52typedef void (*bt_component_class_sink_finalize_method)(
53 struct bt_self_component_sink *self_component);
54
55typedef 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);
61
62typedef 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);
67
68typedef 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);
73
74typedef void
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);
78
79typedef enum bt_self_component_status
80(*bt_component_class_sink_consume_method)(
81 struct bt_self_component_sink *self_component);
d94d92ac
PP
82
83static inline
0d72b8c3 84struct bt_component_class *bt_component_class_sink_as_component_class(
d94d92ac
PP
85 struct bt_component_class_sink *comp_cls_sink)
86{
87 return (void *) comp_cls_sink;
88}
d3e4dcd8 89
0d72b8c3
PP
90extern
91struct bt_component_class_sink *bt_component_class_sink_create(
92 const char *name,
93 bt_component_class_sink_consume_method method);
94
95extern int bt_component_class_sink_set_init_method(
96 struct bt_component_class_sink *comp_class,
97 bt_component_class_sink_init_method method);
98
99extern int bt_component_class_sink_set_finalize_method(
100 struct bt_component_class_sink *comp_class,
101 bt_component_class_sink_finalize_method method);
102
103extern 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);
106
107extern 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);
110
111extern 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);
114
115extern int bt_component_class_sink_set_query_method(
116 struct bt_component_class_sink *comp_class,
117 bt_component_class_sink_query_method method);
118
d3e4dcd8
PP
119#ifdef __cplusplus
120}
121#endif
122
1ca80abd 123#endif /* BABELTRACE_GRAPH_COMPONENT_CLASS_SINK_H */
This page took 0.038573 seconds and 4 git commands to generate.