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