-#ifndef BABELTRACE_PLUGIN_INTERNAL_H
-#define BABELTRACE_PLUGIN_INTERNAL_H
+#ifndef BABELTRACE_PLUGIN_PLUGIN_INTERNAL_H
+#define BABELTRACE_PLUGIN_PLUGIN_INTERNAL_H
/*
- * BabelTrace - Plug-in internal
+ * BabelTrace - Plug-in Internal
*
* Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
*
*/
#include <babeltrace/babeltrace-internal.h>
-#include <babeltrace/plugin/plugin.h>
-#include <babeltrace/plugin/plugin-system.h>
-#include <babeltrace/ctf-writer/ref-internal.h>
+#include <babeltrace/plugin/plugin-dev.h>
+#include <babeltrace/object-internal.h>
+#include <stdbool.h>
#include <glib.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct bt_notification;
+enum bt_plugin_type {
+ BT_PLUGIN_TYPE_SO = 0,
+ BT_PLUGIN_TYPE_PYTHON = 1,
+};
struct bt_plugin {
- struct bt_ctf_ref ref_count;
- GString *name;
+ struct bt_object base;
enum bt_plugin_type type;
- /** No ownership taken */
- FILE *error_stream;
+ bool frozen;
+
+ /* Array of pointers to bt_component_class (owned by this) */
+ GPtrArray *comp_classes;
- void *user_data;
- bt_plugin_destroy_cb user_data_destroy;
- bt_plugin_destroy_cb destroy;
+ /* Info (owned by this) */
+ struct {
+ GString *path;
+ GString *name;
+ GString *author;
+ GString *license;
+ GString *description;
+ struct {
+ unsigned int major;
+ unsigned int minor;
+ unsigned int patch;
+ GString *extra;
+ } version;
+ bool path_set;
+ bool name_set;
+ bool author_set;
+ bool license_set;
+ bool description_set;
+ bool version_set;
+ } info;
+
+ /* Value depends on the specific plugin type */
+ void *spec_data;
};
BT_HIDDEN
-enum bt_plugin_status bt_plugin_init(struct bt_plugin *plugin, const char *name,
- void *user_data,bt_plugin_destroy_cb destroy_func,
- enum bt_plugin_type plugin_type,
- bt_plugin_destroy_cb plugin_destroy);
+struct bt_plugin *bt_plugin_create_empty(enum bt_plugin_type type);
+
+static inline
+void bt_plugin_set_path(struct bt_plugin *plugin, const char *path)
+{
+ assert(plugin);
+ assert(path);
+ g_string_assign(plugin->info.path, path);
+ plugin->info.path_set = true;
+}
+
+static inline
+void bt_plugin_set_name(struct bt_plugin *plugin, const char *name)
+{
+ assert(plugin);
+ assert(name);
+ g_string_assign(plugin->info.name, name);
+ plugin->info.name_set = true;
+}
+
+static inline
+void bt_plugin_set_description(struct bt_plugin *plugin,
+ const char *description)
+{
+ assert(plugin);
+ assert(description);
+ g_string_assign(plugin->info.description, description);
+ plugin->info.description_set = true;
+}
+
+static inline
+void bt_plugin_set_author(struct bt_plugin *plugin, const char *author)
+{
+ assert(plugin);
+ assert(author);
+ g_string_assign(plugin->info.author, author);
+ plugin->info.author_set = true;
+}
+
+static inline
+void bt_plugin_set_license(struct bt_plugin *plugin, const char *license)
+{
+ assert(plugin);
+ assert(license);
+ g_string_assign(plugin->info.license, license);
+ plugin->info.license_set = true;
+}
+
+static inline
+void bt_plugin_set_version(struct bt_plugin *plugin, unsigned int major,
+ unsigned int minor, unsigned int patch, const char *extra)
+{
+ assert(plugin);
+ plugin->info.version.major = major;
+ plugin->info.version.minor = minor;
+ plugin->info.version.patch = patch;
+
+ if (extra) {
+ g_string_assign(plugin->info.version.extra, extra);
+ }
+
+ plugin->info.version_set = true;
+}
-#ifdef __cplusplus
+static inline
+void bt_plugin_freeze(struct bt_plugin *plugin)
+{
+ assert(plugin);
+ plugin->frozen = true;
}
-#endif
-#endif /* BABELTRACE_PLUGIN_INTERNAL_H */
+#endif /* BABELTRACE_PLUGIN_PLUGIN_INTERNAL_H */