-#ifndef BABELTRACE_COMPONENT_COMPONENT_CLASS_H
-#define BABELTRACE_COMPONENT_COMPONENT_CLASS_H
+#ifndef BABELTRACE_GRAPH_COMPONENT_CLASS_H
+#define BABELTRACE_GRAPH_COMPONENT_CLASS_H
/*
- * Babeltrace - Component Class Interface.
- *
+ * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
* Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* SOFTWARE.
*/
-#include <babeltrace/graph/component.h>
-#include <stdint.h>
+/* For BT_QUERY_EXECUTOR_STATUS_* */
+#include <babeltrace/graph/query-executor-const.h>
+
+/* For bt_component_class */
+#include <babeltrace/types.h>
+
+/* For bt_component_class_status */
+#include <babeltrace/graph/component-class-const.h>
#ifdef __cplusplus
extern "C" {
#endif
-struct bt_component_class;
-struct bt_component;
-struct bt_private_component;
-struct bt_private_port;
-struct bt_port;
-struct bt_value;
-struct bt_private_notification_iterator;
-
-/**
- * Component class type.
- */
-enum bt_component_class_type {
- BT_COMPONENT_CLASS_TYPE_UNKNOWN = -1,
-
- /** A source component is a notification generator. */
- BT_COMPONENT_CLASS_TYPE_SOURCE = 0,
-
- /** A sink component handles incoming notifications. */
- BT_COMPONENT_CLASS_TYPE_SINK = 1,
-
- /** A filter component implements both Source and Sink interfaces. */
- BT_COMPONENT_CLASS_TYPE_FILTER = 2,
-};
-
-typedef enum bt_component_status (*bt_component_class_init_method)(
- struct bt_private_component *private_component,
- struct bt_value *params, void *init_method_data);
-
-typedef void (*bt_component_class_finalize_method)(
- struct bt_private_component *private_component);
-
-typedef enum bt_notification_iterator_status
- (*bt_component_class_notification_iterator_init_method)(
- struct bt_private_notification_iterator *private_notification_iterator,
- struct bt_private_port *private_port);
-
-typedef void (*bt_component_class_notification_iterator_finalize_method)(
- struct bt_private_notification_iterator *private_notification_iterator);
-
-typedef struct bt_notification_iterator_next_return (*bt_component_class_notification_iterator_next_method)(
- struct bt_private_notification_iterator *private_notification_iterator);
-
-typedef enum bt_notification_iterator_status
- (*bt_component_class_notification_iterator_seek_time_method)(
- struct bt_private_notification_iterator *private_notification_iterator,
- int64_t time);
-
-typedef struct bt_value *(*bt_component_class_query_method)(
- struct bt_component_class *component_class,
- const char *object, struct bt_value *params);
-
-typedef enum bt_component_status (*bt_component_class_accept_port_connection_method)(
- struct bt_private_component *private_component,
- struct bt_private_port *self_private_port,
- struct bt_port *other_port);
-
-typedef void (*bt_component_class_port_connected_method)(
- struct bt_private_component *private_component,
- struct bt_private_port *self_private_port,
- struct bt_port *other_port);
-
-typedef void (*bt_component_class_port_disconnected_method)(
- struct bt_private_component *private_component,
- struct bt_private_port *private_port);
-
-extern int bt_component_class_set_init_method(
- struct bt_component_class *component_class,
- bt_component_class_init_method init_method);
-
-extern int bt_component_class_set_finalize_method(
- struct bt_component_class *component_class,
- bt_component_class_finalize_method finalize_method);
-
-extern int bt_component_class_set_accept_port_connection_method(
- struct bt_component_class *component_class,
- bt_component_class_accept_port_connection_method accept_port_connection_method);
-
-extern int bt_component_class_set_port_connected_method(
- struct bt_component_class *component_class,
- bt_component_class_port_connected_method port_connected_method);
-
-extern int bt_component_class_set_port_disconnected_method(
- struct bt_component_class *component_class,
- bt_component_class_port_disconnected_method port_disconnected_method);
-
-extern int bt_component_class_set_query_method(
- struct bt_component_class *component_class,
- bt_component_class_query_method query_method);
-
-extern int bt_component_class_set_description(
- struct bt_component_class *component_class,
+typedef enum bt_query_status {
+ BT_QUERY_STATUS_OK = BT_QUERY_EXECUTOR_STATUS_OK,
+ BT_QUERY_STATUS_AGAIN = BT_QUERY_EXECUTOR_STATUS_AGAIN,
+ BT_QUERY_STATUS_ERROR = BT_QUERY_EXECUTOR_STATUS_ERROR,
+ BT_QUERY_STATUS_NOMEM = BT_QUERY_EXECUTOR_STATUS_NOMEM,
+ BT_QUERY_STATUS_INVALID_OBJECT = BT_QUERY_EXECUTOR_STATUS_INVALID_OBJECT,
+ BT_QUERY_STATUS_INVALID_PARAMS = BT_QUERY_EXECUTOR_STATUS_INVALID_PARAMS,
+} bt_query_status;
+
+extern bt_component_class_status bt_component_class_set_description(
+ bt_component_class *component_class,
const char *description);
-extern int bt_component_class_set_help(
- struct bt_component_class *component_class,
+extern bt_component_class_status bt_component_class_set_help(
+ bt_component_class *component_class,
const char *help);
-extern int bt_component_class_freeze(
- struct bt_component_class *component_class);
-
-/**
- * Get a component class' name.
- *
- * @param component_class Component class of which to get the name
- * @returns Name of the component class
- */
-extern const char *bt_component_class_get_name(
- struct bt_component_class *component_class);
-
-/**
- * Get a component class' description.
- *
- * Component classes may provide an optional description. It may, however,
- * opt not to.
- *
- * @param component_class Component class of which to get the description
- * @returns Description of the component class, or NULL.
- */
-extern const char *bt_component_class_get_description(
- struct bt_component_class *component_class);
-
-extern const char *bt_component_class_get_help(
- struct bt_component_class *component_class);
-
-extern struct bt_value *bt_component_class_query(
- struct bt_component_class *component_class,
- const char *object, struct bt_value *params);
-
-/**
- * Get a component class' type.
- *
- * @param component_class Component class of which to get the type
- * @returns One of #bt_component_type
- */
-extern enum bt_component_class_type bt_component_class_get_type(
- struct bt_component_class *component_class);
-
#ifdef __cplusplus
}
#endif
-#endif /* BABELTRACE_COMPONENT_COMPONENT_CLASS_H */
+#endif /* BABELTRACE_GRAPH_COMPONENT_CLASS_H */