Refactor the component class and component API
[babeltrace.git] / include / babeltrace / plugin / plugin-dev.h
1 #ifndef BABELTRACE_PLUGIN_PLUGIN_DEV_H
2 #define BABELTRACE_PLUGIN_PLUGIN_DEV_H
3
4 /*
5 * BabelTrace - Babeltrace Plug-in Development API
6 *
7 * This is the header that you need to include for the development of
8 * a Babeltrace plug-in.
9 *
10 * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
11 * Copyright 2017 Philippe Proulx <pproulx@efficios.com>
12 *
13 * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
14 *
15 * Permission is hereby granted, free of charge, to any person obtaining a copy
16 * of this software and associated documentation files (the "Software"), to deal
17 * in the Software without restriction, including without limitation the rights
18 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19 * copies of the Software, and to permit persons to whom the Software is
20 * furnished to do so, subject to the following conditions:
21 *
22 * The above copyright notice and this permission notice shall be included in
23 * all copies or substantial portions of the Software.
24 *
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31 * SOFTWARE.
32 */
33
34 #include <stdint.h>
35 #include <babeltrace/plugin/plugin.h>
36 #include <babeltrace/component/component-class.h>
37 #include <babeltrace/component/component-class-source.h>
38 #include <babeltrace/component/component-class-filter.h>
39 #include <babeltrace/component/component-class-sink.h>
40
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44
45 /*
46 * Plugin interface's version, not synced with Babeltrace's version
47 * (internal use).
48 */
49 #define __BT_PLUGIN_VERSION_MAJOR 1
50 #define __BT_PLUGIN_VERSION_MINOR 0
51
52 /* Plugin initialization function type */
53 typedef enum bt_plugin_status (*bt_plugin_init_func)(
54 struct bt_plugin *plugin);
55
56 /* Plugin exit function type */
57 typedef enum bt_plugin_status (*bt_plugin_exit_func)(void);
58
59 /*
60 * Function to call from a plugin's initialization function to add a
61 * component class to a plugin object.
62 */
63 extern enum bt_plugin_status bt_plugin_add_component_class(
64 struct bt_plugin *plugin,
65 struct bt_component_class *component_class);
66
67 /* Plugin descriptor: describes a single plugin (internal use) */
68 struct __bt_plugin_descriptor {
69 /* Plugin's interface major version number */
70 uint32_t major;
71
72 /* Plugin's interface minor version number */
73 uint32_t minor;
74
75 /* Plugin's name */
76 const char *name;
77 } __attribute__((packed));
78
79 /* Type of a plugin attribute (internal use) */
80 enum __bt_plugin_descriptor_attribute_type {
81 BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_INIT = 0,
82 BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_EXIT = 1,
83 BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_AUTHOR = 2,
84 BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_LICENSE = 3,
85 BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION = 4,
86 };
87
88 /* Plugin attribute (internal use) */
89 struct __bt_plugin_descriptor_attribute {
90 /* Plugin descriptor to which to associate this attribute */
91 const struct __bt_plugin_descriptor *plugin_descriptor;
92
93 /* Attribute's type */
94 enum __bt_plugin_descriptor_attribute_type type;
95
96 /* Name of the attribute's type for debug purposes */
97 const char *type_name;
98
99 /* Attribute's value (depends on attribute's type) */
100 union {
101 /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_INIT */
102 bt_plugin_init_func init;
103
104 /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_EXIT */
105 bt_plugin_exit_func exit;
106
107 /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_AUTHOR */
108 const char *author;
109
110 /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_LICENSE */
111 const char *license;
112
113 /* BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION */
114 const char *description;
115 } value;
116 } __attribute__((packed));
117
118 /* Component class descriptor (internal use) */
119 struct __bt_plugin_component_class_descriptor {
120 /*
121 * Plugin descriptor to which to associate this component
122 * class descriptor.
123 */
124 const struct __bt_plugin_descriptor *plugin_descriptor;
125
126 /* Component class type */
127 enum bt_component_class_type type;
128
129 /* Component class name */
130 const char *name;
131
132 /* Mandatory methods (depends on component class type) */
133 union {
134 /* BT_COMPONENT_CLASS_TYPE_SOURCE */
135 struct {
136 bt_component_class_source_init_iterator_method init_iterator;
137 } source;
138
139 /* BT_COMPONENT_CLASS_TYPE_FILTER */
140 struct {
141 bt_component_class_filter_init_iterator_method init_iterator;
142 } filter;
143
144 /* BT_COMPONENT_CLASS_TYPE_SINK */
145 struct {
146 bt_component_class_sink_consume_method consume;
147 } sink;
148 } methods;
149 } __attribute__((packed));
150
151 /* Type of a component class attribute (internal use) */
152 enum __bt_plugin_component_class_descriptor_attribute_type {
153 BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION = 0,
154 BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD = 1,
155 BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD = 2,
156 BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_FILTER_ADD_ITERATOR_METHOD = 3,
157 BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_SINK_ADD_ITERATOR_METHOD = 4,
158 };
159
160 /* Component class attribute (internal use) */
161 struct __bt_plugin_component_class_descriptor_attribute {
162 /*
163 * Component class plugin attribute to which to associate this
164 * component class attribute.
165 */
166 const struct __bt_plugin_component_class_descriptor *comp_class_descriptor;
167
168 /* Attribute's type */
169 enum __bt_plugin_component_class_descriptor_attribute_type type;
170
171 /* Name of the attribute's type for debug purposes */
172 const char *type_name;
173
174 /* Attribute's value (depends on attribute's type) */
175 union {
176 /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION */
177 const char *description;
178
179 /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD */
180 bt_component_class_init_method init_method;
181
182 /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD */
183 bt_component_class_destroy_method destroy_method;
184
185 /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_FILTER_ADD_ITERATOR_METHOD */
186 bt_component_class_filter_add_iterator_method filter_add_iterator_method;
187
188 /* BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_SINK_ADD_ITERATOR_METHOD */
189 bt_component_class_sink_add_iterator_method sink_add_iterator_method;
190 } value;
191 } __attribute__((packed));
192
193 /*
194 * Variable attributes for a plugin descriptor pointer to be added to
195 * the plugin descriptor section (internal use).
196 */
197 #define __BT_PLUGIN_DESCRIPTOR_ATTRS \
198 __attribute__((section("__bt_plugin_descriptors"), used))
199
200 /*
201 * Variable attributes for a plugin attribute pointer to be added to
202 * the plugin attribute section (internal use).
203 */
204 #define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_ATTRS \
205 __attribute__((section("__bt_plugin_descriptor_attributes"), used))
206
207 /*
208 * Variable attributes for a component class descriptor pointer to be
209 * added to the component class descriptor section (internal use).
210 */
211 #define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS \
212 __attribute__((section("__bt_plugin_component_class_descriptors"), used))
213
214 /*
215 * Variable attributes for a component class descriptor attribute
216 * pointer to be added to the component class descriptor attribute
217 * section (internal use).
218 */
219 #define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_ATTRS \
220 __attribute__((section("__bt_plugin_component_class_descriptor_attributes"), used))
221
222 /*
223 * Declares a plugin descriptor pointer variable with a custom ID.
224 *
225 * _id: ID (any valid C identifier except `auto`).
226 */
227 #define BT_PLUGIN_DECLARE(_id) extern struct __bt_plugin_descriptor __bt_plugin_descriptor_##_id
228
229 /*
230 * Defines a plugin descriptor with a custom ID.
231 *
232 * _id: ID (any valid C identifier except `auto`).
233 * _name: Plugin's name (C string).
234 */
235 #define BT_PLUGIN_WITH_ID(_id, _name) \
236 struct __bt_plugin_descriptor __bt_plugin_descriptor_##_id = { \
237 .major = __BT_PLUGIN_VERSION_MAJOR, \
238 .minor = __BT_PLUGIN_VERSION_MINOR, \
239 .name = _name, \
240 }; \
241 static struct __bt_plugin_descriptor const * const __bt_plugin_descriptor_##_id##_ptr __BT_PLUGIN_DESCRIPTOR_ATTRS = &__bt_plugin_descriptor_##_id; \
242 extern struct __bt_plugin_descriptor const *__start___bt_plugin_descriptors; \
243 extern struct __bt_plugin_descriptor const *__stop___bt_plugin_descriptors
244
245 /*
246 * Defines a plugin attribute (generic, internal use).
247 *
248 * _attr_name: Name of the attribute (C identifier).
249 * _attr_type: Type of the attribute (enum __bt_plugin_descriptor_attribute_type).
250 * _id: Plugin descriptor ID (C identifier).
251 * _x: Value.
252 */
253 #define __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(_attr_name, _attr_type, _id, _x) \
254 static struct __bt_plugin_descriptor_attribute __bt_plugin_descriptor_attribute_##_id##_##_attr_name = { \
255 .plugin_descriptor = &__bt_plugin_descriptor_##_id, \
256 .type = _attr_type, \
257 .type_name = #_attr_name, \
258 .value._attr_name = _x, \
259 }; \
260 static struct __bt_plugin_descriptor_attribute const * const __bt_plugin_descriptor_attribute_##_id##_##_attr_name##_ptr __BT_PLUGIN_DESCRIPTOR_ATTRIBUTES_ATTRS = &__bt_plugin_descriptor_attribute_##_id##_##_attr_name; \
261 extern struct __bt_plugin_descriptor_attribute const *__start___bt_plugin_descriptor_attributes; \
262 extern struct __bt_plugin_descriptor_attribute const *__stop___bt_plugin_descriptor_attributes
263
264 /*
265 * Defines a plugin initialization function attribute attached to a
266 * specific plugin descriptor.
267 *
268 * _id: Plugin descriptor ID (C identifier).
269 * _x: Initialization function (bt_plugin_init_func).
270 */
271 #define BT_PLUGIN_INIT_WITH_ID(_id, _x) \
272 __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(init, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_INIT, _id, _x)
273
274 /*
275 * Defines a plugin exit function attribute attached to a specific
276 * plugin descriptor.
277 *
278 * _id: Plugin descriptor ID (C identifier).
279 * _x: Exit function (bt_plugin_exit_func).
280 */
281 #define BT_PLUGIN_EXIT_WITH_ID(_id, _x) \
282 __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(exit, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_EXIT, _id, _x)
283
284 /*
285 * Defines an author attribute attached to a specific plugin descriptor.
286 *
287 * _id: Plugin descriptor ID (C identifier).
288 * _x: Author (C string).
289 */
290 #define BT_PLUGIN_AUTHOR_WITH_ID(_id, _x) \
291 __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(author, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_AUTHOR, _id, _x)
292
293 /*
294 * Defines a license attribute attached to a specific plugin descriptor.
295 *
296 * _id: Plugin descriptor ID (C identifier).
297 * _x: License (C string).
298 */
299 #define BT_PLUGIN_LICENSE_WITH_ID(_id, _x) \
300 __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(license, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_LICENSE, _id, _x)
301
302 /*
303 * Defines a description attribute attached to a specific plugin
304 * descriptor.
305 *
306 * _id: Plugin descriptor ID (C identifier).
307 * _x: Description (C string).
308 */
309 #define BT_PLUGIN_DESCRIPTION_WITH_ID(_id, _x) \
310 __BT_PLUGIN_DESCRIPTOR_ATTRIBUTE(description, BT_PLUGIN_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION, _id, _x)
311
312 /*
313 * Declaration of start and stop symbols of component class descriptors
314 * section.
315 */
316 #define __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP \
317 extern struct __bt_plugin_component_class_descriptor const *__start___bt_plugin_component_class_descriptors; \
318 extern struct __bt_plugin_component_class_descriptor const *__stop___bt_plugin_component_class_descriptors
319
320 /*
321 * Defines a source component class descriptor with a custom ID.
322 *
323 * _id: ID (any valid C identifier except `auto`).
324 * _comp_class_id: Component class ID (C identifier).
325 * _name: Component class name (C string).
326 * _init_iterator_method: Component class's iterator initialization method
327 * (bt_component_class_source_init_iterator_method).
328 */
329 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _init_iterator_method) \
330 static struct __bt_plugin_component_class_descriptor __bt_plugin_source_component_class_descriptor_##_id##_##_comp_class_id = { \
331 .plugin_descriptor = &__bt_plugin_descriptor_##_id, \
332 .type = BT_COMPONENT_CLASS_TYPE_SOURCE, \
333 .name = _name, \
334 .methods.source = { \
335 .init_iterator = _init_iterator_method, \
336 }, \
337 }; \
338 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; \
339 __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP
340
341 /*
342 * Defines a filter component class descriptor with a custom ID.
343 *
344 * _id: ID (any valid C identifier except `auto`).
345 * _comp_class_id: Component class ID (C identifier).
346 * _name: Component class name (C string).
347 * _init_iterator_method: Component class's iterator initialization method
348 * (bt_component_class_filter_init_iterator_method).
349 */
350 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _init_iterator_method) \
351 static struct __bt_plugin_component_class_descriptor __bt_plugin_filter_component_class_descriptor_##_id##_##_comp_class_id = { \
352 .plugin_descriptor = &__bt_plugin_descriptor_##_id, \
353 .type = BT_COMPONENT_CLASS_TYPE_FILTER, \
354 .name = _name, \
355 .methods.filter = { \
356 .init_iterator = _init_iterator_method, \
357 }, \
358 }; \
359 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; \
360 __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP
361
362 /*
363 * Defines a sink component class descriptor with a custom ID.
364 *
365 * _id: ID (any valid C identifier except `auto`).
366 * _comp_class_id: Component class ID (C identifier).
367 * _name: Component class name (C string).
368 * _consume_method: Component class's iterator consume method
369 * (bt_component_class_sink_consume_method).
370 */
371 #define BT_PLUGIN_SINK_COMPONENT_CLASS_WITH_ID(_id, _comp_class_id, _name, _consume_method) \
372 static struct __bt_plugin_component_class_descriptor __bt_plugin_sink_component_class_descriptor_##_id##_##_comp_class_id = { \
373 .plugin_descriptor = &__bt_plugin_descriptor_##_id, \
374 .type = BT_COMPONENT_CLASS_TYPE_SINK, \
375 .name = _name, \
376 .methods.sink = { \
377 .consume = _consume_method, \
378 }, \
379 }; \
380 static struct __bt_plugin_component_class_descriptor const * const __bt_plugin_sink_component_class_descriptor_##_id##_##_comp_class_id##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRS = &__bt_plugin_sink_component_class_descriptor_##_id##_##_comp_class_id; \
381 __BT_PLUGIN_DECL_COMPONENT_CLASS_DESCRIPTORS_SECTION_START_STOP
382
383 /*
384 * Defines a component class descriptor attribute (generic, internal
385 * use).
386 *
387 * _id: Plugin descriptor ID (C identifier).
388 * _comp_class_id: Component class ID (C identifier).
389 * _type: Component class type (`source`, `filter`, or `sink`).
390 * _attr_name: Name of the attribute (C identifier).
391 * _attr_type: Type of the attribute
392 * (enum __bt_plugin_descriptor_attribute_type).
393 * _x: Value.
394 */
395 #define __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(_attr_name, _attr_type, _id, _comp_class_id, _type, _x) \
396 static struct __bt_plugin_component_class_descriptor_attribute __bt_plugin_##_type##_component_class_descriptor_attribute_##_id##_##_comp_class_id##_##_attr_name = { \
397 .comp_class_descriptor = &__bt_plugin_##_type##_component_class_descriptor_##_id##_##_comp_class_id, \
398 .type = _attr_type, \
399 .type_name = #_attr_name, \
400 .value._attr_name = _x, \
401 }; \
402 static struct __bt_plugin_component_class_descriptor_attribute const * const __bt_plugin_##_type##_component_class_descriptor_attribute_##_id##_##_comp_class_id##_##_attr_name##_ptr __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTES_ATTRS = &__bt_plugin_##_type##_component_class_descriptor_attribute_##_id##_##_comp_class_id##_##_attr_name; \
403 extern struct __bt_plugin_component_class_descriptor_attribute const *__start___bt_plugin_component_class_descriptor_attributes; \
404 extern struct __bt_plugin_component_class_descriptor_attribute const *__stop___bt_plugin_component_class_descriptor_attributes
405
406 /*
407 * Defines a description attribute attached to a specific source
408 * component class descriptor.
409 *
410 * _id: Plugin descriptor ID (C identifier).
411 * _comp_class_id: Component class descriptor ID (C identifier).
412 * _x: Description (C string).
413 */
414 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION_WITH_ID(_id, _comp_class_id, _x) \
415 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(description, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION, _id, _comp_class_id, source, _x)
416
417 /*
418 * Defines a description attribute attached to a specific filter
419 * component class descriptor.
420 *
421 * _id: Plugin descriptor ID (C identifier).
422 * _comp_class_id: Component class descriptor ID (C identifier).
423 * _x: Description (C string).
424 */
425 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION_WITH_ID(_id, _comp_class_id, _x) \
426 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(description, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION, _id, _comp_class_id, filter, _x)
427
428 /*
429 * Defines a description attribute attached to a specific sink
430 * component class descriptor.
431 *
432 * _id: Plugin descriptor ID (C identifier).
433 * _comp_class_id: Component class descriptor ID (C identifier).
434 * _x: Description (C string).
435 */
436 #define BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION_WITH_ID(_id, _comp_class_id, _x) \
437 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(description, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESCRIPTION, _id, _comp_class_id, sink, _x)
438
439 /*
440 * Defines an initialization method attribute attached to a specific
441 * source component class descriptor.
442 *
443 * _id: Plugin descriptor ID (C identifier).
444 * _comp_class_id: Component class descriptor ID (C identifier).
445 * _x: Initialization method (bt_component_class_init_method).
446 */
447 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \
448 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD, _id, _comp_class_id, source, _x)
449
450 /*
451 * Defines an initialization method attribute attached to a specific
452 * filter component class descriptor.
453 *
454 * _id: Plugin descriptor ID (C identifier).
455 * _comp_class_id: Component class descriptor ID (C identifier).
456 * _x: Initialization method (bt_component_class_init_method).
457 */
458 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \
459 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD, _id, _comp_class_id, filter, _x)
460
461 /*
462 * Defines an initialization method attribute attached to a specific
463 * sink component class descriptor.
464 *
465 * _id: Plugin descriptor ID (C identifier).
466 * _comp_class_id: Component class descriptor ID (C identifier).
467 * _x: Initialization method (bt_component_class_init_method).
468 */
469 #define BT_PLUGIN_SINK_COMPONENT_CLASS_INIT_METHOD_WITH_ID(_id, _comp_class_id, _x) \
470 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(init_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_INIT_METHOD, _id, _comp_class_id, sink, _x)
471
472 /*
473 * Defines a destroy method attribute attached to a specific source
474 * component class descriptor.
475 *
476 * _id: Plugin descriptor ID (C identifier).
477 * _comp_class_id: Component class descriptor ID (C identifier).
478 * _x: Destroy method (bt_component_class_destroy_method).
479 */
480 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(_id, _comp_class_id, _x) \
481 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(destroy_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD, _id, _comp_class_id, source, _x)
482
483 /*
484 * Defines a destroy method attribute attached to a specific filter
485 * component class descriptor.
486 *
487 * _id: Plugin descriptor ID (C identifier).
488 * _comp_class_id: Component class descriptor ID (C identifier).
489 * _x: Destroy method (bt_component_class_destroy_method).
490 */
491 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(_id, _comp_class_id, _x) \
492 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(destroy_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD, _id, _comp_class_id, filter, _x)
493
494 /*
495 * Defines a destroy method attribute attached to a specific sink
496 * component class descriptor.
497 *
498 * _id: Plugin descriptor ID (C identifier).
499 * _comp_class_id: Component class descriptor ID (C identifier).
500 * _x: Destroy method (bt_component_class_destroy_method).
501 */
502 #define BT_PLUGIN_SINK_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(_id, _comp_class_id, _x) \
503 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(destroy_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_DESTROY_METHOD, _id, _comp_class_id, sink, _x)
504
505 /*
506 * Defines an add iterator method attribute attached to a specific
507 * filter component class descriptor.
508 *
509 * _id: Plugin descriptor ID (C identifier).
510 * _comp_class_id: Component class descriptor ID (C identifier).
511 * _x: Add iterator method
512 * (bt_component_class_filter_add_iterator_method).
513 */
514 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_ADD_ITERATOR_METHOD_WITH_ID(_id, _comp_class_id, _x) \
515 __BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE(filter_add_iterator_method, BT_PLUGIN_COMPONENT_CLASS_DESCRIPTOR_ATTRIBUTE_TYPE_FILTER_ADD_ITERATOR_METHOD, _id, _comp_class_id, filter, _x)
516
517 /*
518 * Defines an add iterator method attribute attached to a specific
519 * sink component class descriptor.
520 *
521 * _id: Plugin descriptor ID (C identifier).
522 * _comp_class_id: Component class descriptor ID (C identifier).
523 * _x: Add iterator method
524 * (bt_component_class_sink_add_iterator_method).
525 */
526 #define BT_PLUGIN_SINK_COMPONENT_CLASS_ADD_ITERATOR_METHOD_WITH_ID(_id, _comp_class_id, _x) \
527 __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)
528
529 /*
530 * Defines a plugin descriptor with an automatic ID.
531 *
532 * _name: Plugin's name (C string).
533 */
534 #define BT_PLUGIN(_name) static BT_PLUGIN_WITH_ID(auto, #_name)
535
536 /*
537 * Defines a plugin initialization function attribute attached to the
538 * automatic plugin descriptor.
539 *
540 * _x: Initialization function (bt_plugin_init_func).
541 */
542 #define BT_PLUGIN_INIT(_x) BT_PLUGIN_INIT_WITH_ID(auto, _x)
543
544 /*
545 * Defines a plugin exit function attribute attached to the automatic
546 * plugin descriptor.
547 *
548 * _x: Exit function (bt_plugin_exit_func).
549 */
550 #define BT_PLUGIN_EXIT(_x) BT_PLUGIN_EXIT_WITH_ID(auto, _x)
551
552 /*
553 * Defines an author attribute attached to the automatic plugin
554 * descriptor.
555 *
556 * _x: Author (C string).
557 */
558 #define BT_PLUGIN_AUTHOR(_x) BT_PLUGIN_AUTHOR_WITH_ID(auto, _x)
559
560 /*
561 * Defines a license attribute attached to the automatic plugin
562 * descriptor.
563 *
564 * _x: License (C string).
565 */
566 #define BT_PLUGIN_LICENSE(_x) BT_PLUGIN_LICENSE_WITH_ID(auto, _x)
567
568 /*
569 * Defines a description attribute attached to the automatic plugin
570 * descriptor.
571 *
572 * _x: Description (C string).
573 */
574 #define BT_PLUGIN_DESCRIPTION(_x) BT_PLUGIN_DESCRIPTION_WITH_ID(auto, _x)
575
576 /*
577 * Defines a source component class attached to the automatic plugin
578 * descriptor. Its ID is the same as its name, hence its name must be a
579 * C identifier in this version.
580 *
581 * _name: Component class name (C identifier).
582 * _init_iterator_method: Component class's iterator initialization method
583 * (bt_component_class_source_init_iterator_method).
584 */
585 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS(_name, _init_iterator_method) \
586 BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _init_iterator_method)
587
588 /*
589 * Defines a filter component class attached to the automatic plugin
590 * descriptor. Its ID is the same as its name, hence its name must be a
591 * C identifier in this version.
592 *
593 * _name: Component class name (C identifier).
594 * _init_iterator_method: Component class's iterator initialization method
595 * (bt_component_class_filter_init_iterator_method).
596 */
597 #define BT_PLUGIN_FILTER_COMPONENT_CLASS(_name, _init_iterator_method) \
598 BT_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _init_iterator_method)
599
600 /*
601 * Defines a sink component class attached to the automatic plugin
602 * descriptor. Its ID is the same as its name, hence its name must be a
603 * C identifier in this version.
604 *
605 * _name: Component class name (C identifier).
606 * _consume_method: Component class's consume method
607 * (bt_component_class_sink_consume_method).
608 */
609 #define BT_PLUGIN_SINK_COMPONENT_CLASS(_name, _consume_method) \
610 BT_PLUGIN_SINK_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _consume_method)
611
612 /*
613 * Defines a description attribute attached to a source component class
614 * descriptor which is attached to the automatic plugin descriptor.
615 *
616 * _name: Component class name (C identifier).
617 * _x: Description (C string).
618 */
619 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION(_name, _x) \
620 BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESCRIPTION_WITH_ID(auto, _name, _x)
621
622 /*
623 * Defines a description attribute attached to a filter component class
624 * descriptor which is attached to the automatic plugin descriptor.
625 *
626 * _name: Component class name (C identifier).
627 * _x: Description (C string).
628 */
629 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION(_name, _x) \
630 BT_PLUGIN_FILTER_COMPONENT_CLASS_DESCRIPTION_WITH_ID(auto, _name, _x)
631
632 /*
633 * Defines a description attribute attached to a sink component class
634 * descriptor which is attached to the automatic plugin descriptor.
635 *
636 * _name: Component class name (C identifier).
637 * _x: Description (C string).
638 */
639 #define BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION(_name, _x) \
640 BT_PLUGIN_SINK_COMPONENT_CLASS_DESCRIPTION_WITH_ID(auto, _name, _x)
641
642 /*
643 * Defines an initialization method attribute attached to a source
644 * component class descriptor which is attached to the automatic plugin
645 * descriptor.
646 *
647 * _name: Component class name (C identifier).
648 * _x: Initialization method (bt_component_class_init_method).
649 */
650 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_INIT_METHOD(_name, _x) \
651 BT_PLUGIN_SOURCE_COMPONENT_CLASS_INIT_METHOD_WITH_ID(auto, _name, _x)
652
653 /*
654 * Defines an initialization method attribute attached to a filter
655 * component class descriptor which is attached to the automatic plugin
656 * descriptor.
657 *
658 * _name: Component class name (C identifier).
659 * _x: Initialization method (bt_component_class_init_method).
660 */
661 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_INIT_METHOD(_name, _x) \
662 BT_PLUGIN_FILTER_COMPONENT_CLASS_INIT_METHOD_WITH_ID(auto, _name, _x)
663
664 /*
665 * Defines an initialization method attribute attached to a sink
666 * component class descriptor which is attached to the automatic plugin
667 * descriptor.
668 *
669 * _name: Component class name (C identifier).
670 * _x: Initialization method (bt_component_class_init_method).
671 */
672 #define BT_PLUGIN_SINK_COMPONENT_CLASS_INIT_METHOD(_name, _x) \
673 BT_PLUGIN_SINK_COMPONENT_CLASS_INIT_METHOD_WITH_ID(auto, _name, _x)
674
675 /*
676 * Defines a destroy method attribute attached to a source component
677 * class descriptor which is attached to the automatic plugin
678 * descriptor.
679 *
680 * _name: Component class name (C identifier).
681 * _x: Initialization method (bt_component_class_destroy_method).
682 */
683 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESTROY_METHOD(_name, _x) \
684 BT_PLUGIN_SOURCE_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(auto, _name, _x)
685
686 /*
687 * Defines a destroy method attribute attached to a filter component
688 * class descriptor which is attached to the automatic plugin
689 * descriptor.
690 *
691 * _name: Component class name (C identifier).
692 * _x: Initialization method (bt_component_class_destroy_method).
693 */
694 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_DESTROY_METHOD(_name, _x) \
695 BT_PLUGIN_FILTER_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(auto, _name, _x)
696
697 /*
698 * Defines a destroy method attribute attached to a sink component class
699 * descriptor which is attached to the automatic plugin descriptor.
700 *
701 * _name: Component class name (C identifier).
702 * _x: Initialization method (bt_component_class_destroy_method).
703 */
704 #define BT_PLUGIN_SINK_COMPONENT_CLASS_DESTROY_METHOD(_name, _x) \
705 BT_PLUGIN_SINK_COMPONENT_CLASS_DESTROY_METHOD_WITH_ID(auto, _name, _x)
706
707 /*
708 * Defines an add iterator method attribute attached to a filter
709 * component class descriptor which is attached to the automatic plugin
710 * descriptor.
711 *
712 * _name: Component class name (C identifier).
713 * _x: Add iterator method (bt_component_class_filter_add_iterator_method).
714 */
715 #define BT_PLUGIN_FILTER_COMPONENT_CLASS_ADD_ITERATOR_METHOD(_name, _x) \
716 BT_PLUGIN_FILTER_COMPONENT_CLASS_ADD_ITERATOR_METHOD_WITH_ID(auto, _name, _x)
717
718 /*
719 * Defines an add iterator method attribute attached to a sink
720 * component class descriptor which is attached to the automatic plugin
721 * descriptor.
722 *
723 * _name: Component class name (C identifier).
724 * _x: Add iterator method (bt_component_class_sink_add_iterator_method).
725 */
726 #define BT_PLUGIN_SINK_COMPONENT_CLASS_ADD_ITERATOR_METHOD(_name, _x) \
727 BT_PLUGIN_SINK_COMPONENT_CLASS_ADD_ITERATOR_METHOD_WITH_ID(auto, _name, _x)
728
729 #ifdef __cplusplus
730 }
731 #endif
732
733 #endif /* BABELTRACE_PLUGIN_PLUGIN_DEV_H */
This page took 0.046534 seconds and 4 git commands to generate.