| 1 | #ifndef BABELTRACE_GRAPH_COMPONENT_CLASS_SOURCE_H |
| 2 | #define BABELTRACE_GRAPH_COMPONENT_CLASS_SOURCE_H |
| 3 | |
| 4 | /* |
| 5 | * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com> |
| 6 | * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com> |
| 7 | * |
| 8 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 9 | * of this software and associated documentation files (the "Software"), to deal |
| 10 | * in the Software without restriction, including without limitation the rights |
| 11 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 12 | * copies of the Software, and to permit persons to whom the Software is |
| 13 | * furnished to do so, subject to the following conditions: |
| 14 | * |
| 15 | * The above copyright notice and this permission notice shall be included in |
| 16 | * all copies or substantial portions of the Software. |
| 17 | * |
| 18 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 21 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 22 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 23 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 24 | * SOFTWARE. |
| 25 | */ |
| 26 | |
| 27 | #include <stdint.h> |
| 28 | |
| 29 | /* For enum bt_notification_array_const */ |
| 30 | #include <babeltrace/graph/notification-const.h> |
| 31 | |
| 32 | /* For enum bt_self_component_status */ |
| 33 | #include <babeltrace/graph/self-component.h> |
| 34 | |
| 35 | /* For enum bt_self_notification_iterator_status */ |
| 36 | #include <babeltrace/graph/self-notification-iterator.h> |
| 37 | |
| 38 | /* For enum bt_query_status */ |
| 39 | #include <babeltrace/graph/component-class.h> |
| 40 | |
| 41 | #ifdef __cplusplus |
| 42 | extern "C" { |
| 43 | #endif |
| 44 | |
| 45 | struct bt_self_component_class_source; |
| 46 | struct bt_component_class_source; |
| 47 | struct bt_self_component_source; |
| 48 | struct bt_component_class_source; |
| 49 | struct bt_self_component_port_output; |
| 50 | struct bt_port_input; |
| 51 | struct bt_query_executor; |
| 52 | struct bt_value; |
| 53 | |
| 54 | typedef enum bt_self_component_status |
| 55 | (*bt_component_class_source_init_method)( |
| 56 | struct bt_self_component_source *self_component, |
| 57 | const struct bt_value *params, void *init_method_data); |
| 58 | |
| 59 | typedef void (*bt_component_class_source_finalize_method)( |
| 60 | struct bt_self_component_source *self_component); |
| 61 | |
| 62 | typedef enum bt_self_notification_iterator_status |
| 63 | (*bt_component_class_source_notification_iterator_init_method)( |
| 64 | struct bt_self_notification_iterator *notification_iterator, |
| 65 | struct bt_self_component_source *self_component, |
| 66 | struct bt_self_component_port_output *port); |
| 67 | |
| 68 | typedef void |
| 69 | (*bt_component_class_source_notification_iterator_finalize_method)( |
| 70 | struct bt_self_notification_iterator *notification_iterator); |
| 71 | |
| 72 | typedef enum bt_self_notification_iterator_status |
| 73 | (*bt_component_class_source_notification_iterator_next_method)( |
| 74 | struct bt_self_notification_iterator *notification_iterator, |
| 75 | bt_notification_array_const notifs, uint64_t capacity, |
| 76 | uint64_t *count); |
| 77 | |
| 78 | typedef enum bt_query_status |
| 79 | (*bt_component_class_source_query_method)( |
| 80 | struct bt_self_component_class_source *comp_class, |
| 81 | const struct bt_query_executor *query_executor, |
| 82 | const char *object, const struct bt_value *params, |
| 83 | const struct bt_value **result); |
| 84 | |
| 85 | typedef enum bt_self_component_status |
| 86 | (*bt_component_class_source_accept_output_port_connection_method)( |
| 87 | struct bt_self_component_source *self_component, |
| 88 | struct bt_self_component_port_output *self_port, |
| 89 | const struct bt_port_input *other_port); |
| 90 | |
| 91 | typedef enum bt_self_component_status |
| 92 | (*bt_component_class_source_output_port_connected_method)( |
| 93 | struct bt_self_component_source *self_component, |
| 94 | struct bt_self_component_port_output *self_port, |
| 95 | const struct bt_port_input *other_port); |
| 96 | |
| 97 | typedef void |
| 98 | (*bt_component_class_source_output_port_disconnected_method)( |
| 99 | struct bt_self_component_source *self_component, |
| 100 | struct bt_self_component_port_output *self_port); |
| 101 | |
| 102 | static inline |
| 103 | struct bt_component_class *bt_component_class_source_as_component_class( |
| 104 | struct bt_component_class_source *comp_cls_source) |
| 105 | { |
| 106 | return (void *) comp_cls_source; |
| 107 | } |
| 108 | |
| 109 | extern |
| 110 | struct bt_component_class_source *bt_component_class_source_create( |
| 111 | const char *name, |
| 112 | bt_component_class_source_notification_iterator_next_method method); |
| 113 | |
| 114 | extern int bt_component_class_source_set_init_method( |
| 115 | struct bt_component_class_source *comp_class, |
| 116 | bt_component_class_source_init_method method); |
| 117 | |
| 118 | extern int bt_component_class_source_set_finalize_method( |
| 119 | struct bt_component_class_source *comp_class, |
| 120 | bt_component_class_source_finalize_method method); |
| 121 | |
| 122 | extern int bt_component_class_source_set_accept_output_port_connection_method( |
| 123 | struct bt_component_class_source *comp_class, |
| 124 | bt_component_class_source_accept_output_port_connection_method method); |
| 125 | |
| 126 | extern int bt_component_class_source_set_output_port_connected_method( |
| 127 | struct bt_component_class_source *comp_class, |
| 128 | bt_component_class_source_output_port_connected_method method); |
| 129 | |
| 130 | extern int bt_component_class_source_set_output_port_disconnected_method( |
| 131 | struct bt_component_class_source *comp_class, |
| 132 | bt_component_class_source_output_port_disconnected_method method); |
| 133 | |
| 134 | extern int bt_component_class_source_set_query_method( |
| 135 | struct bt_component_class_source *comp_class, |
| 136 | bt_component_class_source_query_method method); |
| 137 | |
| 138 | extern int bt_component_class_source_set_notification_iterator_init_method( |
| 139 | struct bt_component_class_source *comp_class, |
| 140 | bt_component_class_source_notification_iterator_init_method method); |
| 141 | |
| 142 | extern int bt_component_class_source_set_notification_iterator_finalize_method( |
| 143 | struct bt_component_class_source *comp_class, |
| 144 | bt_component_class_source_notification_iterator_finalize_method method); |
| 145 | |
| 146 | #ifdef __cplusplus |
| 147 | } |
| 148 | #endif |
| 149 | |
| 150 | #endif /* BABELTRACE_GRAPH_COMPONENT_CLASS_SOURCE_H */ |