Add base plug-in skeletons
[babeltrace.git] / include / babeltrace / plugin / component.h
index b019edbe3deac4115085ce45975fcc1d302a2b99..5dc0e3903ac5186f25590b63dadc9a04ad66165d 100644 (file)
  * SOFTWARE.
  */
 
+#include <babeltrace/plugin/component-class.h>
+#include <babeltrace/values.h>
 #include <stdio.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-/**
- * Component type.
- */
-enum bt_component_type {
-       BT_COMPONENT_TYPE_UNKNOWN =     -1,
-
-       /** A source component is a notification generator. */
-       BT_COMPONENT_TYPE_SOURCE =      0,
-
-       /** A sink component handles incoming notifications. */
-       BT_COMPONENT_TYPE_SINK =        1,
-
-       /** A filter component implements both Source and Sink interfaces. */
-       BT_COMPONENT_TYPE_FILTER =      2,
-};
-
 /**
  * Status code. Errors are always negative.
  */
 enum bt_component_status {
        /** Memory allocation failure. */
-       /* -12 for compatibility with -ENOMEM */
-       BT_COMPONENT_STATUS_NOMEM =             -12,
+       BT_COMPONENT_STATUS_NOMEM =             -4,
 
        /** Invalid arguments. */
-       /* -22 for compatibility with -EINVAL */
-       BT_COMPONENT_STATUS_INVAL =             -22,
+       BT_COMPONENT_STATUS_INVAL =             -3,
 
        /** Unsupported component feature. */
        BT_COMPONENT_STATUS_UNSUPPORTED =       -2,
@@ -71,7 +55,21 @@ enum bt_component_status {
        BT_COMPONENT_STATUS_OK =                0,
 };
 
+
 struct bt_component;
+struct bt_value;
+
+/**
+ * Create an instance of a component from a component class.
+ *
+ * @param component_class      Component class of which to create an instance
+ * @param name                 Name of the new component instance, optional
+ * @param params               A dictionary of component parameters
+ * @returns                    Returns a pointer to a new component instance
+ */
+extern struct bt_component *bt_component_create(
+               struct bt_component_class *component_class, const char *name,
+               struct bt_value *params);
 
 /**
  * Get component's name.
@@ -92,16 +90,16 @@ extern enum bt_component_status bt_component_set_name(
                struct bt_component *component, const char *name);
 
 /**
- * Get component instance type.
+ * Get component's class.
  *
- * @param component    Component instance of which to get the type
- * @returns            One of #bt_component_type values
+ * @param component    Component instance of which to get the class
+ * @returns            The component's class
  */
-extern enum bt_component_type bt_component_get_type(
+extern struct bt_component_class *bt_component_get_class(
                struct bt_component *component);
 
 /**
- * Set component instance's error stream.
+ * Set component instance's error stream.
  *
  * @param component    Component instance
  * @param error_stream Error stream
This page took 0.023679 seconds and 4 git commands to generate.