lib, bt2: graph API: remove "ports connected" listeners
[babeltrace.git] / src / bindings / python / bt2 / bt2 / native_bt_graph.i
CommitLineData
6fa6bfa1
SM
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/* Output argument typemap for connection output (always appends) */
26%typemap(in, numinputs=0)
e4b56bb9 27 (const bt_connection **)
6fa6bfa1
SM
28 (bt_connection *temp_conn = NULL) {
29 $1 = &temp_conn;
30}
31
32%typemap(argout)
e4b56bb9 33 (const bt_connection **) {
6fa6bfa1
SM
34 if (*$1) {
35 /* SWIG_Python_AppendOutput() steals the created object */
36 $result = SWIG_Python_AppendOutput($result,
37 SWIG_NewPointerObj(SWIG_as_voidptr(*$1),
38 SWIGTYPE_p_bt_connection, 0));
39 } else {
40 /* SWIG_Python_AppendOutput() steals Py_None */
41 Py_INCREF(Py_None);
42 $result = SWIG_Python_AppendOutput($result, Py_None);
43 }
44}
45
46/* Output argument typemap for component output (always appends) */
47%typemap(in, numinputs=0)
e4b56bb9 48 (const bt_component_source **)
6fa6bfa1
SM
49 (bt_component_source *temp_comp = NULL) {
50 $1 = &temp_comp;
51}
52
53%typemap(in, numinputs=0)
e4b56bb9 54 (const bt_component_filter **)
6fa6bfa1
SM
55 (bt_component_filter *temp_comp = NULL) {
56 $1 = &temp_comp;
57}
58
59%typemap(in, numinputs=0)
e4b56bb9 60 (const bt_component_sink **)
6fa6bfa1
SM
61 (bt_component_sink *temp_comp = NULL) {
62 $1 = &temp_comp;
63}
64
e4b56bb9 65%typemap(argout) (const bt_component_source **) {
6fa6bfa1
SM
66 if (*$1) {
67 /* SWIG_Python_AppendOutput() steals the created object */
68 $result = SWIG_Python_AppendOutput($result,
69 SWIG_NewPointerObj(SWIG_as_voidptr(*$1),
70 SWIGTYPE_p_bt_component_source, 0));
71 } else {
72 /* SWIG_Python_AppendOutput() steals Py_None */
73 Py_INCREF(Py_None);
74 $result = SWIG_Python_AppendOutput($result, Py_None);
75 }
76}
77
e4b56bb9 78%typemap(argout) (const bt_component_filter **) {
6fa6bfa1
SM
79 if (*$1) {
80 /* SWIG_Python_AppendOutput() steals the created object */
81 $result = SWIG_Python_AppendOutput($result,
82 SWIG_NewPointerObj(SWIG_as_voidptr(*$1),
83 SWIGTYPE_p_bt_component_filter, 0));
84 } else {
85 /* SWIG_Python_AppendOutput() steals Py_None */
86 Py_INCREF(Py_None);
87 $result = SWIG_Python_AppendOutput($result, Py_None);
88 }
89}
90
e4b56bb9 91%typemap(argout) (const bt_component_sink **) {
6fa6bfa1
SM
92 if (*$1) {
93 /* SWIG_Python_AppendOutput() steals the created object */
94 $result = SWIG_Python_AppendOutput($result,
95 SWIG_NewPointerObj(SWIG_as_voidptr(*$1),
96 SWIGTYPE_p_bt_component_sink, 0));
97 } else {
98 /* SWIG_Python_AppendOutput() steals Py_None */
99 Py_INCREF(Py_None);
100 $result = SWIG_Python_AppendOutput($result, Py_None);
101 }
102}
103
e4b56bb9
SM
104%include <babeltrace2/graph/graph-const.h>
105%include <babeltrace2/graph/graph.h>
6fa6bfa1
SM
106
107/* Helper functions for Python */
108
109%{
5fa16feb 110#include "native_bt_graph.i.h"
6fa6bfa1
SM
111%}
112
fb25b9e3 113PyObject *bt_bt2_graph_add_port_added_listener(struct bt_graph *graph,
6fa6bfa1 114 PyObject *py_callable);
b20382e2 115
b20382e2
PP
116bt_graph_add_component_status
117bt_bt2_graph_add_source_component(
118 bt_graph *graph,
119 const bt_component_class_source *component_class,
120 const char *name, const bt_value *params,
121 PyObject *obj, bt_logging_level log_level,
122 const bt_component_source **component);
123
124bt_graph_add_component_status
125bt_bt2_graph_add_filter_component(
126 bt_graph *graph,
127 const bt_component_class_filter *component_class,
128 const char *name, const bt_value *params,
129 PyObject *obj, bt_logging_level log_level,
130 const bt_component_filter **component);
131
132bt_graph_add_component_status
133bt_bt2_graph_add_sink_component(
134 bt_graph *graph,
135 const bt_component_class_sink *component_class,
136 const char *name, const bt_value *params,
137 PyObject *obj, bt_logging_level log_level,
138 const bt_component_sink **component);
This page took 0.050298 seconds and 4 git commands to generate.