bt2: put SWIG interface file C code in separate files
[babeltrace.git] / src / bindings / python / bt2 / bt2 / native_bt_trace_class.i
index e060566425ded1fea062456a9c723e8e5516b3db..cc0793798f7d0245ccdb6f4360cd6aae23d7fd36 100644 (file)
 
 /* Helper functions for Python */
 %{
-static void
-trace_class_destroyed_listener(const bt_trace_class *trace_class, void *py_callable)
-{
-       PyObject *py_trace_class_ptr = NULL;
-       PyObject *py_res = NULL;
-
-       py_trace_class_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(trace_class),
-               SWIGTYPE_p_bt_trace_class, 0);
-       if (!py_trace_class_ptr) {
-               BT_LOGF_STR("Failed to create a SWIG pointer object.");
-               abort();
-       }
-
-       py_res = PyObject_CallFunction(py_callable, "(O)", py_trace_class_ptr);
-       if (py_res) {
-               BT_ASSERT(py_res == Py_None);
-       } else {
-               loge_exception("Trace class's destruction listener (Python)",
-                       BT_LOG_OUTPUT_LEVEL);
-       }
-
-       Py_DECREF(py_trace_class_ptr);
-       Py_XDECREF(py_res);
-}
-
-int bt_bt2_trace_class_add_destruction_listener(
-               bt_trace_class *trace_class, PyObject *py_callable,
-               bt_listener_id *id)
-{
-       bt_trace_class_add_listener_status status;
-
-       BT_ASSERT(trace_class);
-       BT_ASSERT(py_callable);
-       status = bt_trace_class_add_destruction_listener(
-               trace_class, trace_class_destroyed_listener, py_callable, id);
-       if (status == __BT_FUNC_STATUS_OK) {
-               Py_INCREF(py_callable);
-       }
-
-       return status;
-}
+#include "native_bt_trace_class.i.h"
 %}
 
 int bt_bt2_trace_class_add_destruction_listener(
This page took 0.023295 seconds and 4 git commands to generate.