extern
struct bt_component_class *bt_component_class_filter_create(const char *name,
- bt_component_class_filter_init_iterator_method init_iterator_method);
+ bt_component_class_notification_iterator_get_method notification_iterator_get_method,
+ bt_component_class_notification_iterator_next_method notification_iterator_next_method);
extern int bt_component_class_filter_set_add_iterator_method(
struct bt_component_class *component_class,
bt_component_class_filter_add_iterator_method add_iterator_method);
+extern
+int bt_component_class_filter_set_notification_iterator_init_method(
+ struct bt_component_class *component_class,
+ bt_component_class_notification_iterator_init_method notification_iterator_init_method);
+
+extern
+int bt_component_class_filter_set_notification_iterator_destroy_method(
+ struct bt_component_class *component_class,
+ bt_component_class_notification_iterator_destroy_method notification_iterator_destroy_method);
+
+extern
+int bt_component_class_filter_set_notification_iterator_seek_time_method(
+ struct bt_component_class *component_class,
+ bt_component_class_notification_iterator_seek_time_method notification_iterator_seek_time_method);
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* BABELTRACE_COMPONENT_COMPONENT_CLASS_FILTER_H */
bool frozen;
};
+struct bt_component_class_iterator_methods {
+ bt_component_class_notification_iterator_init_method init;
+ bt_component_class_notification_iterator_destroy_method destroy;
+ bt_component_class_notification_iterator_get_method get;
+ bt_component_class_notification_iterator_next_method next;
+ bt_component_class_notification_iterator_seek_time_method seek_time;
+};
+
struct bt_component_class_source {
struct bt_component_class parent;
struct {
- bt_component_class_source_init_iterator_method init_iterator;
+ struct bt_component_class_iterator_methods iterator;
} methods;
};
struct bt_component_class_filter {
struct bt_component_class parent;
struct {
- bt_component_class_filter_init_iterator_method init_iterator;
+ struct bt_component_class_iterator_methods iterator;
bt_component_class_filter_add_iterator_method add_iterator;
} methods;
};
struct bt_component_class;
-typedef enum bt_component_status (*bt_component_class_source_init_iterator_method)(
- struct bt_component *, struct bt_notification_iterator *);
-
extern
struct bt_component_class *bt_component_class_source_create(const char *name,
- bt_component_class_source_init_iterator_method init_iterator_method);
+ bt_component_class_notification_iterator_get_method notification_iterator_get_method,
+ bt_component_class_notification_iterator_next_method notification_iterator_next_method);
+
+extern
+int bt_component_class_source_set_notification_iterator_init_method(
+ struct bt_component_class *component_class,
+ bt_component_class_notification_iterator_init_method notification_iterator_init_method);
+
+extern
+int bt_component_class_source_set_notification_iterator_destroy_method(
+ struct bt_component_class *component_class,
+ bt_component_class_notification_iterator_destroy_method notification_iterator_destroy_method);
+
+extern
+int bt_component_class_source_set_notification_iterator_seek_time_method(
+ struct bt_component_class *component_class,
+ bt_component_class_notification_iterator_seek_time_method notification_iterator_seek_time_method);
#ifdef __cplusplus
}
typedef void (*bt_component_class_destroy_method)(struct bt_component *component);
+typedef enum bt_notification_iterator_status
+ (*bt_component_class_notification_iterator_init_method)(
+ struct bt_component *component,
+ struct bt_notification_iterator *iterator);
+
+typedef void (*bt_component_class_notification_iterator_destroy_method)(
+ struct bt_notification_iterator *iterator);
+
+typedef struct bt_notification *(*bt_component_class_notification_iterator_get_method)(
+ struct bt_notification_iterator *iterator);
+
+typedef enum bt_notification_iterator_status (*bt_component_class_notification_iterator_next_method)(
+ struct bt_notification_iterator *iterator);
+
+typedef enum bt_notification_iterator_status
+ (*bt_component_class_notification_iterator_seek_time_method)(
+ struct bt_notification_iterator *iterator, int64_t time);
+
extern int bt_component_class_set_init_method(
struct bt_component_class *component_class,
bt_component_class_init_method init_method);
struct bt_notification_iterator {
struct bt_object base;
struct bt_component *component;
- bt_notification_iterator_get_cb get;
- bt_notification_iterator_next_cb next;
- bt_notification_iterator_seek_time_cb seek_time;
void *user_data;
- bt_notification_iterator_destroy_cb user_destroy;
};
/**
extern struct bt_component *bt_notification_iterator_get_component(
struct bt_notification_iterator *iterator);
-/** bt_notification_iterator */
-/**
- * Function returning an iterator's current notification.
- *
- * @param iterator Notification iterator instance
- * @returns A notification instance
- */
-typedef struct bt_notification *(*bt_notification_iterator_get_cb)(
- struct bt_notification_iterator *iterator);
-
-/**
- * Function advancing an iterator's position of one element.
- *
- * @param iterator Notification iterator instance
- * @returns One of #bt_notification_iterator_status values
- */
-typedef enum bt_notification_iterator_status (*bt_notification_iterator_next_cb)(
- struct bt_notification_iterator *iterator);
-
-/**
- * Function advancing an iterator's position to a given time (relative to Epoch).
- *
- * @param iterator Notification iterator instance
- * @param time Time at which to seek, expressed in ns since Epoch
- * @returns One of #bt_notification_iterator_status values
- */
-typedef enum bt_notification_iterator_status
- (*bt_notification_iterator_seek_time_cb)(
- struct bt_notification_iterator *iterator, int64_t time);
-
-/**
- * Function cleaning-up an iterator's private data on destruction.
- *
- * @param iterator Notification iterator instance
- */
-typedef void (*bt_notification_iterator_destroy_cb)(
- struct bt_notification_iterator *iterator);
-
-/**
- * Set an iterator's "get" callback which return the current notification.
- *
- * @param iterator Notification iterator instance
- * @param get Notification return callback
- * @returns One of #bt_notification_iterator_status values
- */
-extern enum bt_notification_iterator_status
-bt_notification_iterator_set_get_cb(struct bt_notification_iterator *iterator,
- bt_notification_iterator_get_cb get);
-
-/**
- * Set an iterator's "next" callback which advances the iterator's position.
- *
- * @param iterator Notification iterator instance
- * @param next Iterator "next" callback
- * @returns One of #bt_notification_iterator_status values
- */
-extern enum bt_notification_iterator_status
-bt_notification_iterator_set_next_cb(struct bt_notification_iterator *iterator,
- bt_notification_iterator_next_cb next);
-
-/**
- * Set an iterator's "seek_time" callback which sets the iterator's position to
- * provided time (in ns since Epoch).
- *
- * @param iterator Notification iterator instance
- * @param seek_timetime Iterator "seek_time" callback
- * @returns One of #bt_notification_iterator_status values
- */
-extern enum bt_notification_iterator_status
-bt_notification_iterator_set_seek_time_cb(struct bt_notification_iterator *iterator,
- bt_notification_iterator_seek_time_cb seek_time);
-
-/**
- * Set an iterator's "destroy" callback.
- *
- * @param iterator Notification iterator instance
- * @param next Iterator destruction callback
- * @returns One of #bt_notification_iterator_status values
- */
-extern enum bt_notification_iterator_status
-bt_notification_iterator_set_destroy_cb(
- struct bt_notification_iterator *iterator,
- bt_notification_iterator_destroy_cb destroy);
-
/**
* Set an iterator's private data.
*
extern void *bt_notification_iterator_get_private_data(
struct bt_notification_iterator *iterator);
-
#ifdef __cplusplus
}
#endif
union {
/* BT_COMPONENT_CLASS_TYPE_SOURCE */
struct {
- bt_component_class_source_init_iterator_method init_iterator;
+ bt_component_class_notification_iterator_get_method notif_iter_get;
+ bt_component_class_notification_iterator_next_method notif_iter_next;
} source;
/* BT_COMPONENT_CLASS_TYPE_FILTER */
struct {
- bt_component_class_filter_init_iterator_method init_iterator;
+ bt_component_class_notification_iterator_get_method notif_iter_get;
+ bt_component_class_notification_iterator_next_method notif_iter_next;
} filter;
/* BT_COMPONENT_CLASS_TYPE_SINK */
BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD = 2,
BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_FILTER_ADD_ITERATOR_METHOD = 3,
BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_SINK_ADD_ITERATOR_METHOD = 4,
+ BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_INIT_METHOD = 5,
+ BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_DESTROY_METHOD = 6,
+ BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_SEEK_TIME_METHOD = 7,
};
/* Component class attribute (internal use) */
/* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_SINK_ADD_ITERATOR_METHOD */
bt_component_class_sink_add_iterator_method sink_add_iterator_method;
+
+ /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_INIT_METHOD */
+ bt_component_class_notification_iterator_init_method notif_iter_init_method;
+
+ /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_DESTROY_METHOD */
+ bt_component_class_notification_iterator_destroy_method notif_iter_destroy_method;
+
+ /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_SEEK_TIME_METHOD */
+ bt_component_class_notification_iterator_seek_time_method notif_iter_seek_time_method;
} value;
} __attribute__((packed));
/*
* Defines a source component class descriptor with a custom ID.
*
- * _id: ID (any valid C identifier except `auto`).
- * _comp_class_id: Component class ID (C identifier).
- * _name: Component class name (C string).
- * _init_iterator_method: Component class's iterator initialization method
- * (bt_component_class_source_init_iterator_method).
+ * _id: ID (any valid C identifier except `auto`).
+ * _comp_class_id: Component class ID (C identifier).
+ * _name: Component class name (C string).
+ * _notif_iter_get_method: Component class's iterator get method
+ * (bt_component_class_notification_iterator_get_method).
+ * _notif_iter_next_method: Component class's iterator next method
+ * (bt_component_class_notification_iterator_next_method).
*/
-#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _init_iterator_method) \
+#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _notif_iter_get_method, _notif_iter_next_method) \
static struct __bt_plugin_component_class_descriptor __bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id = { \
.plugin_descriptor = &__bt_plugin_descriptor_##_id, \
.name = _name, \
.type = BT_COMPONENT_CLASS_TYPE_SOURCE, \
.methods.source = { \
- .init_iterator = _init_iterator_method, \
+ .notif_iter_get = _notif_iter_get_method, \
+ .notif_iter_next = _notif_iter_next_method, \
}, \
}; \
static struct __bt_plugin_component_class_descriptor const * const __bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS = &__bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id; \
* _id: ID (any valid C identifier except `auto`).
* _comp_class_id: Component class ID (C identifier).
* _name: Component class name (C string).
- * _init_iterator_method: Component class's iterator initialization method
- * (bt_component_class_filter_init_iterator_method).
+ * _notif_iter_get_method: Component class's iterator get method
+ * (bt_component_class_notification_iterator_get_method).
+ * _notif_iter_next_method: Component class's iterator next method
+ * (bt_component_class_notification_iterator_next_method).
*/
-#define BT_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _init_iterator_method) \
+#define BT_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _notif_iter_get_method, _notif_iter_next_method) \
static struct __bt_plugin_component_class_descriptor __bt_plugin_filter_component_class_descriptor_##_id##_##_comp_class_id = { \
.plugin_descriptor = &__bt_plugin_descriptor_##_id, \
.name = _name, \
.type = BT_COMPONENT_CLASS_TYPE_FILTER, \
.methods.filter = { \
- .init_iterator = _init_iterator_method, \
+ .notif_iter_get = _notif_iter_get_method, \
+ .notif_iter_next = _notif_iter_next_method, \
}, \
}; \
static struct __bt_plugin_component_class_descriptor const * const __bt_plugin_filter_component_class_descriptor_##_id##_##_comp_class_id##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS = &__bt_plugin_filter_component_class_descriptor_##_id##_##_comp_class_id; \
#define BT_PLUGIN_SINK_COMPONENT_CLASS_ADD_ITERATOR_METHOD_WITH_ID(_id, _comp_class_id, _x) \
__BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(sink_add_iterator_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_SINK_ADD_ITERATOR_METHOD, _id, _comp_class_id, sink, _x)
+/*
+ * Defines an iterator initialization method attribute attached to a
+ * specific source component class descriptor.
+ *
+ * _id: Plugin descriptor ID (C identifier).
+ * _comp_class_id: Component class descriptor ID (C identifier).
+ * _x: Iterator initialization method
+ * (bt_component_class_notification_iterator_init_method).
+ */
+#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \
+ __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(notif_iter_init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_INIT_METHOD, _id, _comp_class_id, source, _x)
+
+/*
+ * Defines an iterator destroy method attribute attached to a specific
+ * source component class descriptor.
+ *
+ * _id: Plugin descriptor ID (C identifier).
+ * _comp_class_id: Component class descriptor ID (C identifier).
+ * _x: Iterator destroy method
+ * (bt_component_class_notification_iterator_destroy_method).
+ */
+#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD_WITH_ID(_id, _comp_class_id, _x) \
+ __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(notif_iter_destroy_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_DESTROY_METHOD, _id, _comp_class_id, source, _x)
+
+/*
+ * Defines an iterator seek time method attribute attached to a specific
+ * source component class descriptor.
+ *
+ * _id: Plugin descriptor ID (C identifier).
+ * _comp_class_id: Component class descriptor ID (C identifier).
+ * _x: Iterator seek time method
+ * (bt_component_class_notification_iterator_seek_time_method).
+ */
+#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD_WITH_ID(_id, _comp_class_id, _x) \
+ __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(notif_iter_seek_time_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_SEEK_TIME_METHOD, _id, _comp_class_id, source, _x)
+
+/*
+ * Defines an iterator initialization method attribute attached to a
+ * specific filter component class descriptor.
+ *
+ * _id: Plugin descriptor ID (C identifier).
+ * _comp_class_id: Component class descriptor ID (C identifier).
+ * _x: Iterator initialization method
+ * (bt_component_class_notification_iterator_init_method).
+ */
+#define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \
+ __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(notif_iter_init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_INIT_METHOD, _id, _comp_class_id, filter, _x)
+
+/*
+ * Defines an iterator destroy method attribute attached to a specific
+ * filter component class descriptor.
+ *
+ * _id: Plugin descriptor ID (C identifier).
+ * _comp_class_id: Component class descriptor ID (C identifier).
+ * _x: Iterator destroy method
+ * (bt_component_class_notification_iterator_destroy_method).
+ */
+#define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD_WITH_ID(_id, _comp_class_id, _x) \
+ __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(notif_iter_destroy_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_DESTROY_METHOD, _id, _comp_class_id, filter, _x)
+
+/*
+ * Defines an iterator seek time method attribute attached to a specific
+ * filter component class descriptor.
+ *
+ * _id: Plugin descriptor ID (C identifier).
+ * _comp_class_id: Component class descriptor ID (C identifier).
+ * _x: Iterator seek time method
+ * (bt_component_class_notification_iterator_seek_time_method).
+ */
+#define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD_WITH_ID(_id, _comp_class_id, _x) \
+ __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(notif_iter_seek_time_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_SEEK_TIME_METHOD, _id, _comp_class_id, filter, _x)
+
/*
* Defines a plugin descriptor with an automatic ID.
*
* descriptor. Its ID is the same as its name, hence its name must be a
* C identifier in this version.
*
- * _name: Component class name (C identifier).
- * _init_iterator_method: Component class's iterator initialization method
- * (bt_component_class_source_init_iterator_method).
+ * _name: Component class name (C identifier).
+ * _notif_iter_get_method: Component class's iterator get method
+ * (bt_component_class_notification_iterator_get_method).
+ * _notif_iter_next_method: Component class's iterator next method
+ * (bt_component_class_notification_iterator_next_method).
*/
-#define BT_PLUGIN_SOURCE_COMPONENT_CLASS(_name, _init_iterator_method) \
- BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _init_iterator_method)
+#define BT_PLUGIN_SOURCE_COMPONENT_CLASS(_name, _notif_iter_get_method, _notif_iter_next_method) \
+ BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _notif_iter_get_method, _notif_iter_next_method)
/*
* Defines a filter component class attached to the automatic plugin
* descriptor. Its ID is the same as its name, hence its name must be a
* C identifier in this version.
*
- * _name: Component class name (C identifier).
- * _init_iterator_method: Component class's iterator initialization method
- * (bt_component_class_filter_init_iterator_method).
+ * _name: Component class name (C identifier).
+ * _notif_iter_get_method: Component class's iterator get method
+ * (bt_component_class_notification_iterator_get_method).
+ * _notif_iter_next_method: Component class's iterator next method
+ * (bt_component_class_notification_iterator_next_method).
*/
-#define BT_PLUGIN_FILTER_COMPONENT_CLASS(_name, _init_iterator_method) \
- BT_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _init_iterator_method)
+#define BT_PLUGIN_FILTER_COMPONENT_CLASS(_name, _notif_iter_get_method, _notif_iter_next_method) \
+ BT_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _notif_iter_get_method, _notif_iter_next_method)
/*
* Defines a sink component class attached to the automatic plugin
#define BT_PLUGIN_SINK_COMPONENT_CLASS_ADD_ITERATOR_METHOD(_name, _x) \
BT_PLUGIN_SINK_COMPONENT_CLASS_ADD_ITERATOR_METHOD_WITH_ID(auto, _name, _x)
+/*
+ * Defines an iterator initialization method attribute attached to a
+ * source component class descriptor which is attached to the automatic
+ * plugin descriptor.
+ *
+ * _name: Component class name (C identifier).
+ * _x: Iterator initialization method
+ * (bt_component_class_notification_iterator_init_method).
+ */
+#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(_name, _x) \
+ BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD_WITH_ID(auto, _name, _x)
+
+/*
+ * Defines an iterator destroy method attribute attached to a source
+ * component class descriptor which is attached to the automatic plugin
+ * descriptor.
+ *
+ * _name: Component class name (C identifier).
+ * _x: Iterator destroy method
+ * (bt_component_class_notification_iterator_destroy_method).
+ */
+#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD(_name, _x) \
+ BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD_WITH_ID(auto, _name, _x)
+
+/*
+ * Defines an iterator seek time method attribute attached to a source
+ * component class descriptor which is attached to the automatic plugin
+ * descriptor.
+ *
+ * _name: Component class name (C identifier).
+ * _x: Iterator seek time method
+ * (bt_component_class_notification_iterator_seek_time_method).
+ */
+#define BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(_name, _x) \
+ BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD_WITH_ID(auto, _name, _x)
+
+/*
+ * Defines an iterator initialization method attribute attached to a
+ * filter component class descriptor which is attached to the automatic
+ * plugin descriptor.
+ *
+ * _name: Component class name (C identifier).
+ * _x: Iterator initialization method
+ * (bt_component_class_notification_iterator_init_method).
+ */
+#define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(_name, _x) \
+ BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD_WITH_ID(auto, _name, _x)
+
+/*
+ * Defines an iterator destroy method attribute attached to a filter
+ * component class descriptor which is attached to the automatic plugin
+ * descriptor.
+ *
+ * _name: Component class name (C identifier).
+ * _x: Iterator destroy method
+ * (bt_component_class_notification_iterator_destroy_method).
+ */
+#define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD(_name, _x) \
+ BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD_WITH_ID(auto, _name, _x)
+
+/*
+ * Defines an iterator seek time method attribute attached to a filter
+ * component class descriptor which is attached to the automatic plugin
+ * descriptor.
+ *
+ * _name: Component class name (C identifier).
+ * _x: Iterator seek time method
+ * (bt_component_class_notification_iterator_seek_time_method).
+ */
+#define BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(_name, _x) \
+ BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD_WITH_ID(auto, _name, _x)
+
#ifdef __cplusplus
}
#endif
}
struct bt_component_class *bt_component_class_source_create(const char *name,
- bt_component_class_source_init_iterator_method init_iterator_method)
+ bt_component_class_notification_iterator_get_method notification_iterator_get_method,
+ bt_component_class_notification_iterator_next_method notification_iterator_next_method)
{
struct bt_component_class_source *source_class = NULL;
int ret;
- if (!name || !init_iterator_method) {
+ if (!name || !notification_iterator_get_method ||
+ !notification_iterator_next_method) {
goto end;
}
goto end;
}
- source_class->methods.init_iterator = init_iterator_method;
+ source_class->methods.iterator.get = notification_iterator_get_method;
+ source_class->methods.iterator.next = notification_iterator_next_method;
end:
return &source_class->parent;
}
struct bt_component_class *bt_component_class_filter_create(const char *name,
- bt_component_class_filter_init_iterator_method init_iterator_method)
+ bt_component_class_notification_iterator_get_method notification_iterator_get_method,
+ bt_component_class_notification_iterator_next_method notification_iterator_next_method)
{
struct bt_component_class_filter *filter_class = NULL;
int ret;
- if (!name || !init_iterator_method) {
+ if (!name || !notification_iterator_get_method ||
+ !notification_iterator_next_method) {
goto end;
}
goto end;
}
- filter_class->methods.init_iterator = init_iterator_method;
+ filter_class->methods.iterator.get = notification_iterator_get_method;
+ filter_class->methods.iterator.next = notification_iterator_next_method;
end:
return &filter_class->parent;
return ret;
}
-extern int bt_component_class_set_description(
+int bt_component_class_source_set_notification_iterator_init_method(
+ struct bt_component_class *component_class,
+ bt_component_class_notification_iterator_init_method notification_iterator_init_method)
+{
+ struct bt_component_class_source *source_class;
+ int ret = 0;
+
+ if (!component_class || component_class->frozen ||
+ !notification_iterator_init_method ||
+ component_class->type != BT_COMPONENT_CLASS_TYPE_SOURCE) {
+ ret = -1;
+ goto end;
+ }
+
+ source_class = container_of(component_class,
+ struct bt_component_class_source, parent);
+ source_class->methods.iterator.init = notification_iterator_init_method;
+
+end:
+ return ret;
+}
+
+int bt_component_class_source_set_notification_iterator_destroy_method(
+ struct bt_component_class *component_class,
+ bt_component_class_notification_iterator_destroy_method notification_iterator_destroy_method)
+{
+ struct bt_component_class_source *source_class;
+ int ret = 0;
+
+ if (!component_class || component_class->frozen ||
+ !notification_iterator_destroy_method ||
+ component_class->type != BT_COMPONENT_CLASS_TYPE_SOURCE) {
+ ret = -1;
+ goto end;
+ }
+
+ source_class = container_of(component_class,
+ struct bt_component_class_source, parent);
+ source_class->methods.iterator.destroy =
+ notification_iterator_destroy_method;
+
+end:
+ return ret;
+}
+
+int bt_component_class_source_set_notification_iterator_seek_time_method(
+ struct bt_component_class *component_class,
+ bt_component_class_notification_iterator_seek_time_method notification_iterator_seek_time_method)
+{
+ struct bt_component_class_source *source_class;
+ int ret = 0;
+
+ if (!component_class || component_class->frozen ||
+ !notification_iterator_seek_time_method ||
+ component_class->type != BT_COMPONENT_CLASS_TYPE_SOURCE) {
+ ret = -1;
+ goto end;
+ }
+
+ source_class = container_of(component_class,
+ struct bt_component_class_source, parent);
+ source_class->methods.iterator.seek_time =
+ notification_iterator_seek_time_method;
+
+end:
+ return ret;
+}
+
+int bt_component_class_filter_set_notification_iterator_init_method(
+ struct bt_component_class *component_class,
+ bt_component_class_notification_iterator_init_method notification_iterator_init_method)
+{
+ struct bt_component_class_filter *filter_class;
+ int ret = 0;
+
+ if (!component_class || component_class->frozen ||
+ !notification_iterator_init_method ||
+ component_class->type != BT_COMPONENT_CLASS_TYPE_FILTER) {
+ ret = -1;
+ goto end;
+ }
+
+ filter_class = container_of(component_class,
+ struct bt_component_class_filter, parent);
+ filter_class->methods.iterator.init = notification_iterator_init_method;
+
+end:
+ return ret;
+}
+
+int bt_component_class_filter_set_notification_iterator_destroy_method(
+ struct bt_component_class *component_class,
+ bt_component_class_notification_iterator_destroy_method notification_iterator_destroy_method)
+{
+ struct bt_component_class_filter *filter_class;
+ int ret = 0;
+
+ if (!component_class || component_class->frozen ||
+ !notification_iterator_destroy_method ||
+ component_class->type != BT_COMPONENT_CLASS_TYPE_FILTER) {
+ ret = -1;
+ goto end;
+ }
+
+ filter_class = container_of(component_class,
+ struct bt_component_class_filter, parent);
+ filter_class->methods.iterator.destroy =
+ notification_iterator_destroy_method;
+
+end:
+ return ret;
+}
+
+int bt_component_class_filter_set_notification_iterator_seek_time_method(
+ struct bt_component_class *component_class,
+ bt_component_class_notification_iterator_seek_time_method notification_iterator_seek_time_method)
+{
+ struct bt_component_class_filter *filter_class;
+ int ret = 0;
+
+ if (!component_class || component_class->frozen ||
+ !notification_iterator_seek_time_method ||
+ component_class->type != BT_COMPONENT_CLASS_TYPE_FILTER) {
+ ret = -1;
+ goto end;
+ }
+
+ filter_class = container_of(component_class,
+ struct bt_component_class_filter, parent);
+ filter_class->methods.iterator.seek_time =
+ notification_iterator_seek_time_method;
+
+end:
+ return ret;
+}
+
+int bt_component_class_set_description(
struct bt_component_class *component_class,
const char *description)
{
case BT_COMPONENT_CLASS_TYPE_SOURCE:
{
struct bt_component_class_source *source_class;
- enum bt_component_status ret_component;
+ enum bt_notification_iterator_status status;
source_class = container_of(class, struct bt_component_class_source, parent);
- assert(source_class->methods.init_iterator);
- ret_component =
- source_class->methods.init_iterator(component, iterator);
- if (ret_component != BT_COMPONENT_STATUS_OK) {
+ assert(source_class->methods.iterator.init);
+ status = source_class->methods.iterator.init(component,
+ iterator);
+ if (status < 0) {
goto error;
}
break;
-
- break;
}
case BT_COMPONENT_CLASS_TYPE_FILTER:
{
struct bt_component_class_filter *filter_class;
- enum bt_component_status ret_component;
+ enum bt_notification_iterator_status status;
filter_class = container_of(class, struct bt_component_class_filter, parent);
- assert(filter_class->methods.init_iterator);
- ret_component =
- filter_class->methods.init_iterator(component, iterator);
- if (ret_component != BT_COMPONENT_STATUS_OK) {
+ assert(filter_class->methods.iterator.init);
+ status = filter_class->methods.iterator.init(component,
+ iterator);
+ if (status < 0) {
goto error;
}
break;
#include <babeltrace/ref.h>
#include <babeltrace/component/component.h>
#include <babeltrace/component/component-source-internal.h>
+#include <babeltrace/component/component-class-internal.h>
#include <babeltrace/component/notification/iterator.h>
#include <babeltrace/component/notification/iterator-internal.h>
void bt_notification_iterator_destroy(struct bt_object *obj)
{
struct bt_notification_iterator *iterator;
+ struct bt_component_class *comp_class;
assert(obj);
iterator = container_of(obj, struct bt_notification_iterator,
base);
- assert(iterator->user_destroy || !iterator->user_data);
- if (iterator->user_destroy) {
- iterator->user_destroy(iterator);
+ assert(iterator->component);
+ comp_class = iterator->component->class;
+
+ /* Call user-defined destroy method */
+ switch (comp_class->type) {
+ case BT_COMPONENT_CLASS_TYPE_SOURCE:
+ {
+ struct bt_component_class_source *source_class;
+
+ source_class = container_of(comp_class, struct bt_component_class_source, parent);
+
+ if (source_class->methods.iterator.destroy) {
+ source_class->methods.iterator.destroy(iterator);
+ }
+ break;
}
+ case BT_COMPONENT_CLASS_TYPE_FILTER:
+ {
+ struct bt_component_class_filter *filter_class;
+
+ filter_class = container_of(comp_class, struct bt_component_class_filter, parent);
+
+ if (filter_class->methods.iterator.destroy) {
+ filter_class->methods.iterator.destroy(iterator);
+ }
+ break;
+ }
+ default:
+ /* Unreachable */
+ assert(0);
+ }
+
BT_PUT(iterator->component);
g_free(iterator);
}
enum bt_notification_iterator_status ret =
BT_NOTIFICATION_ITERATOR_STATUS_OK;
- if (!iterator || !iterator->get || !iterator->next) {
- ret = BT_NOTIFICATION_ITERATOR_STATUS_INVAL;
- goto end;
- }
-end:
- return ret;
-}
-
-enum bt_notification_iterator_status bt_notification_iterator_set_get_cb(
- struct bt_notification_iterator *iterator,
- bt_notification_iterator_get_cb get)
-{
- enum bt_notification_iterator_status ret =
- BT_NOTIFICATION_ITERATOR_STATUS_OK;
-
- if (!iterator || !get) {
- ret = BT_NOTIFICATION_ITERATOR_STATUS_INVAL;
- goto end;
- }
-
- iterator->get = get;
-end:
- return ret;
-}
-
-enum bt_notification_iterator_status
-bt_notification_iterator_set_next_cb(struct bt_notification_iterator *iterator,
- bt_notification_iterator_next_cb next)
-{
- enum bt_notification_iterator_status ret =
- BT_NOTIFICATION_ITERATOR_STATUS_OK;
-
- if (!iterator || !next) {
- ret = BT_NOTIFICATION_ITERATOR_STATUS_INVAL;
- goto end;
- }
-
- iterator->next = next;
-end:
- return ret;
-}
-
-enum bt_notification_iterator_status
-bt_notification_iterator_set_seek_time_cb(
- struct bt_notification_iterator *iterator,
- bt_notification_iterator_seek_time_cb seek_time)
-{
- enum bt_notification_iterator_status ret =
- BT_NOTIFICATION_ITERATOR_STATUS_OK;
-
- if (!iterator || !seek_time) {
- ret = BT_NOTIFICATION_ITERATOR_STATUS_INVAL;
- goto end;
- }
-
- iterator->seek_time = seek_time;
-end:
- return ret;
-}
-
-enum bt_notification_iterator_status
-bt_notification_iterator_set_destroy_cb(
- struct bt_notification_iterator *iterator,
- bt_notification_iterator_destroy_cb destroy)
-{
- enum bt_notification_iterator_status ret =
- BT_NOTIFICATION_ITERATOR_STATUS_OK;
-
- if (!iterator || !destroy) {
+ if (!iterator) {
ret = BT_NOTIFICATION_ITERATOR_STATUS_INVAL;
goto end;
}
-
- iterator->user_destroy = destroy;
end:
return ret;
}
enum bt_notification_iterator_status ret =
BT_NOTIFICATION_ITERATOR_STATUS_OK;
- if (!iterator || !data) {
+ if (!iterator) {
ret = BT_NOTIFICATION_ITERATOR_STATUS_INVAL;
goto end;
}
struct bt_notification *bt_notification_iterator_get_notification(
struct bt_notification_iterator *iterator)
{
+ bt_component_class_notification_iterator_get_method get_method = NULL;
+
assert(iterator);
- assert(iterator->get);
- return iterator->get(iterator);
+ assert(iterator->component);
+ assert(iterator->component->class);
+
+ switch (iterator->component->class->type) {
+ case BT_COMPONENT_CLASS_TYPE_SOURCE:
+ {
+ struct bt_component_class_source *source_class =
+ container_of(iterator->component->class,
+ struct bt_component_class_source, parent);
+
+ assert(source_class->methods.iterator.get);
+ get_method = source_class->methods.iterator.get;
+ break;
+ }
+ case BT_COMPONENT_CLASS_TYPE_FILTER:
+ {
+ struct bt_component_class_filter *filter_class =
+ container_of(iterator->component->class,
+ struct bt_component_class_filter, parent);
+
+ assert(filter_class->methods.iterator.get);
+ get_method = filter_class->methods.iterator.get;
+ break;
+ }
+ default:
+ assert(false);
+ break;
+ }
+
+ assert(get_method);
+ return get_method(iterator);
}
enum bt_notification_iterator_status
bt_notification_iterator_next(struct bt_notification_iterator *iterator)
{
+ bt_component_class_notification_iterator_next_method next_method = NULL;
+
assert(iterator);
- assert(iterator->next);
- return iterator->next(iterator);
+ assert(iterator->component);
+ assert(iterator->component->class);
+
+ switch (iterator->component->class->type) {
+ case BT_COMPONENT_CLASS_TYPE_SOURCE:
+ {
+ struct bt_component_class_source *source_class =
+ container_of(iterator->component->class,
+ struct bt_component_class_source, parent);
+
+ assert(source_class->methods.iterator.next);
+ next_method = source_class->methods.iterator.next;
+ break;
+ }
+ case BT_COMPONENT_CLASS_TYPE_FILTER:
+ {
+ struct bt_component_class_filter *filter_class =
+ container_of(iterator->component->class,
+ struct bt_component_class_filter, parent);
+
+ assert(filter_class->methods.iterator.next);
+ next_method = filter_class->methods.iterator.next;
+ break;
+ }
+ default:
+ assert(false);
+ break;
+ }
+
+ assert(next_method);
+ return next_method(iterator);
}
struct bt_component *bt_notification_iterator_get_component(
bt_component_class_destroy_method destroy_method;
bt_component_class_filter_add_iterator_method filter_add_iterator_method;
bt_component_class_sink_add_iterator_method sink_add_iterator_method;
+ struct bt_component_class_iterator_methods iterator_methods;
};
enum bt_plugin_status status = BT_PLUGIN_STATUS_OK;
cc_full_descr->sink_add_iterator_method =
cur_cc_descr_attr->value.sink_add_iterator_method;
break;
+ case BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_INIT_METHOD:
+ cc_full_descr->iterator_methods.init =
+ cur_cc_descr_attr->value.notif_iter_init_method;
+ break;
+ case BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_DESTROY_METHOD:
+ cc_full_descr->iterator_methods.destroy =
+ cur_cc_descr_attr->value.notif_iter_destroy_method;
+ break;
+ case BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_NOTIF_ITER_SEEK_TIME_METHOD:
+ cc_full_descr->iterator_methods.seek_time =
+ cur_cc_descr_attr->value.notif_iter_seek_time_method;
+ break;
default:
printf_verbose("WARNING: Unknown attribute \"%s\" (type %d) for component class %s (type %d) in plugin %s\n",
cur_cc_descr_attr->type_name,
case BT_COMPONENT_CLASS_TYPE_SOURCE:
comp_class = bt_component_class_source_create(
cc_full_descr->descriptor->name,
- cc_full_descr->descriptor->methods.source.init_iterator);
+ cc_full_descr->descriptor->methods.source.notif_iter_get,
+ cc_full_descr->descriptor->methods.source.notif_iter_next);
break;
case BT_COMPONENT_CLASS_TYPE_FILTER:
comp_class = bt_component_class_filter_create(
cc_full_descr->descriptor->name,
- cc_full_descr->descriptor->methods.filter.init_iterator);
+ cc_full_descr->descriptor->methods.source.notif_iter_get,
+ cc_full_descr->descriptor->methods.source.notif_iter_next);
break;
case BT_COMPONENT_CLASS_TYPE_SINK:
comp_class = bt_component_class_sink_create(
}
}
- if (cc_full_descr->descriptor->type ==
- BT_COMPONENT_CLASS_TYPE_FILTER &&
- cc_full_descr->filter_add_iterator_method) {
- ret = bt_component_class_filter_set_add_iterator_method(comp_class,
- cc_full_descr->filter_add_iterator_method);
- if (ret) {
- status = BT_PLUGIN_STATUS_ERROR;
- BT_PUT(comp_class);
- goto end;
+ switch (cc_full_descr->descriptor->type) {
+ case BT_COMPONENT_CLASS_TYPE_SOURCE:
+ if (cc_full_descr->iterator_methods.init) {
+ ret = bt_component_class_source_set_notification_iterator_init_method(
+ comp_class,
+ cc_full_descr->iterator_methods.init);
+ if (ret) {
+ status = BT_PLUGIN_STATUS_ERROR;
+ BT_PUT(comp_class);
+ goto end;
+ }
}
- }
- if (cc_full_descr->descriptor->type ==
- BT_COMPONENT_CLASS_TYPE_SINK &&
- cc_full_descr->sink_add_iterator_method) {
- ret = bt_component_class_sink_set_add_iterator_method(comp_class,
- cc_full_descr->sink_add_iterator_method);
- if (ret) {
- status = BT_PLUGIN_STATUS_ERROR;
- BT_PUT(comp_class);
- goto end;
+ if (cc_full_descr->iterator_methods.destroy) {
+ ret = bt_component_class_source_set_notification_iterator_destroy_method(
+ comp_class,
+ cc_full_descr->iterator_methods.destroy);
+ if (ret) {
+ status = BT_PLUGIN_STATUS_ERROR;
+ BT_PUT(comp_class);
+ goto end;
+ }
}
+
+ if (cc_full_descr->iterator_methods.seek_time) {
+ ret = bt_component_class_source_set_notification_iterator_seek_time_method(
+ comp_class,
+ cc_full_descr->iterator_methods.seek_time);
+ if (ret) {
+ status = BT_PLUGIN_STATUS_ERROR;
+ BT_PUT(comp_class);
+ goto end;
+ }
+ }
+ break;
+ case BT_COMPONENT_CLASS_TYPE_FILTER:
+ if (cc_full_descr->filter_add_iterator_method) {
+ ret = bt_component_class_filter_set_add_iterator_method(
+ comp_class,
+ cc_full_descr->filter_add_iterator_method);
+ if (ret) {
+ status = BT_PLUGIN_STATUS_ERROR;
+ BT_PUT(comp_class);
+ goto end;
+ }
+ }
+
+ if (cc_full_descr->iterator_methods.init) {
+ ret = bt_component_class_filter_set_notification_iterator_init_method(
+ comp_class,
+ cc_full_descr->iterator_methods.init);
+ if (ret) {
+ status = BT_PLUGIN_STATUS_ERROR;
+ BT_PUT(comp_class);
+ goto end;
+ }
+ }
+
+ if (cc_full_descr->iterator_methods.destroy) {
+ ret = bt_component_class_filter_set_notification_iterator_destroy_method(
+ comp_class,
+ cc_full_descr->iterator_methods.destroy);
+ if (ret) {
+ status = BT_PLUGIN_STATUS_ERROR;
+ BT_PUT(comp_class);
+ goto end;
+ }
+ }
+
+ if (cc_full_descr->iterator_methods.seek_time) {
+ ret = bt_component_class_filter_set_notification_iterator_seek_time_method(
+ comp_class,
+ cc_full_descr->iterator_methods.seek_time);
+ if (ret) {
+ status = BT_PLUGIN_STATUS_ERROR;
+ BT_PUT(comp_class);
+ goto end;
+ }
+ }
+ break;
+ case BT_COMPONENT_CLASS_TYPE_SINK:
+ if (cc_full_descr->sink_add_iterator_method) {
+ ret = bt_component_class_sink_set_add_iterator_method(
+ comp_class,
+ cc_full_descr->sink_add_iterator_method);
+ if (ret) {
+ status = BT_PLUGIN_STATUS_ERROR;
+ BT_PUT(comp_class);
+ goto end;
+ }
+ }
+ break;
+ default:
+ assert(false);
+ break;
}
/* Add component class to the plugin object */
BT_HIDDEN
bool ctf_fs_debug;
-static
enum bt_notification_iterator_status ctf_fs_iterator_next(
struct bt_notification_iterator *iterator);
-static
struct bt_notification *ctf_fs_iterator_get(
struct bt_notification_iterator *iterator)
{
return ret;
}
-static
enum bt_notification_iterator_status ctf_fs_iterator_next(
struct bt_notification_iterator *iterator)
{
g_free(ctf_it);
}
-static
void ctf_fs_iterator_destroy(struct bt_notification_iterator *it)
{
void *data = bt_notification_iterator_get_private_data(it);
return ret;
}
-enum bt_component_status ctf_fs_iterator_init(struct bt_component *source,
+enum bt_notification_iterator_status ctf_fs_iterator_init(struct bt_component *source,
struct bt_notification_iterator *it)
{
struct ctf_fs_iterator *ctf_it;
struct ctf_fs_component *ctf_fs;
- enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
+ enum bt_notification_iterator_status ret = BT_NOTIFICATION_ITERATOR_STATUS_OK;
assert(source && it);
ctf_fs = bt_component_get_private_data(source);
if (!ctf_fs) {
- ret = BT_COMPONENT_STATUS_INVALID;
+ ret = BT_NOTIFICATION_ITERATOR_STATUS_INVAL;
goto end;
}
ctf_it = g_new0(struct ctf_fs_iterator, 1);
if (!ctf_it) {
- ret = BT_COMPONENT_STATUS_NOMEM;
+ ret = BT_NOTIFICATION_ITERATOR_STATUS_NOMEM;
goto end;
}
goto error;
}
- ret = bt_notification_iterator_set_get_cb(it, ctf_fs_iterator_get);
- if (ret) {
- goto error;
- }
-
- ret = bt_notification_iterator_set_next_cb(it, ctf_fs_iterator_next);
- if (ret) {
- goto error;
- }
-
- ret = bt_notification_iterator_set_destroy_cb(it,
- ctf_fs_iterator_destroy);
- if (ret) {
- goto error;
- }
-
ret = bt_notification_iterator_set_private_data(it, ctf_it);
if (ret) {
goto error;
void ctf_fs_destroy(struct bt_component *component);
BT_HIDDEN
-enum bt_component_status ctf_fs_iterator_init(struct bt_component *source,
+enum bt_notification_iterator_status ctf_fs_iterator_init(
+ struct bt_component *source,
struct bt_notification_iterator *it);
+void ctf_fs_iterator_destroy(struct bt_notification_iterator *it);
+
+enum bt_notification_iterator_status ctf_fs_iterator_next(
+ struct bt_notification_iterator *iterator);
+
+struct bt_notification *ctf_fs_iterator_get(
+ struct bt_notification_iterator *iterator);
+
#endif /* BABELTRACE_PLUGIN_CTF_FS_H */
#define LTTNG_LIVE_COMPONENT_DESCRIPTION "Component implementing an LTTng-live client."
-BT_HIDDEN
-enum bt_component_status lttng_live_iterator_init(struct bt_component *source,
- struct bt_notification_iterator *it);
-
BT_HIDDEN
enum bt_component_status lttng_live_init(struct bt_component *source,
struct bt_value *params, void *init_method_data);
+BT_HIDDEN
+struct bt_notification *lttng_live_iterator_get(
+ struct bt_notification_iterator *iterator);
+
+BT_HIDDEN
+enum bt_notification_iterator_status lttng_live_iterator_next(
+ struct bt_notification_iterator *iterator);
+
#endif /* BABELTRACE_PLUGIN_CTF_LTTNG_LIVE_INTERNAL_H */
#include <plugins-common.h>
BT_HIDDEN
-enum bt_component_status lttng_live_iterator_init(struct bt_component *source,
- struct bt_notification_iterator *it)
+struct bt_notification *lttng_live_iterator_get(
+ struct bt_notification_iterator *iterator)
{
- return BT_COMPONENT_STATUS_OK;
+ return NULL;
+}
+
+BT_HIDDEN
+enum bt_notification_iterator_status lttng_live_iterator_next(
+ struct bt_notification_iterator *iterator)
+{
+ return BT_NOTIFICATION_ITERATOR_STATUS_OK;
}
BT_HIDDEN
BT_PLUGIN_LICENSE("MIT");
/* Declare component classes implemented by this plug-in. */
-BT_PLUGIN_SOURCE_COMPONENT_CLASS(fs, ctf_fs_iterator_init);
+BT_PLUGIN_SOURCE_COMPONENT_CLASS(fs, ctf_fs_iterator_get, ctf_fs_iterator_next);
+BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION(fs, CTF_FS_COMPONENT_DESCRIPTION);
BT_PLUGIN_SOURCE_COMPONENT_CLASS_INIT_METHOD(fs, ctf_fs_init);
BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESTROY_METHOD(fs, ctf_fs_destroy);
-BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION(fs, CTF_FS_COMPONENT_DESCRIPTION);
+BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(fs,
+ ctf_fs_iterator_init);
+BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD(fs,
+ ctf_fs_iterator_destroy);
BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(auto, lttng_live, "lttng-live",
- lttng_live_iterator_init);
+ lttng_live_iterator_get, lttng_live_iterator_next);
BT_PLUGIN_SOURCE_COMPONENT_CLASS_INIT_METHOD_WITH_ID(auto, lttng_live,
lttng_live_init);
BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION_WITH_ID(auto, lttng_live,
return ret;
}
-enum bt_component_status muxer_init_iterator(
- struct bt_component *component,
- struct bt_notification_iterator *iter)
+static
+struct bt_notification *muxer_iterator_get(
+ struct bt_notification_iterator *iterator)
+{
+ return NULL;
+}
+
+static
+enum bt_notification_iterator_status muxer_iterator_next(
+ struct bt_notification_iterator *iterator)
{
- return BT_COMPONENT_STATUS_OK;
+ return BT_NOTIFICATION_ITERATOR_STATUS_OK;
}
/* Initialize plug-in entry points. */
BT_PLUGIN_DESCRIPTION("Babeltrace Trace Muxer Plug-In.");
BT_PLUGIN_AUTHOR("Jérémie Galarneau");
BT_PLUGIN_LICENSE("MIT");
-BT_PLUGIN_FILTER_COMPONENT_CLASS(muxer, muxer_init_iterator);
+BT_PLUGIN_FILTER_COMPONENT_CLASS(muxer, muxer_iterator_get,
+ muxer_iterator_next);
BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION(muxer,
"Time-correlate multiple traces.");
BT_PLUGIN_FILTER_COMPONENT_CLASS_INIT_METHOD(muxer, muxer_component_init);
#include <babeltrace/ctf-ir/fields.h>
#include <assert.h>
-static
+BT_HIDDEN
void trimmer_iterator_destroy(struct bt_notification_iterator *it)
{
struct trimmer_iterator *it_data;
}
BT_HIDDEN
-enum bt_component_status trimmer_iterator_init(struct bt_component *component,
+enum bt_notification_iterator_status trimmer_iterator_init(
+ struct bt_component *component,
struct bt_notification_iterator *iterator)
{
- enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
+ enum bt_notification_iterator_status ret =
+ BT_NOTIFICATION_ITERATOR_STATUS_OK;
enum bt_notification_iterator_status it_ret;
struct trimmer_iterator *it_data = g_new0(struct trimmer_iterator, 1);
if (!it_data) {
- ret = BT_COMPONENT_STATUS_NOMEM;
+ ret = BT_NOTIFICATION_ITERATOR_STATUS_NOMEM;
goto end;
}
if (it_ret) {
goto end;
}
-
- it_ret = bt_notification_iterator_set_destroy_cb(iterator,
- trimmer_iterator_destroy);
- if (it_ret) {
- ret = BT_COMPONENT_STATUS_ERROR;
- goto end;
- }
-
- it_ret = bt_notification_iterator_set_next_cb(iterator,
- trimmer_iterator_next);
- if (it_ret) {
- ret = BT_COMPONENT_STATUS_ERROR;
- goto end;
- }
-
- it_ret = bt_notification_iterator_set_get_cb(iterator,
- trimmer_iterator_get);
- if (it_ret) {
- ret = BT_COMPONENT_STATUS_ERROR;
- goto end;
- }
-
- it_ret = bt_notification_iterator_set_seek_time_cb(iterator,
- trimmer_iterator_seek_time);
- if (it_ret) {
- ret = BT_COMPONENT_STATUS_ERROR;
- goto end;
- }
end:
return ret;
}
};
BT_HIDDEN
-enum bt_component_status trimmer_iterator_init(
+enum bt_notification_iterator_status trimmer_iterator_init(
struct bt_component *component,
struct bt_notification_iterator *iterator);
+BT_HIDDEN
+void trimmer_iterator_destroy(struct bt_notification_iterator *it);
+
BT_HIDDEN
struct bt_notification *trimmer_iterator_get(
struct bt_notification_iterator *iterator);
BT_PLUGIN_DESCRIPTION("Babeltrace Trace Trimmer Plug-In.");
BT_PLUGIN_AUTHOR("Jérémie Galarneau");
BT_PLUGIN_LICENSE("MIT");
-BT_PLUGIN_FILTER_COMPONENT_CLASS(trimmer, trimmer_iterator_init);
+BT_PLUGIN_FILTER_COMPONENT_CLASS(trimmer, trimmer_iterator_get,
+ trimmer_iterator_next);
BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION(trimmer,
"Ensure that trace notifications outside of a given range are filtered-out.");
BT_PLUGIN_FILTER_COMPONENT_CLASS_INIT_METHOD(trimmer, trimmer_component_init);
BT_PLUGIN_FILTER_COMPONENT_CLASS_DESTROY_METHOD(trimmer, destroy_trimmer);
+BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(trimmer,
+ trimmer_iterator_init);
+BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD(trimmer,
+ trimmer_iterator_destroy);
+BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(trimmer,
+ trimmer_iterator_seek_time);
return BT_COMPONENT_STATUS_OK;
}
-enum bt_component_status dummy_init_iterator_method(
- struct bt_component *component, struct bt_notification_iterator *iter)
+static enum bt_notification_iterator_status dummy_iterator_init_method(
+ struct bt_component *component,
+ struct bt_notification_iterator *iterator)
{
- return BT_COMPONENT_STATUS_OK;
+ return BT_NOTIFICATION_ITERATOR_STATUS_OK;
+}
+
+static void dummy_iterator_destroy_method(
+ struct bt_notification_iterator *iterator)
+{
+}
+
+static struct bt_notification *dummy_iterator_get_method(
+ struct bt_notification_iterator *iterator)
+{
+ return NULL;
+}
+
+static enum bt_notification_iterator_status dummy_iterator_next_method(
+ struct bt_notification_iterator *iterator)
+{
+ return BT_NOTIFICATION_ITERATOR_STATUS_OK;
+}
+
+static enum bt_notification_iterator_status dummy_iterator_seek_time_method(
+ struct bt_notification_iterator *iterator, int64_t time)
+{
+ return BT_NOTIFICATION_ITERATOR_STATUS_OK;
}
BT_PLUGIN(test_sfs);
BT_PLUGIN_LICENSE("Beerware");
BT_PLUGIN_VERSION(1, 2, 3, "yes");
-BT_PLUGIN_SOURCE_COMPONENT_CLASS(source, dummy_init_iterator_method);
+BT_PLUGIN_SOURCE_COMPONENT_CLASS(source, dummy_iterator_get_method,
+ dummy_iterator_next_method);
BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION(source, "A source.");
+BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(source,
+ dummy_iterator_init_method);
+BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD(source,
+ dummy_iterator_destroy_method);
+BT_PLUGIN_SOURCE_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(source,
+ dummy_iterator_seek_time_method);
BT_PLUGIN_SINK_COMPONENT_CLASS(sink, sink_consume);
BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION(sink, "A sink.");
-BT_PLUGIN_FILTER_COMPONENT_CLASS(filter, dummy_init_iterator_method);
+BT_PLUGIN_FILTER_COMPONENT_CLASS(filter, dummy_iterator_get_method,
+ dummy_iterator_next_method);
BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION(filter, "A filter.");
+BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_INIT_METHOD(filter,
+ dummy_iterator_init_method);
+BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_DESTROY_METHOD(filter,
+ dummy_iterator_destroy_method);
+BT_PLUGIN_FILTER_COMPONENT_CLASS_NOTIFICATION_ITERATOR_SEEK_TIME_METHOD(filter,
+ dummy_iterator_seek_time_method);