| 1 | /* |
| 2 | * SPDX-License-Identifier: MIT |
| 3 | * |
| 4 | * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com> |
| 5 | */ |
| 6 | |
| 7 | /* Output argument typemap for connection output (always appends) */ |
| 8 | %typemap(in, numinputs=0) |
| 9 | (const bt_connection **) |
| 10 | (bt_connection *temp_conn = NULL) { |
| 11 | $1 = &temp_conn; |
| 12 | } |
| 13 | |
| 14 | %typemap(argout) |
| 15 | (const bt_connection **) { |
| 16 | if (*$1) { |
| 17 | /* SWIG_Python_AppendOutput() steals the created object */ |
| 18 | $result = SWIG_Python_AppendOutput($result, |
| 19 | SWIG_NewPointerObj(SWIG_as_voidptr(*$1), |
| 20 | SWIGTYPE_p_bt_connection, 0)); |
| 21 | } else { |
| 22 | /* SWIG_Python_AppendOutput() steals Py_None */ |
| 23 | Py_INCREF(Py_None); |
| 24 | $result = SWIG_Python_AppendOutput($result, Py_None); |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | /* Output argument typemap for component output (always appends) */ |
| 29 | %typemap(in, numinputs=0) |
| 30 | (const bt_component_source **) |
| 31 | (bt_component_source *temp_comp = NULL) { |
| 32 | $1 = &temp_comp; |
| 33 | } |
| 34 | |
| 35 | %typemap(in, numinputs=0) |
| 36 | (const bt_component_filter **) |
| 37 | (bt_component_filter *temp_comp = NULL) { |
| 38 | $1 = &temp_comp; |
| 39 | } |
| 40 | |
| 41 | %typemap(in, numinputs=0) |
| 42 | (const bt_component_sink **) |
| 43 | (bt_component_sink *temp_comp = NULL) { |
| 44 | $1 = &temp_comp; |
| 45 | } |
| 46 | |
| 47 | %typemap(argout) (const bt_component_source **) { |
| 48 | if (*$1) { |
| 49 | /* SWIG_Python_AppendOutput() steals the created object */ |
| 50 | $result = SWIG_Python_AppendOutput($result, |
| 51 | SWIG_NewPointerObj(SWIG_as_voidptr(*$1), |
| 52 | SWIGTYPE_p_bt_component_source, 0)); |
| 53 | } else { |
| 54 | /* SWIG_Python_AppendOutput() steals Py_None */ |
| 55 | Py_INCREF(Py_None); |
| 56 | $result = SWIG_Python_AppendOutput($result, Py_None); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | %typemap(argout) (const bt_component_filter **) { |
| 61 | if (*$1) { |
| 62 | /* SWIG_Python_AppendOutput() steals the created object */ |
| 63 | $result = SWIG_Python_AppendOutput($result, |
| 64 | SWIG_NewPointerObj(SWIG_as_voidptr(*$1), |
| 65 | SWIGTYPE_p_bt_component_filter, 0)); |
| 66 | } else { |
| 67 | /* SWIG_Python_AppendOutput() steals Py_None */ |
| 68 | Py_INCREF(Py_None); |
| 69 | $result = SWIG_Python_AppendOutput($result, Py_None); |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | %typemap(argout) (const bt_component_sink **) { |
| 74 | if (*$1) { |
| 75 | /* SWIG_Python_AppendOutput() steals the created object */ |
| 76 | $result = SWIG_Python_AppendOutput($result, |
| 77 | SWIG_NewPointerObj(SWIG_as_voidptr(*$1), |
| 78 | SWIGTYPE_p_bt_component_sink, 0)); |
| 79 | } else { |
| 80 | /* SWIG_Python_AppendOutput() steals Py_None */ |
| 81 | Py_INCREF(Py_None); |
| 82 | $result = SWIG_Python_AppendOutput($result, Py_None); |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | %include <babeltrace2/graph/graph.h> |
| 87 | |
| 88 | /* Helper functions for Python */ |
| 89 | |
| 90 | %{ |
| 91 | #include "native_bt_graph.i.h" |
| 92 | %} |
| 93 | |
| 94 | PyObject *bt_bt2_graph_add_port_added_listener(struct bt_graph *graph, |
| 95 | PyObject *py_callable); |
| 96 | |
| 97 | bt_graph_add_component_status |
| 98 | bt_bt2_graph_add_source_component( |
| 99 | bt_graph *graph, |
| 100 | const bt_component_class_source *component_class, |
| 101 | const char *name, const bt_value *params, |
| 102 | PyObject *obj, bt_logging_level log_level, |
| 103 | const bt_component_source **component); |
| 104 | |
| 105 | bt_graph_add_component_status |
| 106 | bt_bt2_graph_add_filter_component( |
| 107 | bt_graph *graph, |
| 108 | const bt_component_class_filter *component_class, |
| 109 | const char *name, const bt_value *params, |
| 110 | PyObject *obj, bt_logging_level log_level, |
| 111 | const bt_component_filter **component); |
| 112 | |
| 113 | bt_graph_add_component_status |
| 114 | bt_bt2_graph_add_sink_component( |
| 115 | bt_graph *graph, |
| 116 | const bt_component_class_sink *component_class, |
| 117 | const char *name, const bt_value *params, |
| 118 | PyObject *obj, bt_logging_level log_level, |
| 119 | const bt_component_sink **component); |