2 * SPDX-License-Identifier: MIT
4 * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
7 /* Output argument typemap for self port output (always appends) */
8 %typemap(in, numinputs=0)
9 (bt_self_component_port_input **)
10 (bt_self_component_port_input *temp_self_port = NULL) {
14 %typemap(argout) bt_self_component_port_input ** {
16 /* SWIG_Python_AppendOutput() steals the created object */
17 $result = SWIG_Python_AppendOutput($result,
18 SWIG_NewPointerObj(SWIG_as_voidptr(*$1),
19 SWIGTYPE_p_bt_self_component_port_input, 0));
21 /* SWIG_Python_AppendOutput() steals Py_None */
23 $result = SWIG_Python_AppendOutput($result, Py_None);
27 /* Output argument typemap for self port output (always appends) */
28 %typemap(in, numinputs=0)
29 (bt_self_component_port_output **)
30 (bt_self_component_port_output *temp_self_port = NULL) {
34 %typemap(argout) (bt_self_component_port_output **) {
36 /* SWIG_Python_AppendOutput() steals the created object */
37 $result = SWIG_Python_AppendOutput($result,
38 SWIG_NewPointerObj(SWIG_as_voidptr(*$1),
39 SWIGTYPE_p_bt_self_component_port_output, 0));
41 /* SWIG_Python_AppendOutput() steals Py_None */
43 $result = SWIG_Python_AppendOutput($result, Py_None);
47 /* Typemaps used for user data attached to self component ports. */
50 * The user data Python object is kept as the user data of the port, we pass
51 * the PyObject pointer directly to the port creation function.
53 %typemap(in) void *user_data {
58 * The port, if created successfully, now owns a reference to the Python object,
59 * we reflect that here.
61 %typemap(argout) void *user_data {
62 if (PyLong_AsLong($result) == __BT_FUNC_STATUS_OK) {
67 %include <babeltrace2/graph/component.h>
68 %include <babeltrace2/graph/self-component.h>
71 * This type map relies on the rather common "user_data" name, so don't pollute
72 * the typemap namespace.
74 %clear void *user_data;