X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fbindings%2Fpython%2Fbt2%2Fbt2%2Fnative_bt_component.i;h=aa3f725213dd21bf0a1e11f61eb2841eb61c11d9;hb=43c59509042845f8d42c3e99ec74d45fa2dc0908;hp=e663c7220c8e76c7404c6687b6450e9876cd486c;hpb=c594ab036e1797da45594dce8dfc07d90f2bb81f;p=babeltrace.git diff --git a/src/bindings/python/bt2/bt2/native_bt_component.i b/src/bindings/python/bt2/bt2/native_bt_component.i index e663c722..aa3f7252 100644 --- a/src/bindings/python/bt2/bt2/native_bt_component.i +++ b/src/bindings/python/bt2/bt2/native_bt_component.i @@ -24,12 +24,12 @@ /* Output argument typemap for self port output (always appends) */ %typemap(in, numinputs=0) - (bt_self_component_port_input **OUT) + (bt_self_component_port_input **) (bt_self_component_port_input *temp_self_port = NULL) { $1 = &temp_self_port; } -%typemap(argout) bt_self_component_port_input **OUT { +%typemap(argout) bt_self_component_port_input ** { if (*$1) { /* SWIG_Python_AppendOutput() steals the created object */ $result = SWIG_Python_AppendOutput($result, @@ -44,12 +44,12 @@ /* Output argument typemap for self port output (always appends) */ %typemap(in, numinputs=0) - (bt_self_component_port_output **OUT) + (bt_self_component_port_output **) (bt_self_component_port_output *temp_self_port = NULL) { $1 = &temp_self_port; } -%typemap(argout) (bt_self_component_port_output **OUT) { +%typemap(argout) (bt_self_component_port_output **) { if (*$1) { /* SWIG_Python_AppendOutput() steals the created object */ $result = SWIG_Python_AppendOutput($result, @@ -68,7 +68,7 @@ * 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 { +%typemap(in) void *user_data { $1 = $input; } @@ -76,232 +76,17 @@ * 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) { +%typemap(argout) void *user_data { + if (PyLong_AsLong($result) == __BT_FUNC_STATUS_OK) { Py_INCREF($1); } } -/* From component-const.h */ +%include +%include -extern const char *bt_component_get_name(const bt_component *component); - -extern bt_logging_level bt_component_get_logging_level( - const bt_component *component); - -extern const bt_component_class *bt_component_borrow_class_const( - const bt_component *component); - -extern bt_component_class_type bt_component_get_class_type( - const bt_component *component); - -bt_bool bt_component_is_source(const bt_component *component); - -bt_bool bt_component_is_filter(const bt_component *component); - -bt_bool bt_component_is_sink(const bt_component *component); - -extern bt_bool bt_component_graph_is_canceled( - const bt_component *component); - -extern void bt_component_get_ref(const bt_component *component); - -extern void bt_component_put_ref(const bt_component *component); - -/* From component-source-const.h */ - -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); - -extern const bt_port_output * -bt_component_source_borrow_output_port_by_name_const( - const bt_component_source *component, const char *name); - -extern const bt_port_output * -bt_component_source_borrow_output_port_by_index_const( - const bt_component_source *component, uint64_t index); - -extern void bt_component_source_get_ref( - const bt_component_source *component_source); - -extern void bt_component_source_put_ref( - const bt_component_source *component_source); - -/* From component-filter-const.h */ - -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); - -extern const bt_port_input * -bt_component_filter_borrow_input_port_by_name_const( - const bt_component_filter *component, const char *name); - -extern const bt_port_input * -bt_component_filter_borrow_input_port_by_index_const( - const bt_component_filter *component, uint64_t index); - -extern uint64_t bt_component_filter_get_output_port_count( - const bt_component_filter *component); - -extern const bt_port_output * -bt_component_filter_borrow_output_port_by_name_const( - const bt_component_filter *component, const char *name); - -extern const bt_port_output * -bt_component_filter_borrow_output_port_by_index_const( - const bt_component_filter *component, uint64_t index); - -extern void bt_component_filter_get_ref( - const bt_component_filter *component_filter); - -extern void bt_component_filter_put_ref( - const bt_component_filter *component_filter); - -/* From component-sink-const.h */ - -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); - -extern const bt_port_input * -bt_component_sink_borrow_input_port_by_name_const( - const bt_component_sink *component, const char *name); - -extern const bt_port_input * -bt_component_sink_borrow_input_port_by_index_const( - const bt_component_sink *component, uint64_t index); - -extern void bt_component_sink_get_ref( - const bt_component_sink *component_sink); - -extern void bt_component_sink_put_ref( - const bt_component_sink *component_sink); - -/* From self-component.h */ - -typedef enum bt_self_component_status { - BT_SELF_COMPONENT_STATUS_OK = 0, - BT_SELF_COMPONENT_STATUS_END = 1, - BT_SELF_COMPONENT_STATUS_AGAIN = 11, - BT_SELF_COMPONENT_STATUS_ERROR = -1, - BT_SELF_COMPONENT_STATUS_NOMEM = -12, -} bt_self_component_status; - -const bt_component *bt_self_component_as_component( - bt_self_component *self_component); - -extern void *bt_self_component_get_data( - const bt_self_component *self_component); - -extern void bt_self_component_set_data( - bt_self_component *self_component, void *data); - -/* From self-component-source.h */ - -bt_self_component *bt_self_component_source_as_self_component( - bt_self_component_source *self_comp_source); - -const bt_component_source * -bt_self_component_source_as_component_source( - bt_self_component_source *self_comp_source); - -extern bt_self_component_port_output * -bt_self_component_source_borrow_output_port_by_name( - bt_self_component_source *self_component, - const char *name); - -extern bt_self_component_port_output * -bt_self_component_source_borrow_output_port_by_index( - bt_self_component_source *self_component, - uint64_t index); - -extern bt_self_component_status -bt_self_component_source_add_output_port( - bt_self_component_source *self_component, - const char *name, void *PY_SELF_PORT_USER_DATA, - bt_self_component_port_output **OUT); - -/* From self-component-filter.h */ - -bt_self_component *bt_self_component_filter_as_self_component( - bt_self_component_filter *self_comp_filter); - -const bt_component_filter * -bt_self_component_filter_as_component_filter( - bt_self_component_filter *self_comp_filter); - -extern bt_self_component_port_output * -bt_self_component_filter_borrow_output_port_by_name( - bt_self_component_filter *self_component, - const char *name); - -extern bt_self_component_port_output * -bt_self_component_filter_borrow_output_port_by_index( - bt_self_component_filter *self_component, - uint64_t index); - -extern bt_self_component_status -bt_self_component_filter_add_output_port( - bt_self_component_filter *self_component, - const char *name, void *PY_SELF_PORT_USER_DATA, - bt_self_component_port_output **OUT); - -extern bt_self_component_port_input * -bt_self_component_filter_borrow_input_port_by_name( - bt_self_component_filter *self_component, - const char *name); - -extern bt_self_component_port_input * -bt_self_component_filter_borrow_input_port_by_index( - bt_self_component_filter *self_component, - uint64_t index); - -extern bt_self_component_status -bt_self_component_filter_add_input_port( - bt_self_component_filter *self_component, - const char *name, void *PY_SELF_PORT_USER_DATA, - bt_self_component_port_input **OUT); - -/* From self-component-sink.h */ - -bt_self_component *bt_self_component_sink_as_self_component( - bt_self_component_sink *self_comp_sink); - -const bt_component_sink * -bt_self_component_sink_as_component_sink( - bt_self_component_sink *self_comp_sink); - -extern bt_self_component_port_input * -bt_self_component_sink_borrow_input_port_by_name( - bt_self_component_sink *self_component, - const char *name); - -extern bt_self_component_port_input * -bt_self_component_sink_borrow_input_port_by_index( - bt_self_component_sink *self_component, uint64_t index); - -extern bt_self_component_status -bt_self_component_sink_add_input_port( - bt_self_component_sink *self_component, - const char *name, void *PY_SELF_PORT_USER_DATA, - bt_self_component_port_input **OUT); +/* + * This type map relies on the rather common "user_data" name, so don't pollute + * the typemap namespace. + */ +%clear void *user_data;