babeltrace/component/notification/packet.h \
babeltrace/component/notification/schema.h \
babeltrace/component/notification/stream.h \
- babeltrace/component/notification/heap.h
+ babeltrace/component/notification/heap.h \
+ babeltrace/component/notification/private-iterator.h
babeltracecomponentinclude_HEADERS = \
babeltrace/component/component.h \
babeltrace/component/graph.h \
babeltrace/component/component-source.h \
babeltrace/component/component-sink.h \
- babeltrace/component/component-filter.h
+ babeltrace/component/component-filter.h \
+ babeltrace/component/private-connection.h \
+ babeltrace/component/private-port.h \
+ babeltrace/component/private-component.h \
+ babeltrace/component/private-component-source.h \
+ babeltrace/component/private-component-sink.h \
+ babeltrace/component/private-component-filter.h
noinst_HEADERS = \
babeltrace/align.h \
* SOFTWARE.
*/
-#include <babeltrace/component/component.h>
+#include <babeltrace/component/private-component.h>
#ifdef __cplusplus
extern "C" {
struct bt_component_class;
typedef enum bt_component_status (*bt_component_class_sink_consume_method)(
- struct bt_component *);
+ struct bt_private_component *private_component);
extern
struct bt_component_class *bt_component_class_sink_create(const char *name,
struct bt_component_class;
struct bt_component;
-struct bt_port;
-struct bt_connection;
+struct bt_private_component;
+struct bt_private_port;
struct bt_value;
-struct bt_notification_iterator;
+struct bt_private_notification_iterator;
/**
* Component class type.
};
typedef enum bt_component_status (*bt_component_class_init_method)(
- struct bt_component *component, struct bt_value *params,
- void *init_method_data);
+ struct bt_private_component *private_component,
+ struct bt_value *params, void *init_method_data);
-typedef void (*bt_component_class_destroy_method)(struct bt_component *component);
+typedef void (*bt_component_class_destroy_method)(
+ struct bt_private_component *private_component);
typedef enum bt_notification_iterator_status
(*bt_component_class_notification_iterator_init_method)(
- struct bt_component *component,
- struct bt_notification_iterator *iterator, void *init_method_data);
+ struct bt_private_component *private_component,
+ struct bt_private_port *private_port,
+ struct bt_private_notification_iterator *private_notification_iterator);
typedef void (*bt_component_class_notification_iterator_destroy_method)(
- struct bt_notification_iterator *iterator);
+ struct bt_private_notification_iterator *private_notification_iterator);
typedef struct bt_notification *(*bt_component_class_notification_iterator_get_method)(
- struct bt_notification_iterator *iterator);
+ struct bt_private_notification_iterator *private_notification_iterator);
typedef enum bt_notification_iterator_status (*bt_component_class_notification_iterator_next_method)(
- struct bt_notification_iterator *iterator);
+ struct bt_private_notification_iterator *private_notification_iterator);
typedef enum bt_notification_iterator_status
(*bt_component_class_notification_iterator_seek_time_method)(
- struct bt_notification_iterator *iterator, int64_t time);
+ 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_component *component, struct bt_port *port);
+ struct bt_private_component *private_component,
+ struct bt_private_port *private_port);
typedef void (*bt_component_class_port_disconnected_method)(
- struct bt_component *component, struct bt_port *port);
+ 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,
enum bt_component_status bt_component_filter_validate(
struct bt_component *component);
-/**
- * Create an iterator on a component instance.
- *
- * @param component Component instance
- * @returns Notification iterator instance
- */
-BT_HIDDEN
-struct bt_notification_iterator *bt_component_filter_create_notification_iterator(
- struct bt_component *component);
-
-BT_HIDDEN
-struct bt_notification_iterator *bt_component_filter_create_notification_iterator_with_init_method_data(
- struct bt_component *component, void *init_method_data);
-
#endif /* BABELTRACE_COMPONENT_FILTER_INTERNAL_H */
struct bt_port;
struct bt_component;
-struct bt_notification_iterator;
extern enum bt_component_status bt_component_filter_get_input_port_count(
struct bt_component *component, uint64_t *count);
* Internal destroy function specific to a source, filter, or
* sink component object.
*/
- bt_component_class_destroy_method destroy;
+ void (*destroy)(struct bt_component *);
/* User-defined data */
void *user_data;
GPtrArray *output_ports;
};
-BT_HIDDEN
-struct bt_notification_iterator *bt_component_create_iterator(
- struct bt_component *component, void *init_method_data);
+static inline
+struct bt_component *bt_component_from_private(
+ struct bt_private_component *private_component)
+{
+ return (void *) private_component;
+}
+
+static inline
+struct bt_private_component *bt_private_component_from_component(
+ struct bt_component *component)
+{
+ return (void *) component;
+}
BT_HIDDEN
enum bt_component_status bt_component_accept_port_connection(
struct bt_component *component, const char *name);
extern struct bt_port *bt_component_sink_get_input_port_at_index(
struct bt_component *component, int index);
-
-/* Only allowed during the sink's initialization. */
-extern struct bt_port *bt_component_sink_add_input_port(
- struct bt_component *component, const char *name);
-/* Only allowed during the sink's initialization. */
extern struct bt_port *bt_component_sink_get_default_input_port(
struct bt_component *component);
enum bt_component_status bt_component_source_validate(
struct bt_component *component);
-/**
- * Create an iterator on a component instance.
- *
- * @param component Component instance
- * @returns Notification iterator instance
- */
-BT_HIDDEN
-struct bt_notification_iterator *bt_component_source_create_notification_iterator(
- struct bt_component *component);
-
-BT_HIDDEN
-struct bt_notification_iterator *bt_component_source_create_notification_iterator_with_init_method_data(
- struct bt_component *component, void *init_method_data);
-
#endif /* BABELTRACE_COMPONENT_SOURCE_INTERNAL_H */
extern struct bt_port *bt_component_source_get_default_output_port(
struct bt_component *component);
-/* Only allowed during the source's initialization. */
-extern struct bt_port *bt_component_source_add_output_port(
- struct bt_component *component, const char *name);
-
#ifdef __cplusplus
}
#endif
struct bt_component_class *component_class, const char *name,
struct bt_value *params, void *init_method_data);
-/**
- * Get a component's private data.
- *
- * @param component Component of which to get the private data
- * @returns Component's private data
- */
-extern void *bt_component_get_private_data(struct bt_component *component);
-
-/**
- * Set a component's private data.
- *
- * @param component Component of which to set the private data
- * @param data Component private data
- * @returns One of #bt_component_status values
- */
-extern enum bt_component_status bt_component_set_private_data(
- struct bt_component *component, void *data);
-
/**
* Get component's name.
*
*/
#include <babeltrace/component/connection.h>
+#include <babeltrace/component/private-connection.h>
#include <babeltrace/object-internal.h>
struct bt_graph;
struct bt_port *upstream_port;
};
+static inline
+struct bt_connection *bt_connection_from_private(
+ struct bt_private_connection *private_connection)
+{
+ return (void *) private_connection;
+}
+
+static inline
+struct bt_private_connection *bt_private_connection_from_connection(
+ struct bt_connection *connection)
+{
+ return (void *) connection;
+}
+
BT_HIDDEN
struct bt_connection *bt_connection_create(struct bt_graph *graph,
struct bt_port *upstream_port,
extern struct bt_port *bt_connection_get_upstream_port(
struct bt_connection *connection);
-extern struct bt_notification_iterator *
-bt_connection_create_notification_iterator(struct bt_connection *connection);
-
#ifdef __cplusplus
}
#endif
*/
#include <babeltrace/babeltrace-internal.h>
+#include <babeltrace/object-internal.h>
#include <babeltrace/ref-internal.h>
#include <babeltrace/component/notification/iterator.h>
+#include <babeltrace/component/notification/private-iterator.h>
struct bt_notification_iterator {
struct bt_object base;
void *user_data;
};
+static inline
+struct bt_notification_iterator *bt_notification_iterator_from_private(
+ struct bt_private_notification_iterator *private_notification_iterator)
+{
+ return (void *) private_notification_iterator;
+}
+
+static inline
+struct bt_private_notification_iterator *
+bt_private_notification_iterator_from_notification_iterator(
+ struct bt_notification_iterator *notification_iterator)
+{
+ return (void *) notification_iterator;
+}
+
/**
* Allocate a notification iterator.
*
extern struct bt_component *bt_notification_iterator_get_component(
struct bt_notification_iterator *iterator);
-/**
- * Set an iterator's private data.
- *
- * @param iterator Notification iterator instance
- * @param data Iterator private data
- * @returns One of #bt_notification_iterator_status values
- */
-extern enum bt_notification_iterator_status
-bt_notification_iterator_set_private_data(
- struct bt_notification_iterator *iterator, void *data);
-
-/**
- * Get an iterator's private data.
- *
- * @param iterator Notification iterator instance
- * @returns Iterator instance private data
- */
-extern void *bt_notification_iterator_get_private_data(
- struct bt_notification_iterator *iterator);
-
#ifdef __cplusplus
}
#endif
--- /dev/null
+#ifndef BABELTRACE_COMPONENT_NOTIFICATION_PRIVATE_ITERATOR_H
+#define BABELTRACE_COMPONENT_NOTIFICATION_PRIVATE_ITERATOR_H
+
+/*
+ * Copyright 2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_connection;
+struct bt_private_port;
+struct bt_private_connection;
+struct bt_private_notification_iterator;
+
+struct bt_notification_iterator *
+bt_notification_iterator_from_private_notification_iterator(
+ struct bt_private_notification_iterator *private_notification_iterator);
+
+extern struct bt_private_component *
+bt_private_notification_iterator_get_private_component(
+ struct bt_private_notification_iterator *private_notification_iterator);
+
+extern enum bt_notification_iterator_status
+bt_private_notification_iterator_set_user_data(
+ struct bt_private_notification_iterator *private_notification_iterator,
+ void *user_data);
+
+extern void *bt_private_notification_iterator_get_user_data(
+ struct bt_private_notification_iterator *private_notification_iterator);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_COMPONENT_NOTIFICATION_PRIVATE_ITERATOR_H */
struct bt_connection *connection;
};
+static inline
+struct bt_port *bt_port_from_private(
+ struct bt_private_port *private_port)
+{
+ return (void *) private_port;
+}
+
+static inline
+struct bt_private_port *bt_private_port_from_port(
+ struct bt_port *port)
+{
+ return (void *) port;
+}
+
BT_HIDDEN
struct bt_port *bt_port_create(struct bt_component *parent_component,
enum bt_port_type type, const char *name);
--- /dev/null
+#ifndef BABELTRACE_COMPONENT_PRIVATE_COMPONENT_SINK_H
+#define BABELTRACE_COMPONENT_PRIVATE_COMPONENT_SINK_H
+
+/*
+ * Copyright 2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace/component/component.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_private_component;
+struct bt_private_port;
+
+extern struct bt_private_port *
+bt_private_component_filter_get_output_private_port(
+ struct bt_private_component *private_component,
+ const char *name);
+
+extern struct bt_private_port *
+bt_private_component_filter_get_output_private_port_at_index(
+ struct bt_private_component *private_component, int index);
+
+extern struct bt_private_port *
+bt_private_component_filter_get_default_output_private_port(
+ struct bt_private_component *private_component);
+
+extern struct bt_private_port *
+bt_private_component_filter_add_output_private_port(
+ struct bt_private_component *private_component,
+ const char *name);
+
+extern struct bt_private_port *
+bt_private_component_filter_get_input_private_port(
+ struct bt_private_component *private_component,
+ const char *name);
+
+extern struct bt_private_port *
+bt_private_component_filter_get_input_private_port_at_index(
+ struct bt_private_component *private_component, int index);
+
+extern struct bt_private_port *
+bt_private_component_filter_get_default_input_private_port(
+ struct bt_private_component *private_component);
+
+extern struct bt_private_port *
+bt_private_component_filter_add_input_private_port(
+ struct bt_private_component *private_component,
+ const char *name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_COMPONENT_PRIVATE_COMPONENT_SINK_H */
--- /dev/null
+#ifndef BABELTRACE_COMPONENT_PRIVATE_COMPONENT_SINK_H
+#define BABELTRACE_COMPONENT_PRIVATE_COMPONENT_SINK_H
+
+/*
+ * Copyright 2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace/component/component.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_private_component;
+struct bt_private_port;
+
+extern struct bt_private_port *
+bt_private_component_sink_get_input_private_port(
+ struct bt_private_component *private_component,
+ const char *name);
+
+extern struct bt_private_port *
+bt_private_component_sink_get_input_private_port_at_index(
+ struct bt_private_component *private_component, int index);
+
+extern struct bt_private_port *
+bt_private_component_sink_get_default_input_private_port(
+ struct bt_private_component *private_component);
+
+extern struct bt_private_port *
+bt_private_component_sink_add_input_private_port(
+ struct bt_private_component *private_component,
+ const char *name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_COMPONENT_PRIVATE_COMPONENT_SINK_H */
--- /dev/null
+#ifndef BABELTRACE_COMPONENT_PRIVATE_COMPONENT_SOURCE_H
+#define BABELTRACE_COMPONENT_PRIVATE_COMPONENT_SOURCE_H
+
+/*
+ * Copyright 2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace/component/component.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_private_component;
+struct bt_private_port;
+
+extern struct bt_private_port *
+bt_private_component_source_get_output_private_port(
+ struct bt_private_component *private_component,
+ const char *name);
+
+extern struct bt_private_port *
+bt_private_component_source_get_output_private_port_at_index(
+ struct bt_private_component *private_component, int index);
+
+extern struct bt_private_port *
+bt_private_component_source_get_default_output_private_port(
+ struct bt_private_component *private_component);
+
+extern struct bt_private_port *
+bt_private_component_source_add_output_private_port(
+ struct bt_private_component *private_component,
+ const char *name);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_COMPONENT_PRIVATE_COMPONENT_SOURCE_H */
--- /dev/null
+#ifndef BABELTRACE_COMPONENT_PRIVATE_COMPONENT_H
+#define BABELTRACE_COMPONENT_PRIVATE_COMPONENT_H
+
+/*
+ * Copyright 2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace/component/component.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_private_component;
+
+struct bt_component *bt_component_from_private_component(
+ struct bt_private_component *private_component);
+
+extern void *bt_private_component_get_user_data(
+ struct bt_private_component *private_component);
+
+extern enum bt_component_status bt_private_component_set_user_data(
+ struct bt_private_component *private_component,
+ void *user_data);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_COMPONENT_PRIVATE_COMPONENT_H */
--- /dev/null
+#ifndef BABELTRACE_COMPONENT_PRIVATE_CONNECTION_H
+#define BABELTRACE_COMPONENT_PRIVATE_CONNECTION_H
+
+/*
+ * Copyright 2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_connection;
+struct bt_private_port;
+struct bt_private_connection;
+
+struct bt_connection *bt_connection_from_private_connection(
+ struct bt_private_connection *private_connection);
+
+extern struct bt_notification_iterator *
+bt_private_connection_create_notification_iterator(
+ struct bt_private_connection *private_connection);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_COMPONENT_PRIVATE_CONNECTION_H */
--- /dev/null
+#ifndef BABELTRACE_COMPONENT_PRIVATE_PORT_H
+#define BABELTRACE_COMPONENT_PRIVATE_PORT_H
+
+/*
+ * Copyright 2017 Philippe Proulx <pproulx@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct bt_port;
+struct bt_private_port;
+struct bt_private_component;
+struct bt_private_connection;
+
+struct bt_port *bt_port_from_private_port(struct bt_private_port *private_port);
+extern struct bt_private_connection *bt_private_port_get_private_connection(
+ struct bt_private_port *private_port);
+extern struct bt_private_component *bt_private_port_get_private_component(
+ struct bt_private_port *private_port);
+extern int bt_private_port_remove_from_component(
+ struct bt_private_port *private_port);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* BABELTRACE_COMPONENT_PRIVATE_PORT_H */
* SOFTWARE.
*/
+#include <babeltrace/component/private-component.h>
#include <babeltrace/component/component.h>
#include <babeltrace/component/component-internal.h>
#include <babeltrace/component/component-class-internal.h>
#include <babeltrace/component/component-source-internal.h>
#include <babeltrace/component/component-filter-internal.h>
#include <babeltrace/component/component-sink-internal.h>
+#include <babeltrace/component/private-connection.h>
#include <babeltrace/component/connection-internal.h>
#include <babeltrace/component/graph-internal.h>
#include <babeltrace/component/notification/iterator-internal.h>
+#include <babeltrace/component/notification/private-iterator.h>
#include <babeltrace/babeltrace-internal.h>
#include <babeltrace/compiler.h>
#include <babeltrace/ref.h>
* instance.
*/
if (component->class->methods.destroy) {
- component->class->methods.destroy(component);
+ component->class->methods.destroy(
+ bt_private_component_from_component(component));
}
if (component->destroy) {
g_free(component);
}
-enum bt_component_class_type bt_component_get_class_type(
- struct bt_component *component)
+struct bt_component *bt_component_from_private_component(
+ struct bt_private_component *private_component)
{
- return component ? component->class->type : BT_COMPONENT_CLASS_TYPE_UNKNOWN;
+ return bt_get(bt_component_from_private(private_component));
}
-BT_HIDDEN
-struct bt_notification_iterator *bt_component_create_iterator(
- struct bt_component *component, void *init_method_data)
+enum bt_component_class_type bt_component_get_class_type(
+ struct bt_component *component)
{
- enum bt_notification_iterator_status ret_iterator;
- enum bt_component_class_type type;
- struct bt_notification_iterator *iterator = NULL;
- struct bt_component_class *class = component->class;
-
- if (!component) {
- goto error;
- }
-
- type = bt_component_get_class_type(component);
- if (type != BT_COMPONENT_CLASS_TYPE_SOURCE &&
- type != BT_COMPONENT_CLASS_TYPE_FILTER) {
- /* Unsupported operation. */
- goto error;
- }
-
- iterator = bt_notification_iterator_create(component);
- if (!iterator) {
- goto error;
- }
-
- switch (type) {
- case BT_COMPONENT_CLASS_TYPE_SOURCE:
- {
- struct bt_component_class_source *source_class;
- enum bt_notification_iterator_status status;
-
- source_class = container_of(class, struct bt_component_class_source, parent);
-
- if (source_class->methods.iterator.init) {
- status = source_class->methods.iterator.init(component,
- iterator, init_method_data);
- if (status < 0) {
- goto error;
- }
- }
- break;
- }
- case BT_COMPONENT_CLASS_TYPE_FILTER:
- {
- struct bt_component_class_filter *filter_class;
- enum bt_notification_iterator_status status;
-
- filter_class = container_of(class, struct bt_component_class_filter, parent);
-
- if (filter_class->methods.iterator.init) {
- status = filter_class->methods.iterator.init(component,
- iterator, init_method_data);
- if (status < 0) {
- goto error;
- }
- }
- break;
- }
- default:
- /* Unreachable. */
- assert(0);
- }
-
- ret_iterator = bt_notification_iterator_validate(iterator);
- if (ret_iterator != BT_NOTIFICATION_ITERATOR_STATUS_OK) {
- goto error;
- }
-
- return iterator;
-error:
- BT_PUT(iterator);
- return iterator;
+ return component ? component->class->type : BT_COMPONENT_CLASS_TYPE_UNKNOWN;
}
static
component->initializing = true;
if (component_class->methods.init) {
- ret = component_class->methods.init(component, params,
+ ret = component_class->methods.init(
+ bt_private_component_from_component(component), params,
init_method_data);
component->initializing = false;
if (ret != BT_COMPONENT_STATUS_OK) {
return component ? bt_get(component->class) : NULL;
}
-void *bt_component_get_private_data(struct bt_component *component)
+void *bt_private_component_get_user_data(
+ struct bt_private_component *private_component)
{
+ struct bt_component *component =
+ bt_component_from_private(private_component);
+
return component ? component->user_data : NULL;
}
-enum bt_component_status
-bt_component_set_private_data(struct bt_component *component,
+enum bt_component_status bt_private_component_set_user_data(
+ struct bt_private_component *private_component,
void *data)
{
+ struct bt_component *component =
+ bt_component_from_private(private_component);
enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
if (!component || !component->initializing) {
if (comp->class->methods.accept_port_connection) {
status = comp->class->methods.accept_port_connection(
- comp, port);
+ bt_private_component_from_component(comp),
+ bt_private_port_from_port(port));
}
return status;
assert(port);
if (comp->class->methods.port_disconnected) {
- comp->class->methods.port_disconnected(comp, port);
+ comp->class->methods.port_disconnected(
+ bt_private_component_from_component(comp),
+ bt_private_port_from_port(port));
}
}
* SOFTWARE.
*/
+#include <babeltrace/component/notification/iterator-internal.h>
#include <babeltrace/component/component-internal.h>
#include <babeltrace/component/component-source-internal.h>
#include <babeltrace/component/component-filter-internal.h>
#include <babeltrace/component/connection-internal.h>
+#include <babeltrace/component/private-connection.h>
#include <babeltrace/component/graph-internal.h>
#include <babeltrace/component/port-internal.h>
#include <babeltrace/object-internal.h>
g_free(connection);
}
+struct bt_connection *bt_connection_from_private_connection(
+ struct bt_private_connection *private_connection)
+{
+ return bt_get(bt_connection_from_private(private_connection));
+}
+
BT_HIDDEN
struct bt_connection *bt_connection_create(
struct bt_graph *graph,
conn->upstream_port = NULL;
}
- if (downstream_comp && downstream_comp != acting_comp &&
- downstream_comp->class->methods.port_disconnected) {
+ if (downstream_comp && downstream_comp != acting_comp) {
bt_component_port_disconnected(downstream_comp,
downstream_port);
}
- if (upstream_comp && upstream_comp != acting_comp &&
- upstream_comp->class->methods.port_disconnected) {
+ if (upstream_comp && upstream_comp != acting_comp) {
bt_component_port_disconnected(upstream_comp, upstream_port);
}
}
struct bt_notification_iterator *
-bt_connection_create_notification_iterator(struct bt_connection *connection)
+bt_private_connection_create_notification_iterator(
+ struct bt_private_connection *private_connection)
{
+ enum bt_notification_iterator_status ret_iterator;
+ enum bt_component_class_type upstream_comp_class_type;
+ struct bt_notification_iterator *iterator = NULL;
+ struct bt_port *upstream_port = NULL;
struct bt_component *upstream_component = NULL;
- struct bt_notification_iterator *it = NULL;
+ struct bt_component_class *upstream_comp_class = NULL;
+ struct bt_connection *connection = NULL;
+ bt_component_class_notification_iterator_init_method init_method = NULL;
- if (!connection) {
- goto end;
+ if (!private_connection) {
+ goto error;
}
+ connection = bt_connection_from_private(private_connection);
+
if (!connection->upstream_port || !connection->downstream_port) {
- goto end;
+ goto error;
}
- upstream_component = bt_port_get_component(connection->upstream_port);
+ upstream_port = connection->upstream_port;
+ assert(upstream_port);
+ upstream_component = bt_port_get_component(upstream_port);
assert(upstream_component);
+ upstream_comp_class = upstream_component->class;
+
+ if (!upstream_component) {
+ goto error;
+ }
+
+ upstream_comp_class_type =
+ bt_component_get_class_type(upstream_component);
+ if (upstream_comp_class_type != BT_COMPONENT_CLASS_TYPE_SOURCE &&
+ upstream_comp_class_type != BT_COMPONENT_CLASS_TYPE_FILTER) {
+ /* Unsupported operation. */
+ goto error;
+ }
- switch (bt_component_get_class_type(upstream_component)) {
+ iterator = bt_notification_iterator_create(upstream_component);
+ if (!iterator) {
+ goto error;
+ }
+
+ switch (upstream_comp_class_type) {
case BT_COMPONENT_CLASS_TYPE_SOURCE:
- it = bt_component_source_create_notification_iterator(
- upstream_component);
+ {
+ struct bt_component_class_source *source_class =
+ container_of(upstream_comp_class,
+ struct bt_component_class_source, parent);
+ init_method = source_class->methods.iterator.init;
break;
+ }
case BT_COMPONENT_CLASS_TYPE_FILTER:
- it = bt_component_filter_create_notification_iterator(
- upstream_component);
+ {
+ struct bt_component_class_filter *filter_class =
+ container_of(upstream_comp_class,
+ struct bt_component_class_filter, parent);
+ init_method = filter_class->methods.iterator.init;
break;
+ }
default:
- goto end;
+ /* Unreachable. */
+ assert(0);
+ }
+
+ if (init_method) {
+ enum bt_notification_iterator_status status = init_method(
+ bt_private_component_from_component(upstream_component),
+ bt_private_port_from_port(upstream_port),
+ bt_private_notification_iterator_from_notification_iterator(iterator));
+ if (status < 0) {
+ goto error;
+ }
+ }
+
+ ret_iterator = bt_notification_iterator_validate(iterator);
+ if (ret_iterator != BT_NOTIFICATION_ITERATOR_STATUS_OK) {
+ goto error;
}
+
+ goto end;
+
+error:
+ BT_PUT(iterator);
+
end:
bt_put(upstream_component);
- return it;
+ return iterator;
}
#include <babeltrace/component/notification/notification.h>
#include <babeltrace/component/notification/iterator-internal.h>
-BT_HIDDEN
-struct bt_notification_iterator *bt_component_filter_create_notification_iterator(
- struct bt_component *component)
-{
- return bt_component_create_iterator(component, NULL);
-}
-
-BT_HIDDEN
-struct bt_notification_iterator *bt_component_filter_create_notification_iterator_with_init_method_data(
- struct bt_component *component, void *init_method_data)
-{
- return bt_component_create_iterator(component, init_method_data);
-}
-
BT_HIDDEN
void bt_component_filter_destroy(struct bt_component *component)
{
DEFAULT_INPUT_PORT_NAME);
}
-struct bt_port *bt_component_filter_add_input_port(
- struct bt_component *component, const char *name)
-{
- struct bt_port *port = NULL;
-
- if (!component ||
- component->class->type != BT_COMPONENT_CLASS_TYPE_FILTER) {
- goto end;
- }
-
- port = bt_component_add_input_port(component, name);
-end:
- return port;
-}
-
enum bt_component_status bt_component_filter_get_output_port_count(
struct bt_component *component, uint64_t *count)
{
DEFAULT_OUTPUT_PORT_NAME);
}
-struct bt_port *bt_component_filter_add_output_port(
- struct bt_component *component, const char *name)
+struct bt_private_port *
+bt_private_component_filter_get_input_private_port_at_index(
+ struct bt_private_component *private_component, int index)
+{
+ return bt_private_port_from_port(
+ bt_component_filter_get_input_port_at_index(
+ bt_component_from_private(private_component), index));
+}
+
+struct bt_private_port *
+bt_private_component_filter_get_default_private_input_port(
+ struct bt_private_component *private_component)
+{
+ return bt_private_port_from_port(
+ bt_component_filter_get_default_input_port(
+ bt_component_from_private(private_component)));
+}
+
+struct bt_private_port *bt_private_component_filter_add_input_private_port(
+ struct bt_private_component *private_component,
+ const char *name)
+{
+ struct bt_port *port = NULL;
+ struct bt_component *component =
+ bt_component_from_private(private_component);
+
+ if (!component ||
+ component->class->type != BT_COMPONENT_CLASS_TYPE_FILTER) {
+ goto end;
+ }
+
+ port = bt_component_add_input_port(component, name);
+end:
+ return bt_private_port_from_port(port);
+}
+
+struct bt_private_port *
+bt_private_component_filter_get_output_private_port_at_index(
+ struct bt_private_component *private_component, int index)
+{
+ return bt_private_port_from_port(
+ bt_component_filter_get_output_port_at_index(
+ bt_component_from_private(private_component), index));
+}
+
+struct bt_private_port *
+bt_private_component_filter_get_default_private_output_port(
+ struct bt_private_component *private_component)
+{
+ return bt_private_port_from_port(
+ bt_component_filter_get_default_output_port(
+ bt_component_from_private(private_component)));
+}
+
+struct bt_private_port *bt_private_component_filter_add_output_private_port(
+ struct bt_private_component *private_component,
+ const char *name)
{
struct bt_port *port = NULL;
+ struct bt_component *component =
+ bt_component_from_private(private_component);
if (!component ||
component->class->type != BT_COMPONENT_CLASS_TYPE_FILTER) {
port = bt_component_add_output_port(component, name);
end:
- return port;
+ return bt_private_port_from_port(port);
}
source_class = container_of(comp_class, struct bt_component_class_source, parent);
if (source_class->methods.iterator.destroy) {
- source_class->methods.iterator.destroy(iterator);
+ source_class->methods.iterator.destroy(
+ bt_private_notification_iterator_from_notification_iterator(iterator));
}
break;
}
filter_class = container_of(comp_class, struct bt_component_class_filter, parent);
if (filter_class->methods.iterator.destroy) {
- filter_class->methods.iterator.destroy(iterator);
+ filter_class->methods.iterator.destroy(
+ bt_private_notification_iterator_from_notification_iterator(iterator));
}
break;
}
return ret;
}
-void *bt_notification_iterator_get_private_data(
- struct bt_notification_iterator *iterator)
+void *bt_private_notification_iterator_get_user_data(
+ struct bt_private_notification_iterator *private_iterator)
{
+ struct bt_notification_iterator *iterator =
+ bt_notification_iterator_from_private(private_iterator);
+
return iterator ? iterator->user_data : NULL;
}
enum bt_notification_iterator_status
-bt_notification_iterator_set_private_data(
- struct bt_notification_iterator *iterator, void *data)
+bt_private_notification_iterator_set_user_data(
+ struct bt_private_notification_iterator *private_iterator,
+ void *data)
{
enum bt_notification_iterator_status ret =
BT_NOTIFICATION_ITERATOR_STATUS_OK;
+ struct bt_notification_iterator *iterator =
+ bt_notification_iterator_from_private(private_iterator);
if (!iterator) {
ret = BT_NOTIFICATION_ITERATOR_STATUS_INVAL;
struct bt_notification *bt_notification_iterator_get_notification(
struct bt_notification_iterator *iterator)
{
+ struct bt_private_notification_iterator *priv_iterator =
+ bt_private_notification_iterator_from_notification_iterator(iterator);
bt_component_class_notification_iterator_get_method get_method = NULL;
assert(iterator);
}
assert(get_method);
- return get_method(iterator);
+ return get_method(priv_iterator);
}
enum bt_notification_iterator_status
bt_notification_iterator_next(struct bt_notification_iterator *iterator)
{
+ struct bt_private_notification_iterator *priv_iterator =
+ bt_private_notification_iterator_from_notification_iterator(iterator);
bt_component_class_notification_iterator_next_method next_method = NULL;
assert(iterator);
}
assert(next_method);
- return next_method(iterator);
+ return next_method(priv_iterator);
}
struct bt_component *bt_notification_iterator_get_component(
g_free(port);
}
+struct bt_port *bt_port_from_private_port(
+ struct bt_private_port *private_port)
+{
+ return bt_get(bt_port_from_private(private_port));
+}
+
BT_HIDDEN
struct bt_port *bt_port_create(struct bt_component *parent_component,
enum bt_port_type type, const char *name)
return (struct bt_component *) bt_object_get_parent(port);
}
+struct bt_private_connection *bt_private_port_get_private_connection(
+ struct bt_private_port *private_port)
+{
+ return bt_private_connection_from_connection(bt_port_get_connection(
+ bt_port_from_private(private_port)));
+}
+
+struct bt_private_component *bt_private_port_get_private_component(
+ struct bt_private_port *private_port)
+{
+ return bt_private_component_from_component(bt_port_get_component(
+ bt_port_from_private(private_port)));
+}
+
BT_HIDDEN
void bt_port_set_connection(struct bt_port *port,
struct bt_connection *connection)
port->connection = connection;
}
-int bt_port_remove_from_component(struct bt_port *port)
+int bt_private_port_remove_from_component(
+ struct bt_private_port *private_port)
{
int ret = 0;
+ struct bt_port *port = bt_port_from_private(private_port);
struct bt_component *comp = NULL;
if (!port) {
sink_class = container_of(component->class, struct bt_component_class_sink, parent);
assert(sink_class->methods.consume);
- ret = sink_class->methods.consume(component);
+ ret = sink_class->methods.consume(bt_private_component_from_component(component));
end:
return ret;
}
DEFAULT_INPUT_PORT_NAME);
}
-struct bt_port *bt_component_sink_add_input_port(
- struct bt_component *component, const char *name)
+struct bt_private_port *
+bt_private_component_sink_get_input_private_port_at_index(
+ struct bt_private_component *private_component, int index)
+{
+ return bt_private_port_from_port(
+ bt_component_sink_get_input_port_at_index(
+ bt_component_from_private(private_component), index));
+}
+
+struct bt_private_port *bt_private_component_sink_get_default_private_input_port(
+ struct bt_private_component *private_component)
+{
+ return bt_private_port_from_port(
+ bt_component_sink_get_default_input_port(
+ bt_component_from_private(private_component)));
+}
+
+struct bt_private_port *bt_private_component_sink_add_input_private_port(
+ struct bt_private_component *private_component,
+ const char *name)
{
struct bt_port *port = NULL;
+ struct bt_component *component =
+ bt_component_from_private(private_component);
if (!component ||
component->class->type != BT_COMPONENT_CLASS_TYPE_SINK) {
port = bt_component_add_input_port(component, name);
end:
- return port;
+ return bt_private_port_from_port(port);
}
return source ? &source->parent : NULL;
}
-BT_HIDDEN
-struct bt_notification_iterator *bt_component_source_create_notification_iterator(
- struct bt_component *component)
-{
- return bt_component_create_iterator(component, NULL);
-}
-
-BT_HIDDEN
-struct bt_notification_iterator *bt_component_source_create_notification_iterator_with_init_method_data(
- struct bt_component *component, void *init_method_data)
-{
- return bt_component_create_iterator(component, init_method_data);
-}
-
enum bt_component_status bt_component_source_get_output_port_count(
struct bt_component *component, uint64_t *count)
{
DEFAULT_OUTPUT_PORT_NAME);
}
-struct bt_port *bt_component_source_add_output_port(
- struct bt_component *component, const char *name)
+struct bt_private_port *bt_private_component_source_get_output_private_port(
+ struct bt_private_component *private_component,
+ const char *name)
+{
+ return bt_private_port_from_port(bt_component_source_get_output_port(
+ bt_component_from_private(private_component), name));
+}
+
+struct bt_private_port *
+bt_private_component_source_get_output_private_port_at_index(
+ struct bt_private_component *private_component, int index)
+{
+ return bt_private_port_from_port(
+ bt_component_source_get_output_port_at_index(
+ bt_component_from_private(private_component), index));
+}
+
+struct bt_private_port *bt_private_component_source_get_default_output_private_port(
+ struct bt_private_component *private_component)
+{
+ return bt_private_port_from_port(
+ bt_component_source_get_default_output_port(
+ bt_component_from_private(private_component)));
+}
+
+struct bt_private_port *bt_private_component_source_add_output_private_port(
+ struct bt_private_component *private_component,
+ const char *name)
{
struct bt_port *port = NULL;
+ struct bt_component *component =
+ bt_component_from_private(private_component);
if (!component ||
component->class->type != BT_COMPONENT_CLASS_TYPE_SOURCE) {
port = bt_component_add_output_port(component, name);
end:
- return port;
+ return bt_private_port_from_port(port);
}
#include <babeltrace/ctf-ir/packet.h>
#include <babeltrace/ctf-ir/clock-class.h>
+#include <babeltrace/component/private-component.h>
+#include <babeltrace/component/component.h>
#include <babeltrace/component/notification/iterator.h>
+#include <babeltrace/component/notification/private-iterator.h>
#include <babeltrace/component/notification/stream.h>
#include <babeltrace/component/notification/event.h>
#include <babeltrace/component/notification/packet.h>
bool ctf_fs_debug;
enum bt_notification_iterator_status ctf_fs_iterator_next(
- struct bt_notification_iterator *iterator);
+ struct bt_private_notification_iterator *iterator);
struct bt_notification *ctf_fs_iterator_get(
- struct bt_notification_iterator *iterator)
+ struct bt_private_notification_iterator *iterator)
{
struct ctf_fs_iterator *ctf_it =
- bt_notification_iterator_get_private_data(iterator);
+ bt_private_notification_iterator_get_user_data(
+ iterator);
if (!ctf_it->current_notification) {
(void) ctf_fs_iterator_next(iterator);
}
enum bt_notification_iterator_status ctf_fs_iterator_next(
- struct bt_notification_iterator *iterator)
+ struct bt_private_notification_iterator *iterator)
{
int heap_ret;
struct bt_ctf_stream *stream = NULL;
enum bt_notification_iterator_status ret =
BT_NOTIFICATION_ITERATOR_STATUS_OK;
struct ctf_fs_iterator *ctf_it =
- bt_notification_iterator_get_private_data(iterator);
+ bt_private_notification_iterator_get_user_data(
+ iterator);
notification = bt_notification_heap_pop(ctf_it->pending_notifications);
if (!notification && !ctf_it->pending_streams) {
g_free(ctf_it);
}
-void ctf_fs_iterator_destroy(struct bt_notification_iterator *it)
+void ctf_fs_iterator_destroy(struct bt_private_notification_iterator *it)
{
- void *data = bt_notification_iterator_get_private_data(it);
+ void *data = bt_private_notification_iterator_get_user_data(it);
ctf_fs_iterator_destroy_data(data);
}
return ret;
}
-enum bt_notification_iterator_status ctf_fs_iterator_init(struct bt_component *source,
- struct bt_notification_iterator *it,
- UNUSED_VAR void *init_method_data)
+enum bt_notification_iterator_status ctf_fs_iterator_init(
+ struct bt_private_component *source,
+ struct bt_private_port *port,
+ struct bt_private_notification_iterator *it)
{
struct ctf_fs_iterator *ctf_it;
struct ctf_fs_component *ctf_fs;
assert(source && it);
- ctf_fs = bt_component_get_private_data(source);
+ ctf_fs = bt_private_component_get_user_data(source);
if (!ctf_fs) {
ret = BT_NOTIFICATION_ITERATOR_STATUS_INVAL;
goto end;
goto error;
}
- ret = bt_notification_iterator_set_private_data(it, ctf_it);
+ ret = bt_private_notification_iterator_set_user_data(it, ctf_it);
if (ret) {
goto error;
}
end:
return ret;
error:
- (void) bt_notification_iterator_set_private_data(it, NULL);
+ (void) bt_private_notification_iterator_set_user_data(it, NULL);
ctf_fs_iterator_destroy_data(ctf_it);
goto end;
}
g_free(ctf_fs);
}
-void ctf_fs_destroy(struct bt_component *component)
+void ctf_fs_destroy(struct bt_private_component *component)
{
- void *data = bt_component_get_private_data(component);
+ void *data = bt_private_component_get_user_data(component);
ctf_fs_destroy_data(data);
}
}
BT_HIDDEN
-enum bt_component_status ctf_fs_init(struct bt_component *source,
+enum bt_component_status ctf_fs_init(struct bt_private_component *source,
struct bt_value *params, UNUSED_VAR void *init_method_data)
{
struct ctf_fs_component *ctf_fs;
goto end;
}
- ret = bt_component_set_private_data(source, ctf_fs);
+ ret = bt_private_component_set_user_data(source, ctf_fs);
if (ret != BT_COMPONENT_STATUS_OK) {
goto error;
}
end:
return ret;
error:
- (void) bt_component_set_private_data(source, NULL);
+ (void) bt_private_component_set_user_data(source, NULL);
ctf_fs_destroy_data(ctf_fs);
return ret;
}
};
BT_HIDDEN
-enum bt_component_status ctf_fs_init(struct bt_component *source,
+enum bt_component_status ctf_fs_init(struct bt_private_component *source,
struct bt_value *params, void *init_method_data);
BT_HIDDEN
-void ctf_fs_destroy(struct bt_component *component);
+void ctf_fs_destroy(struct bt_private_component *component);
BT_HIDDEN
enum bt_notification_iterator_status ctf_fs_iterator_init(
- struct bt_component *source,
- struct bt_notification_iterator *it,
- void *init_method_data);
+ struct bt_private_component *source,
+ struct bt_private_port *port,
+ struct bt_private_notification_iterator *it);
-void ctf_fs_iterator_destroy(struct bt_notification_iterator *it);
+void ctf_fs_iterator_destroy(struct bt_private_notification_iterator *it);
enum bt_notification_iterator_status ctf_fs_iterator_next(
- struct bt_notification_iterator *iterator);
+ struct bt_private_notification_iterator *iterator);
struct bt_notification *ctf_fs_iterator_get(
- struct bt_notification_iterator *iterator);
+ struct bt_private_notification_iterator *iterator);
BT_HIDDEN
struct bt_value *ctf_fs_query(struct bt_component_class *comp_class,
#define LTTNG_LIVE_COMPONENT_DESCRIPTION "Component implementing an LTTng-live client."
BT_HIDDEN
-enum bt_component_status lttng_live_init(struct bt_component *source,
+enum bt_component_status lttng_live_init(struct bt_private_component *source,
struct bt_value *params, void *init_method_data);
BT_HIDDEN
struct bt_notification *lttng_live_iterator_get(
- struct bt_notification_iterator *iterator);
+ struct bt_private_notification_iterator *iterator);
BT_HIDDEN
enum bt_notification_iterator_status lttng_live_iterator_next(
- struct bt_notification_iterator *iterator);
+ struct bt_private_notification_iterator *iterator);
#endif /* BABELTRACE_PLUGIN_CTF_LTTNG_LIVE_INTERNAL_H */
BT_HIDDEN
struct bt_notification *lttng_live_iterator_get(
- struct bt_notification_iterator *iterator)
+ struct bt_private_notification_iterator *iterator)
{
return NULL;
}
BT_HIDDEN
enum bt_notification_iterator_status lttng_live_iterator_next(
- struct bt_notification_iterator *iterator)
+ struct bt_private_notification_iterator *iterator)
{
return BT_NOTIFICATION_ITERATOR_STATUS_OK;
}
BT_HIDDEN
-enum bt_component_status lttng_live_init(struct bt_component *component,
+enum bt_component_status lttng_live_init(struct bt_private_component *component,
struct bt_value *params, UNUSED_VAR void *init_method_data)
{
return BT_COMPONENT_STATUS_OK;
}
static
-void destroy_muxer(struct bt_component *component)
+void destroy_muxer(struct bt_private_component *component)
{
- void *data = bt_component_get_private_data(component);
+ void *data = bt_private_component_get_user_data(component);
destroy_muxer_data(data);
}
enum bt_component_status muxer_component_init(
- struct bt_component *component, struct bt_value *params,
+ struct bt_private_component *component, struct bt_value *params,
UNUSED_VAR void *init_method_data)
{
enum bt_component_status ret;
goto end;
}
- ret = bt_component_set_private_data(component, muxer);
+ ret = bt_private_component_set_user_data(component, muxer);
if (ret != BT_COMPONENT_STATUS_OK) {
goto error;
}
static
struct bt_notification *muxer_iterator_get(
- struct bt_notification_iterator *iterator)
+ struct bt_private_notification_iterator *iterator)
{
return NULL;
}
static
enum bt_notification_iterator_status muxer_iterator_next(
- struct bt_notification_iterator *iterator)
+ struct bt_private_notification_iterator *iterator)
{
return BT_NOTIFICATION_ITERATOR_STATUS_OK;
}
#include <babeltrace/plugin/plugin-dev.h>
#include <babeltrace/component/component.h>
+#include <babeltrace/component/private-component.h>
#include <babeltrace/component/component-sink.h>
#include <babeltrace/component/port.h>
+#include <babeltrace/component/private-port.h>
#include <babeltrace/component/connection.h>
+#include <babeltrace/component/private-connection.h>
#include <babeltrace/component/notification/notification.h>
#include <babeltrace/component/notification/iterator.h>
#include <babeltrace/component/notification/event.h>
}
static
-void destroy_text(struct bt_component *component)
+void destroy_text(struct bt_private_component *component)
{
- void *data = bt_component_get_private_data(component);
+ void *data = bt_private_component_get_user_data(component);
destroy_text_data(data);
}
}
static
-enum bt_component_status text_accept_port_connection(struct bt_component *component,
- struct bt_port *self_port)
+enum bt_component_status text_accept_port_connection(
+ struct bt_private_component *component,
+ struct bt_private_port *self_port)
{
enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
- struct bt_connection *connection;
+ struct bt_private_connection *connection;
struct text_component *text;
- text = bt_component_get_private_data(component);
+ text = bt_private_component_get_user_data(component);
assert(text);
assert(!text->input_iterator);
- connection = bt_port_get_connection(self_port);
+ connection = bt_private_port_get_private_connection(self_port);
assert(connection);
- text->input_iterator = bt_connection_create_notification_iterator(
- connection);
+ text->input_iterator =
+ bt_private_connection_create_notification_iterator(connection);
if (!text->input_iterator) {
ret = BT_COMPONENT_STATUS_ERROR;
}
static
-enum bt_component_status run(struct bt_component *component)
+enum bt_component_status run(struct bt_private_component *component)
{
enum bt_component_status ret;
struct bt_notification *notification = NULL;
struct bt_notification_iterator *it;
- struct text_component *text = bt_component_get_private_data(component);
+ struct text_component *text =
+ bt_private_component_get_user_data(component);
it = text->input_iterator;
static
enum bt_component_status text_component_init(
- struct bt_component *component, struct bt_value *params,
+ struct bt_private_component *component,
+ struct bt_value *params,
UNUSED_VAR void *init_method_data)
{
enum bt_component_status ret;
set_use_colors(text);
- ret = bt_component_set_private_data(component, text);
+ ret = bt_private_component_set_user_data(component, text);
if (ret != BT_COMPONENT_STATUS_OK) {
goto error;
}
#include <babeltrace/plugin/plugin-dev.h>
#include <babeltrace/component/component.h>
+#include <babeltrace/component/private-component.h>
+#include <babeltrace/component/private-port.h>
+#include <babeltrace/component/private-connection.h>
#include <babeltrace/component/component-sink.h>
#include <babeltrace/component/notification/iterator.h>
#include <babeltrace/component/notification/notification.h>
g_free(dummy);
}
-void dummy_destroy(struct bt_component *component)
+void dummy_destroy(struct bt_private_component *component)
{
struct dummy *dummy;
assert(component);
- dummy = bt_component_get_private_data(component);
+ dummy = bt_private_component_get_user_data(component);
assert(dummy);
destroy_private_dummy_data(dummy);
}
-enum bt_component_status dummy_init(struct bt_component *component,
+enum bt_component_status dummy_init(struct bt_private_component *component,
struct bt_value *params, UNUSED_VAR void *init_method_data)
{
enum bt_component_status ret;
goto end;
}
- ret = bt_component_set_private_data(component, dummy);
+ ret = bt_private_component_set_user_data(component, dummy);
if (ret != BT_COMPONENT_STATUS_OK) {
goto error;
}
return ret;
}
-enum bt_component_status dummy_accept_port_connection(struct bt_component *component,
- struct bt_port *self_port)
+enum bt_component_status dummy_accept_port_connection(
+ struct bt_private_component *component,
+ struct bt_private_port *self_port)
{
enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
struct dummy *dummy;
- struct bt_connection *connection;
struct bt_notification_iterator *iterator;
+ struct bt_private_connection *connection;
- dummy = bt_component_get_private_data(component);
+ dummy = bt_private_component_get_user_data(component);
assert(dummy);
- connection = bt_port_get_connection(self_port);
+ connection = bt_private_port_get_private_connection(self_port);
assert(connection);
- iterator = bt_connection_create_notification_iterator(connection);
+ iterator = bt_private_connection_create_notification_iterator(
+ connection);
if (!iterator) {
ret = BT_COMPONENT_STATUS_ERROR;
goto end;
return ret;
}
-enum bt_component_status dummy_consume(struct bt_component *component)
+enum bt_component_status dummy_consume(struct bt_private_component *component)
{
enum bt_component_status ret;
struct bt_notification *notif = NULL;
size_t i;
struct dummy *dummy;
- dummy = bt_component_get_private_data(component);
+ dummy = bt_private_component_get_user_data(component);
assert(dummy);
/* Consume one notification from each iterator. */
*/
#include <glib.h>
-#include <babeltrace/component/component.h>
-#include <babeltrace/component/port.h>
-#include <babeltrace/component/connection.h>
+#include <babeltrace/component/private-component.h>
+#include <babeltrace/component/private-port.h>
struct dummy {
GPtrArray *iterators;
};
-enum bt_component_status dummy_init(struct bt_component *component,
+enum bt_component_status dummy_init(struct bt_private_component *component,
struct bt_value *params, void *init_method_data);
-void dummy_destroy(struct bt_component *component);
+void dummy_destroy(struct bt_private_component *component);
enum bt_component_status dummy_accept_port_connection(
- struct bt_component *component,
- struct bt_port *own_port);
-enum bt_component_status dummy_consume(struct bt_component *component);
+ struct bt_private_component *component,
+ struct bt_private_port *own_port);
+enum bt_component_status dummy_consume(struct bt_private_component *component);
#endif /* BABELTRACE_PLUGINS_UTILS_DUMMY_H */
#include "trimmer.h"
#include "iterator.h"
#include <babeltrace/component/notification/iterator.h>
+#include <babeltrace/component/notification/private-iterator.h>
#include <babeltrace/component/notification/notification.h>
#include <babeltrace/component/notification/event.h>
#include <babeltrace/component/notification/stream.h>
#include <babeltrace/component/notification/packet.h>
#include <babeltrace/component/component-filter.h>
-#include <babeltrace/component/port.h>
-#include <babeltrace/component/connection.h>
+#include <babeltrace/component/private-component-filter.h>
+#include <babeltrace/component/private-port.h>
+#include <babeltrace/component/private-connection.h>
+#include <babeltrace/component/private-component.h>
#include <babeltrace/ctf-ir/event.h>
#include <babeltrace/ctf-ir/stream.h>
#include <babeltrace/ctf-ir/stream-class.h>
#include <plugins-common.h>
BT_HIDDEN
-void trimmer_iterator_destroy(struct bt_notification_iterator *it)
+void trimmer_iterator_destroy(struct bt_private_notification_iterator *it)
{
struct trimmer_iterator *it_data;
- it_data = bt_notification_iterator_get_private_data(it);
+ it_data = bt_private_notification_iterator_get_user_data(it);
assert(it_data);
bt_put(it_data->current_notification);
BT_HIDDEN
enum bt_notification_iterator_status trimmer_iterator_init(
- struct bt_component *component,
- struct bt_notification_iterator *iterator,
- UNUSED_VAR void *init_method_data)
+ struct bt_private_component *component,
+ struct bt_private_port *port,
+ struct bt_private_notification_iterator *iterator)
{
enum bt_notification_iterator_status ret =
BT_NOTIFICATION_ITERATOR_STATUS_OK;
enum bt_notification_iterator_status it_ret;
- struct bt_port *input_port = NULL;
- struct bt_connection *connection = NULL;
+ struct bt_private_port *input_port = NULL;
+ struct bt_private_connection *connection = NULL;
struct trimmer_iterator *it_data = g_new0(struct trimmer_iterator, 1);
if (!it_data) {
}
/* Create a new iterator on the upstream component. */
- input_port = bt_component_filter_get_default_input_port(component);
+ input_port = bt_private_component_filter_get_default_input_private_port(
+ component);
assert(input_port);
- connection = bt_port_get_connection(input_port);
+ connection = bt_private_port_get_private_connection(input_port);
assert(connection);
- it_data->input_iterator = bt_connection_create_notification_iterator(
- connection);
+ it_data->input_iterator =
+ bt_private_connection_create_notification_iterator(connection);
if (!it_data->input_iterator) {
ret = BT_NOTIFICATION_ITERATOR_STATUS_NOMEM;
goto end;
}
- it_ret = bt_notification_iterator_set_private_data(iterator, it_data);
+ it_ret = bt_private_notification_iterator_set_user_data(iterator,
+ it_data);
if (it_ret) {
goto end;
}
BT_HIDDEN
struct bt_notification *trimmer_iterator_get(
- struct bt_notification_iterator *iterator)
+ struct bt_private_notification_iterator *iterator)
{
struct trimmer_iterator *trim_it;
- trim_it = bt_notification_iterator_get_private_data(iterator);
+ trim_it = bt_private_notification_iterator_get_user_data(iterator);
assert(trim_it);
if (!trim_it->current_notification) {
BT_HIDDEN
enum bt_notification_iterator_status trimmer_iterator_next(
- struct bt_notification_iterator *iterator)
+ struct bt_private_notification_iterator *iterator)
{
struct trimmer_iterator *trim_it = NULL;
- struct bt_component *component = NULL;
+ struct bt_private_component *component = NULL;
struct trimmer *trimmer = NULL;
struct bt_notification_iterator *source_it = NULL;
enum bt_notification_iterator_status ret =
BT_NOTIFICATION_ITERATOR_STATUS_OK;
bool notification_in_range = false;
- trim_it = bt_notification_iterator_get_private_data(iterator);
+ trim_it = bt_private_notification_iterator_get_user_data(iterator);
assert(trim_it);
- component = bt_notification_iterator_get_component(iterator);
+ component = bt_private_notification_iterator_get_private_component(
+ iterator);
assert(component);
- trimmer = bt_component_get_private_data(component);
+ trimmer = bt_private_component_get_user_data(component);
assert(trimmer);
source_it = trim_it->input_iterator;
BT_HIDDEN
enum bt_notification_iterator_status trimmer_iterator_seek_time(
- struct bt_notification_iterator *iterator, int64_t time)
+ struct bt_private_notification_iterator *iterator,
+ int64_t time)
{
return BT_NOTIFICATION_ITERATOR_STATUS_OK;
}
#include "trimmer.h"
#include <babeltrace/component/notification/notification.h>
#include <babeltrace/component/notification/iterator.h>
+#include <babeltrace/component/private-component.h>
+#include <babeltrace/component/private-port.h>
struct trimmer_iterator {
/* Input iterator associated with this output iterator. */
BT_HIDDEN
enum bt_notification_iterator_status trimmer_iterator_init(
- struct bt_component *component,
- struct bt_notification_iterator *iterator, void *init_method_data);
+ struct bt_private_component *component,
+ struct bt_private_port *port,
+ struct bt_private_notification_iterator *iterator);
BT_HIDDEN
-void trimmer_iterator_destroy(struct bt_notification_iterator *it);
+void trimmer_iterator_destroy(struct bt_private_notification_iterator *it);
BT_HIDDEN
struct bt_notification *trimmer_iterator_get(
- struct bt_notification_iterator *iterator);
+ struct bt_private_notification_iterator *iterator);
BT_HIDDEN
enum bt_notification_iterator_status trimmer_iterator_next(
- struct bt_notification_iterator *iterator);
+ struct bt_private_notification_iterator *iterator);
BT_HIDDEN
enum bt_notification_iterator_status trimmer_iterator_seek_time(
- struct bt_notification_iterator *iterator, int64_t time);
+ struct bt_private_notification_iterator *iterator,
+ int64_t time);
#endif /* BABELTRACE_PLUGIN_TRIMMER_ITERATOR_H */
#include <babeltrace/plugin/plugin-dev.h>
#include <babeltrace/component/component.h>
+#include <babeltrace/component/private-component.h>
#include <babeltrace/component/component-filter.h>
#include <babeltrace/component/notification/notification.h>
#include <babeltrace/component/notification/iterator.h>
+#include <babeltrace/component/notification/private-iterator.h>
#include <babeltrace/component/notification/event.h>
#include <plugins-common.h>
#include "trimmer.h"
return trimmer;
}
-void destroy_trimmer(struct bt_component *component)
+void destroy_trimmer(struct bt_private_component *component)
{
- void *data = bt_component_get_private_data(component);
+ void *data = bt_private_component_get_user_data(component);
destroy_trimmer_data(data);
}
}
static
-enum bt_component_status init_from_params(struct trimmer *trimmer, struct bt_value *params)
+enum bt_component_status init_from_params(struct trimmer *trimmer,
+ struct bt_value *params)
{
struct bt_value *value = NULL;
bool gmt = false;
}
enum bt_component_status trimmer_component_init(
- struct bt_component *component, struct bt_value *params,
+ struct bt_private_component *component, struct bt_value *params,
UNUSED_VAR void *init_method_data)
{
enum bt_component_status ret;
goto end;
}
- ret = bt_component_set_private_data(component, trimmer);
+ ret = bt_private_component_set_user_data(component, trimmer);
if (ret != BT_COMPONENT_STATUS_OK) {
goto error;
}
#include <stdbool.h>
#include <babeltrace/babeltrace-internal.h>
#include <babeltrace/values.h>
-#include <babeltrace/component/component.h>
+#include <babeltrace/component/private-component.h>
#define NSEC_PER_SEC 1000000000LL
};
enum bt_component_status trimmer_component_init(
- struct bt_component *component, struct bt_value *params,
- void *init_method_data);
+ struct bt_private_component *component,
+ struct bt_value *params, void *init_method_data);
-void destroy_trimmer(struct bt_component *component);
+void destroy_trimmer(struct bt_private_component *component);
#endif /* BABELTRACE_PLUGINS_UTILS_TRIMMER_H */
#include <babeltrace/ctf-ir/packet.h>
#include <babeltrace/plugin/plugin-dev.h>
#include <babeltrace/component/component.h>
+#include <babeltrace/component/private-component.h>
#include <babeltrace/component/component-sink.h>
-#include <babeltrace/component/port.h>
-#include <babeltrace/component/connection.h>
+#include <babeltrace/component/private-component-sink.h>
+#include <babeltrace/component/private-port.h>
+#include <babeltrace/component/private-connection.h>
#include <babeltrace/component/notification/notification.h>
#include <babeltrace/component/notification/iterator.h>
#include <babeltrace/component/notification/event.h>
}
static
-void destroy_writer_component(struct bt_component *component)
+void destroy_writer_component(struct bt_private_component *component)
{
struct writer_component *writer_component = (struct writer_component *)
- bt_component_get_private_data(component);
+ bt_private_component_get_user_data(component);
destroy_writer_component_data(writer_component);
g_free(writer_component);
static
enum bt_component_status writer_component_accept_port_connection(
- struct bt_component *component, struct bt_port *self_port)
+ struct bt_private_component *component,
+ struct bt_private_port *self_port)
{
enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
- struct bt_connection *connection;
+ struct bt_private_connection *connection;
struct writer_component *writer;
- writer = bt_component_get_private_data(component);
+ writer = bt_private_component_get_user_data(component);
assert(writer);
assert(!writer->input_iterator);
- connection = bt_port_get_connection(self_port);
+ connection = bt_private_port_get_private_connection(self_port);
assert(connection);
- writer->input_iterator = bt_connection_create_notification_iterator(
- connection);
+ writer->input_iterator =
+ bt_private_connection_create_notification_iterator(connection);
if (!writer->input_iterator) {
ret = BT_COMPONENT_STATUS_ERROR;
}
static
-enum bt_component_status run(struct bt_component *component)
+enum bt_component_status run(struct bt_private_component *component)
{
enum bt_component_status ret;
enum bt_notification_iterator_status it_status;
struct bt_notification *notification = NULL;
struct bt_notification_iterator *it;
struct writer_component *writer_component =
- bt_component_get_private_data(component);
+ bt_private_component_get_user_data(component);
it = writer_component->input_iterator;
assert(it);
static
enum bt_component_status writer_component_init(
- struct bt_component *component, struct bt_value *params,
+ struct bt_private_component *component, struct bt_value *params,
UNUSED_VAR void *init_method_data)
{
enum bt_component_status ret;
goto error;
}
- ret = bt_component_set_private_data(component, writer_component);
+ ret = bt_private_component_set_user_data(component, writer_component);
if (ret != BT_COMPONENT_STATUS_OK) {
goto error;
}
#include <babeltrace/ref.h>
#include <assert.h>
-static enum bt_component_status sink_consume(struct bt_component *component)
+static enum bt_component_status sink_consume(
+ struct bt_private_component *private_component)
{
return BT_COMPONENT_STATUS_OK;
}
static enum bt_notification_iterator_status dummy_iterator_init_method(
- struct bt_component *component,
- struct bt_notification_iterator *iterator,
- void *init_method_data)
+ struct bt_private_component *private_component,
+ struct bt_private_port *private_port,
+ struct bt_private_notification_iterator *private_iterator)
{
return BT_NOTIFICATION_ITERATOR_STATUS_OK;
}
static void dummy_iterator_destroy_method(
- struct bt_notification_iterator *iterator)
+ struct bt_private_notification_iterator *private_iterator)
{
}
static struct bt_notification *dummy_iterator_get_method(
- struct bt_notification_iterator *iterator)
+ struct bt_private_notification_iterator *private_iterator)
{
return NULL;
}
static enum bt_notification_iterator_status dummy_iterator_next_method(
- struct bt_notification_iterator *iterator)
+ struct bt_private_notification_iterator *private_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)
+ struct bt_private_notification_iterator *private_iterator,
+ int64_t time)
{
return BT_NOTIFICATION_ITERATOR_STATUS_OK;
}