* THE SOFTWARE.
*/
-%{
-#include <babeltrace/plugin/plugin.h>
-#include <assert.h>
-%}
-
/* 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);