X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=bindings%2Fpython%2Fbt2%2Fnative_btplugin.i;h=5df3fcf9f1a23f90fff13869993f7459330c24e0;hp=95164f1bc800192ddfa299d2a6346d8a93e71a0b;hb=375d5f6a40f8021639019995c8dc8e6f190b7b55;hpb=7eb483595b72fd45fbb3aebbe2684c46e95b0051 diff --git a/bindings/python/bt2/native_btplugin.i b/bindings/python/bt2/native_btplugin.i index 95164f1b..5df3fcf9 100644 --- a/bindings/python/bt2/native_btplugin.i +++ b/bindings/python/bt2/native_btplugin.i @@ -22,115 +22,42 @@ * THE SOFTWARE. */ -%{ -#include -#include -%} - /* Types */ struct bt_plugin; +struct bt_plugin_set; /* Status */ enum bt_plugin_status { - BT_PLUGIN_STATUS_OK = 0, - BT_PLUGIN_STATUS_ERROR = -1, - BT_PLUGIN_STATUS_NOMEM = -4, + BT_PLUGIN_STATUS_OK = 0, + BT_PLUGIN_STATUS_ERROR = -1, + BT_PLUGIN_STATUS_NOMEM = -4, }; -/* Functions */ +/* Plugin functions */ +struct bt_plugin *bt_plugin_find(const char *plugin_name); +struct bt_component_class *bt_plugin_find_component_class( + const char *plugin_name, const char *component_class_name, + enum bt_component_class_type component_class_type); +struct bt_plugin_set *bt_plugin_create_all_from_file(const char *path); +struct bt_plugin_set *bt_plugin_create_all_from_dir(const char *path, + int recurse); +struct bt_plugin_set *bt_plugin_create_all_from_static(void); const char *bt_plugin_get_name(struct bt_plugin *plugin); const char *bt_plugin_get_author(struct bt_plugin *plugin); const char *bt_plugin_get_license(struct bt_plugin *plugin); const char *bt_plugin_get_description(struct bt_plugin *plugin); const char *bt_plugin_get_path(struct bt_plugin *plugin); enum bt_plugin_status bt_plugin_get_version(struct bt_plugin *plugin, - unsigned int *OUTPUT, unsigned int *OUTPUT, unsigned int *OUTPUT, - const char **BTOUTSTR); -int bt_plugin_get_component_class_count(struct bt_plugin *plugin); -struct bt_component_class *bt_plugin_get_component_class( - struct bt_plugin *plugin, size_t index); + unsigned int *OUTPUTINIT, unsigned int *OUTPUTINIT, + unsigned int *OUTPUTINIT, const char **BTOUTSTR); +int64_t bt_plugin_get_component_class_count(struct bt_plugin *plugin); +struct bt_component_class *bt_plugin_get_component_class_by_index( + struct bt_plugin *plugin, uint64_t index); struct bt_component_class *bt_plugin_get_component_class_by_name_and_type( struct bt_plugin *plugin, const char *name, enum bt_component_class_type type); -struct bt_plugin *bt_plugin_create_from_name(const char *plugin_name); - -%{ -static PyObject *bt_py3_plugin_ptrs_list_from_bt_plugins(struct bt_plugin **plugins) -{ - PyObject *py_plugin_ptrs = NULL; - struct bt_plugin **plugin_at; - - if (!plugins) { - goto error; - } - - py_plugin_ptrs = PyList_New(0); - if (!py_plugin_ptrs) { - goto error; - } - - plugin_at = plugins; - - while (*plugin_at) { - struct bt_plugin *plugin = *plugin_at; - PyObject *py_plugin_ptr; - int ret; - - py_plugin_ptr = SWIG_NewPointerObj(SWIG_as_voidptr(plugin), - SWIGTYPE_p_bt_plugin, 0); - if (!py_plugin_ptr) { - goto error; - } - - ret = PyList_Append(py_plugin_ptrs, py_plugin_ptr); - Py_DECREF(py_plugin_ptr); - if (ret < 0) { - goto error; - } - - plugin_at++; - } - - goto end; - -error: - Py_XDECREF(py_plugin_ptrs); - py_plugin_ptrs = Py_None; - Py_INCREF(py_plugin_ptrs); - - if (plugins) { - /* - * Put existing plugin references since they are not - * moved to the caller. - */ - plugin_at = plugins; - - while (*plugin_at) { - bt_put(*plugin_at); - plugin_at++; - } - } - -end: - PyErr_Clear(); - free(plugins); - return py_plugin_ptrs; -} - -static PyObject *bt_py3_plugin_create_all_from_file(const char *path) -{ - return bt_py3_plugin_ptrs_list_from_bt_plugins( - bt_plugin_create_all_from_file(path)); -} - -static PyObject *bt_py3_plugin_create_all_from_dir(const char *path, - bool recurse) -{ - return bt_py3_plugin_ptrs_list_from_bt_plugins( - bt_plugin_create_all_from_dir(path, recurse)); -} -%} -PyObject *bt_py3_plugin_create_all_from_file(const char *path); -PyObject *bt_py3_plugin_create_all_from_dir(const char *path, - bool recurse); +/* Plugin set functions */ +int64_t bt_plugin_set_get_plugin_count(struct bt_plugin_set *plugin_set); +struct bt_plugin *bt_plugin_set_get_plugin(struct bt_plugin_set *plugin_set, + uint64_t index);