Document libbabeltrace2's C API
[babeltrace.git] / src / bindings / python / bt2 / bt2 / native_bt_graph.i
CommitLineData
6945df9a
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)
d6bb425c 27 (const bt_connection **)
6945df9a
SM
28 (bt_connection *temp_conn = NULL) {
29 $1 = &temp_conn;
30}
31
32%typemap(argout)
d6bb425c 33 (const bt_connection **) {
6945df9a
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)
d6bb425c 48 (const bt_component_source **)
6945df9a
SM
49 (bt_component_source *temp_comp = NULL) {
50 $1 = &temp_comp;
51}
52
53%typemap(in, numinputs=0)
d6bb425c 54 (const bt_component_filter **)
6945df9a
SM
55 (bt_component_filter *temp_comp = NULL) {
56 $1 = &temp_comp;
57}
58
59%typemap(in, numinputs=0)
d6bb425c 60 (const bt_component_sink **)
6945df9a
SM
61 (bt_component_sink *temp_comp = NULL) {
62 $1 = &temp_comp;
63}
64
d6bb425c 65%typemap(argout) (const bt_component_source **) {
6945df9a
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
d6bb425c 78%typemap(argout) (const bt_component_filter **) {
6945df9a
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
d6bb425c 91%typemap(argout) (const bt_component_sink **) {
6945df9a
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
d6bb425c 104%include <babeltrace2/graph/graph.h>
6945df9a
SM
105
106/* Helper functions for Python */
107
108%{
4212232c 109#include "native_bt_graph.i.h"
6945df9a
SM
110%}
111
d24d5663 112PyObject *bt_bt2_graph_add_port_added_listener(struct bt_graph *graph,
6945df9a 113 PyObject *py_callable);
66964f3f 114
66964f3f
PP
115bt_graph_add_component_status
116bt_bt2_graph_add_source_component(
117 bt_graph *graph,
118 const bt_component_class_source *component_class,
119 const char *name, const bt_value *params,
120 PyObject *obj, bt_logging_level log_level,
121 const bt_component_source **component);
122
123bt_graph_add_component_status
124bt_bt2_graph_add_filter_component(
125 bt_graph *graph,
126 const bt_component_class_filter *component_class,
127 const char *name, const bt_value *params,
128 PyObject *obj, bt_logging_level log_level,
129 const bt_component_filter **component);
130
131bt_graph_add_component_status
132bt_bt2_graph_add_sink_component(
133 bt_graph *graph,
134 const bt_component_class_sink *component_class,
135 const char *name, const bt_value *params,
136 PyObject *obj, bt_logging_level log_level,
137 const bt_component_sink **component);
This page took 0.0545600000000001 seconds and 4 git commands to generate.