lib: use object pool for event and packet notifications
[babeltrace.git] / include / babeltrace / graph / component.h
index 74f38345a78b73de128091aaec35bed716c408ce..f2db9d723c1f254056937b90e1be920fe016429f 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef BABELTRACE_COMPONENT_COMPONENT_H
-#define BABELTRACE_COMPONENT_COMPONENT_H
+#ifndef BABELTRACE_GRAPH_COMPONENT_H
+#define BABELTRACE_GRAPH_COMPONENT_H
 
 /*
  * BabelTrace - Babeltrace Component Interface
  * SOFTWARE.
  */
 
+/* For BT_COMPONENT_CLASS_TYPE_* */
 #include <babeltrace/graph/component-class.h>
-#include <babeltrace/graph/notification-iterator.h>
-#include <babeltrace/values.h>
-#include <stdio.h>
+
+/* For bt_bool */
+#include <babeltrace/types.h>
+
+/* For bt_get */
+#include <babeltrace/ref.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -42,49 +46,6 @@ struct bt_component;
 struct bt_value;
 struct bt_port;
 
-/**
- * Status code. Errors are always negative.
- */
-enum bt_component_status {
-       /** No error, okay. */
-       BT_COMPONENT_STATUS_OK                          = 0,
-       /** No more work to be done by this component. **/
-       BT_COMPONENT_STATUS_END                         = 1,
-       /**
-        * Component can't process a notification at this time
-        * (e.g. would block), try again later.
-        */
-       BT_COMPONENT_STATUS_AGAIN                       = 2,
-       /** Refuse port connection. */
-       BT_COMPONENT_STATUS_REFUSE_PORT_CONNECTION      = 3,
-       /** General error. */
-       BT_COMPONENT_STATUS_ERROR                       = -1,
-       /** Unsupported component feature. */
-       BT_COMPONENT_STATUS_UNSUPPORTED                 = -2,
-       /** Invalid arguments. */
-       BT_COMPONENT_STATUS_INVALID                     = -3,
-       /** Memory allocation failure. */
-       BT_COMPONENT_STATUS_NOMEM                       = -4,
-       /** Element not found. */
-       BT_COMPONENT_STATUS_NOT_FOUND                   = -5,
-};
-
-/**
- * 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);
-
-extern struct bt_component *bt_component_create_with_init_method_data(
-               struct bt_component_class *component_class, const char *name,
-               struct bt_value *params, void *init_method_data);
-
 /**
  * Get component's name.
  *
@@ -105,10 +66,37 @@ extern struct bt_component_class *bt_component_get_class(
 extern enum bt_component_class_type bt_component_get_class_type(
                struct bt_component *component);
 
-extern struct bt_graph *bt_component_get_graph(struct bt_component *component);
+static inline
+bt_bool bt_component_is_source(struct bt_component *component)
+{
+       return bt_component_get_class_type(component) ==
+               BT_COMPONENT_CLASS_TYPE_SOURCE;
+}
+
+static inline
+bt_bool bt_component_is_filter(struct bt_component *component)
+{
+       return bt_component_get_class_type(component) ==
+               BT_COMPONENT_CLASS_TYPE_FILTER;
+}
+
+static inline
+bt_bool bt_component_is_sink(struct bt_component *component)
+{
+       return bt_component_get_class_type(component) ==
+               BT_COMPONENT_CLASS_TYPE_SINK;
+}
+
+extern struct bt_graph *bt_component_borrow_graph(struct bt_component *component);
+
+static inline
+struct bt_graph *bt_component_get_graph(struct bt_component *component)
+{
+       return bt_get(bt_component_borrow_graph(component));
+}
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* BABELTRACE_COMPONENT_COMPONENT_H */
+#endif /* BABELTRACE_GRAPH_COMPONENT_H */
This page took 0.026082 seconds and 4 git commands to generate.