2 * The MIT License (MIT)
4 * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com>
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:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
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
26 * Typemap for the user data attached to (and owned by) a self component port.
27 * The pointer saved as the port's user data is directly the PyObject *.
29 * As per the CPython calling convention, we need to return a new reference to
30 * the returned object, which will be transferred to the caller. The following
31 * typedef allows us to apply the typemap.
34 typedef void *PY_SELF_PORT_USER_DATA;
37 %typemap(out) PY_SELF_PORT_USER_DATA {
42 /* From port-const.h */
44 typedef enum bt_port_type {
45 BT_PORT_TYPE_INPUT = 0,
46 BT_PORT_TYPE_OUTPUT = 1,
49 extern const char *bt_port_get_name(const bt_port *port);
51 extern bt_port_type bt_port_get_type(const bt_port *port);
53 extern const bt_connection *bt_port_borrow_connection_const(
56 extern const bt_component *bt_port_borrow_component_const(
59 extern bt_bool bt_port_is_connected(const bt_port *port);
61 bt_bool bt_port_is_input(const bt_port *port);
63 bt_bool bt_port_is_output(const bt_port *port);
65 extern void bt_port_get_ref(const bt_port *port);
67 extern void bt_port_put_ref(const bt_port *port);
69 /* From port-output-const.h */
71 const bt_port *bt_port_output_as_port_const(const bt_port_output *port_output);
73 extern void bt_port_output_get_ref(const bt_port_output *port_output);
75 extern void bt_port_output_put_ref(const bt_port_output *port_output);
77 /* From port-input-const.h */
79 const bt_port *bt_port_input_as_port_const(const bt_port_input *port_input);
81 extern void bt_port_input_get_ref(const bt_port_input *port_input);
83 extern void bt_port_input_put_ref(const bt_port_input *port_input);
85 /* From self-component-port.h */
87 typedef enum bt_self_component_port_status {
88 BT_SELF_PORT_STATUS_OK = 0,
89 } bt_self_component_port_status;
91 const bt_port *bt_self_component_port_as_port(
92 bt_self_component_port *self_port);
94 extern bt_self_component *bt_self_component_port_borrow_component(
95 bt_self_component_port *self_port);
97 extern PY_SELF_PORT_USER_DATA bt_self_component_port_get_data(
98 const bt_self_component_port *self_port);
100 /* From self-component-port-output.h */
102 bt_self_component_port *
103 bt_self_component_port_output_as_self_component_port(
104 bt_self_component_port_output *self_component_port);
106 const bt_port_output *bt_self_component_port_output_as_port_output(
107 bt_self_component_port_output *self_component_port);
109 /* From self-component-port-input.h */
111 bt_self_component_port *
112 bt_self_component_port_input_as_self_component_port(
113 bt_self_component_port_input *self_component_port);
115 const bt_port_input *bt_self_component_port_input_as_port_input(
116 const bt_self_component_port_input *self_component_port);