| 1 | /* |
| 2 | * SPDX-License-Identifier: MIT |
| 3 | * |
| 4 | * Copyright (c) 2017 Philippe Proulx <pproulx@efficios.com> |
| 5 | */ |
| 6 | |
| 7 | /* |
| 8 | * Typemap for the user data attached to (and owned by) a self component port. |
| 9 | * The pointer saved as the port's user data is directly the PyObject *. |
| 10 | * |
| 11 | * As per the CPython calling convention, we need to return a new reference to |
| 12 | * the returned object, which will be transferred to the caller. |
| 13 | */ |
| 14 | |
| 15 | %typemap(out) void * { |
| 16 | Py_INCREF($1); |
| 17 | $result = $1; |
| 18 | } |
| 19 | |
| 20 | %include <babeltrace2/graph/port.h> |
| 21 | %include <babeltrace2/graph/self-component-port.h> |
| 22 | |
| 23 | /* |
| 24 | * Clear this typemap, since it is a bit broad and could apply to something we |
| 25 | * don't want. |
| 26 | */ |
| 27 | %clear void *; |