Fix: add missing void param to bt_clock_class_priority_map_create
[babeltrace.git] / bindings / python / bt2 / native_bt.i
CommitLineData
81447b5b
PP
1/*
2 * The MIT License (MIT)
3 *
4 * Copyright (c) 2016 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
811644b8
PP
25#ifndef SWIGPYTHON
26# error Unsupported output language
27#endif
28
81447b5b 29%{
811644b8
PP
30#define BT_LOG_TAG "PY-NATIVE"
31#include "logging.h"
32
33#include <babeltrace/babeltrace.h>
34
81447b5b
PP
35typedef const unsigned char *BTUUID;
36%}
37
811644b8 38typedef int bt_bool;
81447b5b
PP
39
40/* For uint*_t/int*_t */
41%include "stdint.i"
42
43/* Remove `bt_` and `BT_` prefixes from function names and enumeration items */
44%rename("%(strip:[bt_])s", %$isfunction) "";
45%rename("%(strip:[BT_])s", %$isenumitem) "";
46
47/* Output argument typemap for string output (always appends) */
48%typemap(in, numinputs=0) const char **BTOUTSTR (char *temp_value = NULL) {
49 $1 = &temp_value;
50}
51
52%typemap(argout) const char **BTOUTSTR {
53 if (*$1) {
54 /* SWIG_Python_AppendOutput() steals the created object */
55 $result = SWIG_Python_AppendOutput($result, SWIG_Python_str_FromChar(*$1));
56 } else {
57 /* SWIG_Python_AppendOutput() steals Py_None */
58 Py_INCREF(Py_None);
59 $result = SWIG_Python_AppendOutput($result, Py_None);
60 }
61}
62
63/* Output argument typemap for field type output (always appends) */
64%typemap(in, numinputs=0) struct bt_ctf_field_type **BTOUTFT (struct bt_ctf_field_type *temp_ft = NULL) {
65 $1 = &temp_ft;
66}
67
68%typemap(argout) struct bt_ctf_field_type **BTOUTFT {
69 if (*$1) {
70 /* SWIG_Python_AppendOutput() steals the created object */
71 $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr(*$1), SWIGTYPE_p_bt_ctf_field_type, 0));
72 } else {
73 /* SWIG_Python_AppendOutput() steals Py_None */
74 Py_INCREF(Py_None);
75 $result = SWIG_Python_AppendOutput($result, Py_None);
76 }
77}
78
811644b8
PP
79/* Output argument typemap for component output (always appends) */
80%typemap(in, numinputs=0) struct bt_component **BTOUTCOMP (struct bt_component *temp_comp = NULL) {
81 $1 = &temp_comp;
82}
83
84%typemap(argout) struct bt_component **BTOUTCOMP {
85 if (*$1) {
86 /* SWIG_Python_AppendOutput() steals the created object */
87 $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr(*$1), SWIGTYPE_p_bt_component, 0));
88 } else {
89 /* SWIG_Python_AppendOutput() steals Py_None */
90 Py_INCREF(Py_None);
91 $result = SWIG_Python_AppendOutput($result, Py_None);
92 }
93}
94
95/* Output argument typemap for connection output (always appends) */
96%typemap(in, numinputs=0) struct bt_connection **BTOUTCONN (struct bt_connection *temp_conn = NULL) {
97 $1 = &temp_conn;
98}
99
100%typemap(argout) struct bt_connection **BTOUTCONN {
101 if (*$1) {
102 /* SWIG_Python_AppendOutput() steals the created object */
103 $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr(*$1), SWIGTYPE_p_bt_connection, 0));
104 } else {
105 /* SWIG_Python_AppendOutput() steals Py_None */
106 Py_INCREF(Py_None);
107 $result = SWIG_Python_AppendOutput($result, Py_None);
108 }
109}
110
111/* Output argument typemap for private port output (always appends) */
112%typemap(in, numinputs=0) struct bt_private_port **BTOUTPRIVPORT (struct bt_private_port *temp_priv_port = NULL) {
113 $1 = &temp_priv_port;
114}
115
116%typemap(argout) struct bt_private_port **BTOUTPRIVPORT {
117 if (*$1) {
118 /* SWIG_Python_AppendOutput() steals the created object */
119 $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr(*$1), SWIGTYPE_p_bt_private_port, 0));
120 } else {
121 /* SWIG_Python_AppendOutput() steals Py_None */
122 Py_INCREF(Py_None);
123 $result = SWIG_Python_AppendOutput($result, Py_None);
124 }
125}
126
127/* Output argument typemap for initialized uint64_t output parameter (always appends) */
128%typemap(in, numinputs=0) uint64_t *OUTPUTINIT (uint64_t temp = -1ULL) {
129 $1 = &temp;
130}
131
132%typemap(argout) uint64_t *OUTPUTINIT {
133 $result = SWIG_Python_AppendOutput(resultobj, SWIG_From_unsigned_SS_long_SS_long((*$1)));
134}
135
136/* Output argument typemap for initialized unsigned int output parameter (always appends) */
137%typemap(in, numinputs=0) unsigned int *OUTPUTINIT (unsigned int temp = -1) {
138 $1 = &temp;
139}
140
141%typemap(argout) unsigned int *OUTPUTINIT {
142 $result = SWIG_Python_AppendOutput(resultobj, SWIG_From_unsigned_SS_long_SS_long((uint64_t) (*$1)));
143}
144
81447b5b
PP
145/* Input argument typemap for UUID bytes */
146%typemap(in) BTUUID {
147 $1 = (unsigned char *) PyBytes_AsString($input);
148}
149
150/* Output argument typemap for UUID bytes */
151%typemap(out) BTUUID {
152 if (!$1) {
153 Py_INCREF(Py_None);
154 $result = Py_None;
155 } else {
156 $result = PyBytes_FromStringAndSize((const char *) $1, 16);
157 }
158}
159
160/*
161 * Input and output argument typemaps for raw Python objects (direct).
162 *
163 * Those typemaps honor the convention of Python C function calls with
164 * respect to reference counting: parameters are passed as borrowed
165 * references, and objects are returned as new references. The wrapped
166 * C function must ensure that the return value is always a new
167 * reference, and never steal parameter references.
168 */
169%typemap(in) PyObject * {
170 $1 = $input;
171}
172
173%typemap(out) PyObject * {
174 $result = $1;
175}
176
177/* Per-module interface files */
811644b8 178%include "native_btccpriomap.i"
81447b5b 179%include "native_btclockclass.i"
811644b8
PP
180%include "native_btcomponent.i"
181%include "native_btcomponentclass.i"
182%include "native_btconnection.i"
183%include "native_btctfwriter.i"
81447b5b
PP
184%include "native_btevent.i"
185%include "native_bteventclass.i"
186%include "native_btfields.i"
187%include "native_btft.i"
811644b8
PP
188%include "native_btgraph.i"
189%include "native_btlogging.i"
190%include "native_btnotification.i"
191%include "native_btnotifiter.i"
81447b5b 192%include "native_btpacket.i"
811644b8
PP
193%include "native_btplugin.i"
194%include "native_btport.i"
81447b5b
PP
195%include "native_btref.i"
196%include "native_btstream.i"
197%include "native_btstreamclass.i"
198%include "native_bttrace.i"
199%include "native_btvalues.i"
811644b8 200%include "native_btversion.i"
This page took 0.035622 seconds and 4 git commands to generate.