2 * SPDX-License-Identifier: MIT
4 * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
5 * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
8 #ifndef BABELTRACE_GRAPH_COMPONENT_CLASS_INTERNAL_H
9 #define BABELTRACE_GRAPH_COMPONENT_CLASS_INTERNAL_H
11 #include <babeltrace2/graph/component-class.h>
12 #include <babeltrace2/graph/component.h>
13 #include "common/macros.h"
14 #include "lib/object.h"
15 #include "common/list.h"
16 #include <babeltrace2/types.h>
20 struct bt_component_class
;
21 struct bt_plugin_so_shared_lib_handle
;
23 typedef void (*bt_component_class_destroy_listener_func
)(
24 struct bt_component_class
*class, void *data
);
26 struct bt_component_class_destroy_listener
{
27 bt_component_class_destroy_listener_func func
;
31 struct bt_component_class
{
32 struct bt_object base
;
33 enum bt_component_class_type type
;
39 /* Array of struct bt_component_class_destroy_listener */
40 GArray
*destroy_listeners
;
42 struct bt_list_head node
;
43 struct bt_plugin_so_shared_lib_handle
*so_handle
;
46 struct bt_component_class_with_iterator_class
{
47 struct bt_component_class parent
;
48 bt_message_iterator_class
*msg_iter_cls
;
51 struct bt_component_class_source
{
52 struct bt_component_class_with_iterator_class parent
;
54 bt_component_class_source_get_supported_mip_versions_method get_supported_mip_versions
;
55 bt_component_class_source_initialize_method init
;
56 bt_component_class_source_finalize_method finalize
;
57 bt_component_class_source_query_method query
;
58 bt_component_class_source_output_port_connected_method output_port_connected
;
62 struct bt_component_class_filter
{
63 struct bt_component_class_with_iterator_class parent
;
65 bt_component_class_filter_get_supported_mip_versions_method get_supported_mip_versions
;
66 bt_component_class_filter_initialize_method init
;
67 bt_component_class_filter_finalize_method finalize
;
68 bt_component_class_filter_query_method query
;
69 bt_component_class_filter_input_port_connected_method input_port_connected
;
70 bt_component_class_filter_output_port_connected_method output_port_connected
;
74 struct bt_component_class_sink
{
75 struct bt_component_class parent
;
77 bt_component_class_sink_get_supported_mip_versions_method get_supported_mip_versions
;
78 bt_component_class_sink_initialize_method init
;
79 bt_component_class_sink_finalize_method finalize
;
80 bt_component_class_sink_query_method query
;
81 bt_component_class_sink_input_port_connected_method input_port_connected
;
82 bt_component_class_sink_graph_is_configured_method graph_is_configured
;
83 bt_component_class_sink_consume_method consume
;
88 void bt_component_class_add_destroy_listener(struct bt_component_class
*class,
89 bt_component_class_destroy_listener_func func
, void *data
);
92 void _bt_component_class_freeze(
93 const struct bt_component_class
*component_class
);
96 # define bt_component_class_freeze _bt_component_class_freeze
98 # define bt_component_class_freeze(_cc)
102 const char *bt_component_class_type_string(enum bt_component_class_type type
)
105 case BT_COMPONENT_CLASS_TYPE_SOURCE
:
107 case BT_COMPONENT_CLASS_TYPE_SINK
:
109 case BT_COMPONENT_CLASS_TYPE_FILTER
:
117 bool bt_component_class_has_message_iterator_class(
118 struct bt_component_class
*component_class
)
120 return component_class
->type
== BT_COMPONENT_CLASS_TYPE_SOURCE
||
121 component_class
->type
== BT_COMPONENT_CLASS_TYPE_FILTER
;
124 #endif /* BABELTRACE_GRAPH_COMPONENT_CLASS_INTERNAL_H */