extern "C" {
#endif
-struct bt_component_factory;
+/**
+ * Status code. Errors are always negative.
+ */
+enum bt_component_factory_status {
+ /** General error. */
+ BT_COMPONENT_FACTORY_STATUS_ERROR = -128,
+
+ /** Invalid plugin. */
+ BT_COMPONENT_FACTORY_STATUS_INVAL_PLUGIN = -6,
+
+ /** Invalid arguments. */
+ BT_COMPONENT_FACTORY_STATUS_INVAL = -5,
+
+ /** Memory allocation failure. */
+ BT_COMPONENT_FACTORY_STATUS_NOMEM = -4,
+
+ /** I/O error. */
+ BT_COMPONENT_FACTORY_STATUS_IO = -3,
+
+ /** No such file or directory. */
+ BT_COMPONENT_FACTORY_STATUS_NOENT = -2,
+
+ /** Operation not permitted. */
+ BT_COMPONENT_FACTORY_STATUS_PERM = -1,
-typedef struct bt_component *(*bt_component_init_cb)(
- struct bt_component *component);
+ /** No error, okay. */
+ BT_COMPONENT_FACTORY_STATUS_OK = 0,
+};
-typedef struct bt_component *(*bt_component_fini_cb)(
- struct bt_component *component);
+struct bt_component_factory;
+
+/**
+ * Create a component factory.
+ *
+ * @returns An instance of component factory
+ */
+extern struct bt_component_factory *bt_component_factory_create(void);
-enum bt_component_status bt_component_factory_create(const char *path);
+/**
+ * Get the list of components registered to this factory.
+ */
+extern struct bt_object *bt_component_factory_get_components(
+ struct bt_component_factory *factory);
-enum bt_component_status bt_component_factory_register_source_component_class(
- struct bt_component_factory *factory, const char *name,
- bt_component_init_cb init, bt_component_fini_cb fini,
- bt_component_source_iterator_create_cb iterator_create_cb);
+/**
+ * Recursively load and register Babeltrace plugins under a given path.
+ *
+ * Path will be traversed recursively if it is a directory, otherwise only the
+ * provided file will be loaded.
+ *
+ * @param factory A component factory instance
+ * @param path A path to a file or directory
+ * @returns One of #bt_component_factory_status values
+ */
+extern enum bt_component_factory_status bt_component_factory_load(
+ struct bt_component_factory *factory, const char *path);
-enum bt_component_status bt_component_factory_register_sink_component_class(
- struct bt_component_factory *factory, const char *name,
- bt_component_init_cb init, bt_component_fini_cb fini,
- bt_component_sink_handle_notification_cb handle_notification_cb);
+extern enum bt_component_factory_status
+bt_component_factory_register_source_component_class(
+ struct bt_component_factory *factory, const char *name,
+ bt_component_source_init_cb init);
-void bt_component_factory_destroy(struct bt_component_factory *factory);
+extern enum bt_component_factory_status
+bt_component_factory_register_sink_component_class(
+ struct bt_component_factory *factory, const char *name,
+ bt_component_sink_init_cb init);
#ifdef __cplusplus
}