+++ /dev/null
-#ifndef BABELTRACE_PLUGIN_COMPONENT_CLASS_H
-#define BABELTRACE_PLUGIN_COMPONENT_CLASS_H
-
-/*
- * Babeltrace - Plugin Component Class Interface.
- *
- * Copyright 2015 EfficiOS Inc.
- * Copyright 2015 Philippe Proulx <pproulx@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <stdint.h>
-#include <babeltrace/plugin/factory.h>
-
-#ifdef __cplusplus
-extern "C" {
- #endif
-
-#define BT_PLUGIN_NAME(_x) const char *__bt_plugin_name = (_x)
-#define BT_PLUGIN_AUTHOR(_x) const char *__bt_plugin_author = (_x)
-#define BT_PLUGIN_LICENSE(_x) const char *__bt_plugin_license = (_x)
-#define BT_PLUGIN_INIT(_x) void *__bt_plugin_init = (_x)
-#define BT_PLUGIN_EXIT(_x) void *__bt_plugin_exit = (_x)
-
-#define BT_PLUGIN_COMPONENT_CLASSES_BEGIN\
- enum bt_status __bt_plugin_register_component_classes(\
- struct bt_component_factory *factory)\
- {
-
-#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_ENTRY(_name, _init, _fini, _it_cr) \
- bt_component_factory_register_source_component_class(factory, \
- _name, _init, _fini, _it_cr);
-
-#define BT_PLUGIN_SINK_COMPONENT_CLASS_ENTRY(_name, _init, _fini, _hd_notif) \
- bt_component_factory_register_sink_component_class(factory, \
- _name, _init, _fini, _hd_notif);
-
-#define BT_PLUGIN_COMPONENT_CLASSES_END\
- \
- return BT_STATUS_OK;\
-}\
- \
- BT_PLUGIN_INIT(__bt_plugin_register_component_classes);\
- BT_PLUGIN_EXIT(NULL);
-
- #ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_PLUGIN_COMPONENT_CLASS_H */
--- /dev/null
+
+/** Component initialization functions */
+/**
+ * Allocate a source component.
+ *
+ * @param name Component instance name (will be copied)
+ * @param private_data Private component implementation data
+ * @param destroy_cb Component private data clean-up callback
+ * @param iterator_create_cb Iterator creation callback
+ * @returns A source component instance
+ */
+extern struct bt_component *bt_component_source_create(const char *name,
+ void *private_data, bt_component_destroy_cb destroy_func,
+ bt_component_source_iterator_create_cb iterator_create_cb);
+
+/**
+ * Allocate a sink component.
+ *
+ * @param name Component instance name (will be copied)
+ * @param private_data Private component implementation data
+ * @param destroy_cb Component private data clean-up callback
+ * @param notification_cb Notification handling callback
+ * @returns A sink component instance
+ */
+extern struct bt_component *bt_component_sink_create(const char *name,
+ void *private_data, bt_component_destroy_cb destroy_func,
+ bt_component_sink_handle_notification_cb notification_cb);
-#ifndef BABELTRACE_PLUGIN_COMPONENT_CLASS_H
-#define BABELTRACE_PLUGIN_COMPONENT_CLASS_H
+#ifndef BABELTRACE_PLUGIN_COMPONENT_FACTORY_H
+#define BABELTRACE_PLUGIN_COMPONENT_FACTORY_H
/*
- * Babeltrace - Plugin Component Class Interface.
+ * Babeltrace - Component Factory Class Interface.
*
- * Copyright 2015 EfficiOS Inc.
- * Copyright 2015 Philippe Proulx <pproulx@efficios.com>
+ * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* SOFTWARE.
*/
-#include <stdint.h>
-#include <babeltrace/plugin/factory.h>
+#include <babeltrace/plugin/component.h>
+#include <babeltrace/plugin/source.h>
+#include <babeltrace/plugin/sink.h>
+#include <babeltrace/plugin/filter.h>
#ifdef __cplusplus
extern "C" {
- #endif
+#endif
+
+struct bt_component_factory;
-#define BT_PLUGIN_NAME(_x) const char *__bt_plugin_name = (_x)
-#define BT_PLUGIN_AUTHOR(_x) const char *__bt_plugin_author = (_x)
-#define BT_PLUGIN_LICENSE(_x) const char *__bt_plugin_license = (_x)
-#define BT_PLUGIN_INIT(_x) void *__bt_plugin_init = (_x)
-#define BT_PLUGIN_EXIT(_x) void *__bt_plugin_exit = (_x)
+typedef struct bt_component *(*bt_component_init)(
+ struct bt_component *component);
-#define BT_PLUGIN_COMPONENT_CLASSES_BEGIN\
- enum bt_status __bt_plugin_register_component_classes(\
- struct bt_component_factory *factory)\
- {
+typedef struct bt_component *(*bt_component_fini)(
+ struct bt_component *component);
-#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_ENTRY(_name, _init, _fini, _it_cr) \
- bt_component_factory_register_source_component_class(factory, \
- _name, _init, _fini, _it_cr);
+enum bt_component_status bt_component_factory_create(const char *path);
-#define BT_PLUGIN_SINK_COMPONENT_CLASS_ENTRY(_name, _init, _fini, _hd_notif) \
- bt_component_factory_register_sink_component_class(factory, \
- _name, _init, _fini, _hd_notif);
+enum bt_component_status bt_component_factory_register_source_component_class(
+ struct bt_component_factory *factory, const char *name,
+ bt_component_init init, bt_component_fini fini,
+ bt_component_source_iterator_create_cb iterator_create_cb);
-#define BT_PLUGIN_COMPONENT_CLASSES_END\
- \
- return BT_STATUS_OK;\
-}\
- \
- BT_PLUGIN_INIT(__bt_plugin_register_component_classes);\
- BT_PLUGIN_EXIT(NULL);
+enum bt_component_status bt_component_factory_register_sink_component_class(
+ struct bt_component_factory *factory, const char *name,
+ bt_component_init init, bt_component_fini fini,
+ bt_component_sink_handle_notification_cb handle_notification_cb);
- #ifdef __cplusplus
+void bt_component_factory_destroy(struct bt_component_factory *factory);
+
+#ifdef __cplusplus
}
#endif
-#endif /* BABELTRACE_PLUGIN_H */
+#endif /* BABELTRACE_PLUGIN_COMPONENT_FACTORY_H */
#define BABELTRACE_PLUGIN_COMPONENT_H
/*
- * BabelTrace - Babeltrace Plug-in Component Interface
+ * BabelTrace - Babeltrace Component Interface
*
* Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
*
* Get component's name.
*
* @param component Component instance of which to get the name
- * @returns Returns a pointer to the plug-in's name
+ * @returns Returns a pointer to the component's name
*/
extern const char *bt_component_get_name(struct bt_component *component);
* Set component's name.
*
* @param component Component instance of which to set the name
- * @param name New plug-in name (will be copied)
+ * @param name New component name (will be copied)
* @returns One of #bt_component_status values
*/
extern enum bt_component_status bt_component_set_name(
-#ifndef BABELTRACE_PLUGIN_INTERNAL_H
-#define BABELTRACE_PLUGIN_INTERNAL_H
+#ifndef BABELTRACE_PLUGIN_COMPONENT_INTERNAL_H
+#define BABELTRACE_PLUGIN_COMPONENT_INTERNAL_H
/*
- * BabelTrace - Plug-in internal
+ * BabelTrace - Component internal
*
* Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
*
#include <babeltrace/babeltrace-internal.h>
#include <babeltrace/plugin/plugin.h>
+#include <babeltrace/plugin/component.h>
#include <babeltrace/plugin/plugin-system.h>
#include <babeltrace/ctf-writer/ref-internal.h>
#include <glib.h>
struct bt_notification;
-struct bt_plugin {
+struct bt_component {
struct bt_ctf_ref ref_count;
GString *name;
enum bt_plugin_type type;
};
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);
+enum bt_component_status bt_component_init(struct bt_component *plugin,
+ const char *name, void *user_data,
+ bt_component_destroy_cb destroy_func,
+ enum bt_component_type component_type,
+ bt_component_destroy_cb component_destroy);
#ifdef __cplusplus
}
#endif
-#endif /* BABELTRACE_PLUGIN_INTERNAL_H */
+#endif /* BABELTRACE_PLUGIN_COMPONENT_INTERNAL_H */
+++ /dev/null
-#ifndef BABELTRACE_PLUGIN_LIB_H
-#define BABELTRACE_PLUGIN_LIB_H
-
-/*
- * BabelTrace - Base interface of a Babeltrace Plug-in Library
- *
- * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <babeltrace/objects.h>
-#include <babeltrace/plugin/plugin.h>
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct bt_plugin;
-struct bt_notification;
-
-/**
- * Plug-in discovery functions.
- *
- * The Babeltrace plug-in architecture mandates that a given plug-in shared
- * object only define one plug-in. These functions are used to query a plug-in
- * shared object about its attributes.
- *
- * The functions marked as mandatory MUST be exported by the shared object
- * to be considered a valid plug-in.
- */
-
-/**
- * Get the plug-in type implemented by the library.
- *
- * @returns One of #bt_plugin_type values
- */
-extern enum bt_plugin_type bt_plugin_lib_get_type(void);
-
-/**
- * Get the name of the format implemented by the library.
- *
- * @returns A string (ownership is not transfered)
- */
-extern const char *bt_plugin_lib_get_format_name(void);
-
-/**
- * Create a plug-in instance configured with the provided parameters.
- *
- * @param params Map object of configuration parameters
- * (see bt_object_map_create())
- * @returns An instance of the plug-in
- */
-extern struct bt_plugin *bt_plugin_lib_create(struct bt_object *params);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* BABELTRACE_PLUGIN_H */
struct bt_notification;
/**
- * Plug-in private data deallocation function type.
+ * Component private data deallocation function type.
*
- * @param plugin Plug-in instance
+ * @param component Component instance
*/
-typedef void (*bt_plugin_destroy_cb)(struct bt_plugin *plugin);
+typedef void (*bt_component_destroy_cb)(struct bt_component *component);
/**
* Iterator creation function type.
*
- * @param plugin Plug-in instance
+ * @param component Component instance
*/
typedef struct bt_notification_iterator *(
- *bt_plugin_source_iterator_create_cb)(
- struct bt_plugin *plugin);
+ *bt_component_source_iterator_create_cb)(
+ struct bt_component *component);
/**
* Notification handling function type.
*
- * @param plugin Plug-in instance
+ * @param component Component instance
* @param notificattion Notification to handle
- * @returns One of #bt_plugin_status values
+ * @returns One of #bt_component_status values
*/
-typedef enum bt_plugin_status (*bt_plugin_sink_handle_notification_cb)(
- struct bt_plugin *, struct bt_notification *);
+typedef enum bt_component_status (*bt_component_sink_handle_notification_cb)(
+ struct bt_component *, struct bt_notification *);
typedef struct bt_notification *(bt_notification_iterator_get_notification_cb)(
struct bt_notification_iterator *);
struct bt_notification_iterator *);
/**
- * Get a plug-in's private (implementation) data.
+ * Get a component's private (implementation) data.
*
- * @param plugin Plug-in of which to get the private data
- * @returns Plug-in private data
+ * @param component Component of which to get the private data
*/
-extern void *bt_plugin_get_private_data(struct bt_plugin *plugin);
-
-
-/** Plug-in initialization functions */
-/**
- * Allocate a source plug-in.
- *
- * @param name Plug-in instance name (will be copied)
- * @param private_data Private plug-in implementation data
- * @param destroy_cb Plug-in private data clean-up callback
- * @param iterator_create_cb Iterator creation callback
- * @returns A source plug-in instance
- */
-extern struct bt_plugin *bt_plugin_source_create(const char *name,
- void *private_data, bt_plugin_destroy_cb destroy_func,
- bt_plugin_source_iterator_create_cb iterator_create_cb);
+extern void *bt_component_get_private_data(struct bt_component *component);
/**
- * Allocate a sink plug-in.
+ * Set a component's private (implementation) data.
*
- * @param name Plug-in instance name (will be copied)
- * @param private_data Private plug-in implementation data
- * @param destroy_cb Plug-in private data clean-up callback
- * @param notification_cb Notification handling callback
- * @returns A sink plug-in instance
+ * @param component Component of which to set the private data
+ * @param data Component private data
*/
-extern struct bt_plugin *bt_plugin_sink_create(const char *name,
- void *private_data, bt_plugin_destroy_cb destroy_func,
- bt_plugin_sink_handle_notification_cb notification_cb);
+extern enum bt_component_status bt_component_set_private_data(struct bt_component *component,
+ void *data);
/** Notification iterator functions */
/**
* Allocate a notification iterator.
*
- * @param plugin Plug-in instance
+ * @param component Component instance
* @param next_cb Callback advancing to the next notification
* @param notification_cb Callback providing the current notification
* @returns A notification iterator instance
*/
extern struct bt_notification_iterator *bt_notification_iterator_create(
- struct bt_plugin *plugin,
+ struct bt_component *component,
bt_notification_iterator_next_cb next_cb,
bt_notification_iterator_get_notification_cb notification_cb);
* BabelTrace - Babeltrace Plug-in Interface
*
* Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ * Copyright 2015 Philippe Proulx <pproulx@efficios.com>
*
* Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
*
* SOFTWARE.
*/
-#include <babeltrace/plugin/component.h>
-#include <babeltrace/plugin/component-class.h>
-#include <babeltrace/plugin/source.h>
-#include <babeltrace/plugin/sink.h>
-#include <babeltrace/plugin/filter.h>
+#include <babeltrace/plugin/component-factory.h>
+
+#define BT_PLUGIN_NAME(_x) const char *__bt_plugin_name = (_x)
+#define BT_PLUGIN_AUTHOR(_x) const char *__bt_plugin_author = (_x)
+#define BT_PLUGIN_LICENSE(_x) const char *__bt_plugin_license = (_x)
+#define BT_PLUGIN_INIT(_x) void *__bt_plugin_init = (_x)
+#define BT_PLUGIN_EXIT(_x) void *__bt_plugin_exit = (_x)
+
+#define BT_PLUGIN_COMPONENT_CLASSES_BEGIN \
+ enum bt_status __bt_plugin_register_component_classes(\
+ struct bt_component_factory *factory)\
+ {
+
+#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_ENTRY(_name, _init, _fini, _it_cr) \
+ bt_component_factory_register_source_component_class(factory, \
+ _name, _init, _fini, _it_cr);
+
+#define BT_PLUGIN_SINK_COMPONENT_CLASS_ENTRY(_name, _init, _fini, _hd_notif) \
+ bt_component_factory_register_sink_component_class(factory, \
+ _name, _init, _fini, _hd_notif);
+
+#define BT_PLUGIN_COMPONENT_CLASSES_END\
+ \
+ return BT_STATUS_OK;\
+}\
+ \
+ BT_PLUGIN_INIT(__bt_plugin_register_component_classes);\
+ BT_PLUGIN_EXIT(NULL);
#endif /* BABELTRACE_PLUGIN_H */
--- /dev/null
+#ifndef BABELTRACE_PLUGIN_COMPONENT_SINK_H
+#define BABELTRACE_PLUGIN_COMPONENT_SINK_H
+
+/*
+ * BabelTrace - Sink Component Interface
+ *
+ * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace/plugin/plugin-system.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Hand-off a notification to a sink component.
+ *
+ * @param component Component instance
+ * @returns One of #bt_component_status values
+ */
+enum bt_component_status bt_component_sink_handle_notification(
+ struct bt_component *component);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_PLUGIN_COMPONENT_SINK_H */