-#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.
#include <stdint.h>
#include <babeltrace/graph/component-status.h>
#include <babeltrace/graph/notification-iterator.h>
+#include <babeltrace/graph/query-executor.h>
+#include <babeltrace/types.h>
#ifdef __cplusplus
extern "C" {
struct bt_port;
struct bt_value;
struct bt_private_notification_iterator;
+struct bt_query_executor;
/**
* Component class type.
BT_COMPONENT_CLASS_TYPE_FILTER = 2,
};
+struct bt_notification_iterator_next_return {
+ struct bt_notification *notification;
+ enum bt_notification_iterator_status status;
+};
+
+struct bt_component_class_query_return {
+ struct bt_value *result;
+ enum bt_query_status status;
+};
+
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 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)(
+typedef struct bt_component_class_query_return (*bt_component_class_query_method)(
struct bt_component_class *component_class,
+ struct bt_query_executor *query_executor,
const char *object, struct bt_value *params);
typedef enum bt_component_status (*bt_component_class_accept_port_connection_method)(
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.
*
extern enum bt_component_class_type bt_component_class_get_type(
struct bt_component_class *component_class);
+static inline
+bt_bool bt_component_class_is_source(struct bt_component_class *component_class)
+{
+ return bt_component_class_get_type(component_class) ==
+ BT_COMPONENT_CLASS_TYPE_SOURCE;
+}
+
+static inline
+bt_bool bt_component_class_is_filter(struct bt_component_class *component_class)
+{
+ return bt_component_class_get_type(component_class) ==
+ BT_COMPONENT_CLASS_TYPE_FILTER;
+}
+
+static inline
+bt_bool bt_component_class_is_sink(struct bt_component_class *component_class)
+{
+ return bt_component_class_get_type(component_class) ==
+ BT_COMPONENT_CLASS_TYPE_SINK;
+}
+
#ifdef __cplusplus
}
#endif
-#endif /* BABELTRACE_COMPONENT_COMPONENT_CLASS_H */
+#endif /* BABELTRACE_GRAPH_COMPONENT_CLASS_H */