tap-driver.sh: flush stdout after each test result
[babeltrace.git] / bindings / python / bt2 / bt2 / native_bt_component.i
index 012b194f07550b54c5d64c52cb843409c1bb2d08..f484263ecccad70bd6ff0411fa8a60bc3b237904 100644 (file)
        }
 }
 
+/* Typemaps used for user data attached to self component ports. */
+
+/*
+ * The user data Python object is kept as the user data of the port, we pass
+ * the PyObject pointer directly to the port creation function.
+ */
+%typemap(in) void *PY_SELF_PORT_USER_DATA {
+       $1 = $input;
+}
+
+/*
+ * The port, if created successfully, now owns a reference to the Python object,
+ * we reflect that here.
+ */
+%typemap(argout) void *PY_SELF_PORT_USER_DATA {
+       if (PyLong_AsLong($result) == BT_SELF_COMPONENT_STATUS_OK) {
+               Py_INCREF($1);
+       }
+}
+
 /* From component-const.h */
 
 extern const char *bt_component_get_name(const bt_component *component);
@@ -90,6 +110,10 @@ extern void bt_component_put_ref(const bt_component *component);
 const bt_component *bt_component_source_as_component_const(
                const bt_component_source *component);
 
+extern const bt_component_class_source *
+bt_component_source_borrow_class_const(
+               const bt_component_source *component);
+
 extern uint64_t bt_component_source_get_output_port_count(
                const bt_component_source *component);
 
@@ -112,6 +136,10 @@ extern void bt_component_source_put_ref(
 const bt_component *bt_component_filter_as_component_const(
                const bt_component_filter *component);
 
+extern const bt_component_class_filter *
+bt_component_filter_borrow_class_const(
+               const bt_component_filter *component);
+
 extern uint64_t bt_component_filter_get_input_port_count(
                const bt_component_filter *component);
 
@@ -145,6 +173,10 @@ extern void bt_component_filter_put_ref(
 const bt_component *bt_component_sink_as_component_const(
                const bt_component_sink *component);
 
+extern const bt_component_class_sink *
+bt_component_sink_borrow_class_const(
+               const bt_component_sink *component);
+
 extern uint64_t bt_component_sink_get_input_port_count(
                const bt_component_sink *component);
 
@@ -204,7 +236,7 @@ bt_self_component_source_borrow_output_port_by_index(
 extern bt_self_component_status
 bt_self_component_source_add_output_port(
                bt_self_component_source *self_component,
-               const char *name, void *user_data,
+               const char *name, void *PY_SELF_PORT_USER_DATA,
                bt_self_component_port_output **OUT);
 
 /* From self-component-filter.h */
@@ -229,7 +261,7 @@ bt_self_component_filter_borrow_output_port_by_index(
 extern bt_self_component_status
 bt_self_component_filter_add_output_port(
                bt_self_component_filter *self_component,
-               const char *name, void *data,
+               const char *name, void *PY_SELF_PORT_USER_DATA,
                bt_self_component_port_output **OUT);
 
 extern bt_self_component_port_input *
@@ -245,7 +277,7 @@ bt_self_component_filter_borrow_input_port_by_index(
 extern bt_self_component_status
 bt_self_component_filter_add_input_port(
                bt_self_component_filter *self_component,
-               const char *name, void *data,
+               const char *name, void *PY_SELF_PORT_USER_DATA,
                bt_self_component_port_input **OUT);
 
 /* From self-component-sink.h */
@@ -269,5 +301,5 @@ bt_self_component_sink_borrow_input_port_by_index(
 extern bt_self_component_status
 bt_self_component_sink_add_input_port(
                bt_self_component_sink *self_component,
-               const char *name, void *user_data,
+               const char *name, void *PY_SELF_PORT_USER_DATA,
                bt_self_component_port_input **OUT);
This page took 0.024852 seconds and 4 git commands to generate.