bt2: add create_plugin_from_name()
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 8 Feb 2017 00:12:33 +0000 (19:12 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 28 May 2017 16:57:37 +0000 (12:57 -0400)
This function wraps bt_plugin_create_from_name().

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
bindings/python/bt2/native_btplugin.i
bindings/python/bt2/plugin.py

index 9b1bb56fe74fcddc03a36c1afe6b62e605cb6257..95164f1bc800192ddfa299d2a6346d8a93e71a0b 100644 (file)
@@ -52,6 +52,7 @@ struct bt_component_class *bt_plugin_get_component_class(
 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)
index 1f71c126b833a9bb638140926c14a38262bad143..9ce4c53a61ab3f228209e2df40ba03324af388d9 100644 (file)
@@ -56,6 +56,16 @@ def create_plugins_from_dir(path, recurse=True):
     return _plugin_ptrs_to_plugins(plugin_ptrs)
 
 
+def create_plugin_from_name(name):
+    utils._check_str(name)
+    plugin_ptr = native_bt.plugin_create_from_name(name)
+
+    if plugin_ptr is None:
+        return
+
+    return _Plugin._create_from_ptr(plugin_ptr)
+
+
 class _PluginVersion:
     def __init__(self, major, minor, patch, extra):
         self._major = major
This page took 0.02503 seconds and 4 git commands to generate.