Add Babeltrace 2 Python bindings
[babeltrace.git] / bindings / python / bt2 / native_btcomponent.i
1 /*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24
25 %{
26 #include <babeltrace/component/component.h>
27 #include <babeltrace/component/component-source.h>
28 #include <babeltrace/component/component-sink.h>
29 #include <babeltrace/component/component-filter.h>
30 %}
31
32 /* Types */
33 struct bt_component;
34
35 /* Status */
36 enum bt_component_status {
37 BT_COMPONENT_STATUS_OK = 0,
38 BT_COMPONENT_STATUS_END = 1,
39 BT_COMPONENT_STATUS_AGAIN = 2,
40 BT_COMPONENT_STATUS_ERROR = -1,
41 BT_COMPONENT_STATUS_UNSUPPORTED = -2,
42 BT_COMPONENT_STATUS_INVALID = -3,
43 BT_COMPONENT_STATUS_NOMEM = -4,
44 };
45
46 /* General functions */
47 struct bt_component *bt_component_create_with_init_method_data(
48 struct bt_component_class *component_class, const char *name,
49 struct bt_value *params, void *init_method_data);
50 const char *bt_component_get_name(struct bt_component *component);
51 struct bt_component_class *bt_component_get_class(
52 struct bt_component *component);
53 enum bt_component_class_type bt_component_get_class_type(
54 struct bt_component *component);
55
56 /* Source component functions */
57 struct bt_notification_iterator *bt_component_source_create_notification_iterator_with_init_method_data(
58 struct bt_component *component, void *init_method_data);
59
60 /* Filter component functions */
61 %{
62 static struct bt_notification_iterator *bt_component_filter_get_input_iterator_private(
63 struct bt_component *filter, unsigned int index)
64 {
65 struct bt_notification_iterator *iterator = NULL;
66
67 if (bt_component_filter_get_input_iterator(filter, index, &iterator)) {
68 iterator = NULL;
69 goto end;
70 }
71
72 end:
73 return iterator;
74 }
75 %}
76
77 struct bt_notification_iterator *bt_component_filter_create_notification_iterator_with_init_method_data(
78 struct bt_component *component, void *init_method_data);
79 enum bt_component_status bt_component_filter_add_iterator(
80 struct bt_component *component,
81 struct bt_notification_iterator *iterator);
82 enum bt_component_status bt_component_filter_set_minimum_input_count(
83 struct bt_component *filter, unsigned int minimum);
84 enum bt_component_status bt_component_filter_set_maximum_input_count(
85 struct bt_component *filter, unsigned int maximum);
86 enum bt_component_status bt_component_filter_get_input_count(
87 struct bt_component *filter, unsigned int *OUTPUT);
88 struct bt_notification_iterator *bt_component_filter_get_input_iterator_private(
89 struct bt_component *filter, unsigned int index);
90
91 /* Sink component functions */
92 %{
93 static struct bt_notification_iterator *bt_component_sink_get_input_iterator_private(
94 struct bt_component *sink, unsigned int index)
95 {
96 struct bt_notification_iterator *iterator = NULL;
97
98 if (bt_component_sink_get_input_iterator(sink, index, &iterator)) {
99 iterator = NULL;
100 goto end;
101 }
102
103 end:
104 return iterator;
105 }
106 %}
107
108 enum bt_component_status bt_component_sink_add_iterator(
109 struct bt_component *component,
110 struct bt_notification_iterator *iterator);
111 enum bt_component_status bt_component_sink_consume(
112 struct bt_component *component);
113 enum bt_component_status bt_component_sink_set_minimum_input_count(
114 struct bt_component *sink, unsigned int minimum);
115 enum bt_component_status bt_component_sink_set_maximum_input_count(
116 struct bt_component *sink, unsigned int maximum);
117 enum bt_component_status bt_component_sink_get_input_count(
118 struct bt_component *sink, unsigned int *OUTPUT);
119 struct bt_notification_iterator *bt_component_sink_get_input_iterator_private(
120 struct bt_component *sink, unsigned int index);
This page took 0.037032 seconds and 5 git commands to generate.