| 1 | /* |
| 2 | * Copyright (c) 2023 Simon Marchi <simon.marchi@efficios.com> |
| 3 | * Copyright (c) 2023 Philippe Proulx <pproulx@efficios.com> |
| 4 | * |
| 5 | * SPDX-License-Identifier: MIT |
| 6 | */ |
| 7 | |
| 8 | #ifndef BABELTRACE_CPP_COMMON_BT2_PLUGIN_DEV_HPP |
| 9 | #define BABELTRACE_CPP_COMMON_BT2_PLUGIN_DEV_HPP |
| 10 | |
| 11 | #include <babeltrace2/babeltrace.h> |
| 12 | |
| 13 | #include "internal/comp-cls-bridge.hpp" /* IWYU pragma: keep */ |
| 14 | |
| 15 | #define BT_CPP_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(_pluginId, _componentClassId, _name, \ |
| 16 | _userComponentClass) \ |
| 17 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID( \ |
| 18 | _pluginId, _componentClassId, _name, \ |
| 19 | bt2::internal::MsgIterClsBridge<_userComponentClass::MessageIterator>::next); \ |
| 20 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_INITIALIZE_METHOD_WITH_ID( \ |
| 21 | _pluginId, _componentClassId, bt2::internal::SrcCompClsBridge<_userComponentClass>::init); \ |
| 22 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_FINALIZE_METHOD_WITH_ID( \ |
| 23 | _pluginId, _componentClassId, \ |
| 24 | bt2::internal::SrcCompClsBridge<_userComponentClass>::finalize); \ |
| 25 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_GET_SUPPORTED_MIP_VERSIONS_METHOD_WITH_ID( \ |
| 26 | _pluginId, _componentClassId, \ |
| 27 | bt2::internal::SrcCompClsBridge<_userComponentClass>::getSupportedMipVersions); \ |
| 28 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_OUTPUT_PORT_CONNECTED_METHOD_WITH_ID( \ |
| 29 | _pluginId, _componentClassId, \ |
| 30 | bt2::internal::SrcCompClsBridge<_userComponentClass>::outputPortConnected); \ |
| 31 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_QUERY_METHOD_WITH_ID( \ |
| 32 | _pluginId, _componentClassId, \ |
| 33 | bt2::internal::SrcCompClsBridge<_userComponentClass>::query); \ |
| 34 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_WITH_ID( \ |
| 35 | _pluginId, _componentClassId, \ |
| 36 | bt2::internal::MsgIterClsBridge<_userComponentClass::MessageIterator>::init); \ |
| 37 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_FINALIZE_METHOD_WITH_ID( \ |
| 38 | _pluginId, _componentClassId, \ |
| 39 | bt2::internal::MsgIterClsBridge<_userComponentClass::MessageIterator>::finalize); \ |
| 40 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_SEEK_BEGINNING_METHODS_WITH_ID( \ |
| 41 | _pluginId, _componentClassId, \ |
| 42 | bt2::internal::MsgIterClsBridge<_userComponentClass::MessageIterator>::seekBeginning, \ |
| 43 | bt2::internal::MsgIterClsBridge<_userComponentClass::MessageIterator>::canSeekBeginning); \ |
| 44 | BT_PLUGIN_SOURCE_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_SEEK_NS_FROM_ORIGIN_METHODS_WITH_ID( \ |
| 45 | _pluginId, _componentClassId, \ |
| 46 | bt2::internal::MsgIterClsBridge<_userComponentClass::MessageIterator>::seekNsFromOrigin, \ |
| 47 | bt2::internal::MsgIterClsBridge< \ |
| 48 | _userComponentClass::MessageIterator>::canSeekNsFromOrigin); |
| 49 | |
| 50 | #define BT_CPP_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID(_pluginId, _componentClassId, _name, \ |
| 51 | _userComponentClass) \ |
| 52 | BT_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID( \ |
| 53 | _pluginId, _componentClassId, _name, \ |
| 54 | bt2::internal::MsgIterClsBridge<_userComponentClass::MessageIterator>::next); \ |
| 55 | BT_PLUGIN_FILTER_COMPONENT_CLASS_INITIALIZE_METHOD_WITH_ID( \ |
| 56 | _pluginId, _componentClassId, bt2::internal::FltCompClsBridge<_userComponentClass>::init); \ |
| 57 | BT_PLUGIN_FILTER_COMPONENT_CLASS_FINALIZE_METHOD_WITH_ID( \ |
| 58 | _pluginId, _componentClassId, \ |
| 59 | bt2::internal::FltCompClsBridge<_userComponentClass>::finalize); \ |
| 60 | BT_PLUGIN_FILTER_COMPONENT_CLASS_GET_SUPPORTED_MIP_VERSIONS_METHOD_WITH_ID( \ |
| 61 | _pluginId, _componentClassId, \ |
| 62 | bt2::internal::FltCompClsBridge<_userComponentClass>::getSupportedMipVersions); \ |
| 63 | BT_PLUGIN_FILTER_COMPONENT_CLASS_INPUT_PORT_CONNECTED_METHOD_WITH_ID( \ |
| 64 | _pluginId, _componentClassId, \ |
| 65 | bt2::internal::FltCompClsBridge<_userComponentClass>::inputPortConnected); \ |
| 66 | BT_PLUGIN_FILTER_COMPONENT_CLASS_OUTPUT_PORT_CONNECTED_METHOD_WITH_ID( \ |
| 67 | _pluginId, _componentClassId, \ |
| 68 | bt2::internal::FltCompClsBridge<_userComponentClass>::outputPortConnected); \ |
| 69 | BT_PLUGIN_FILTER_COMPONENT_CLASS_QUERY_METHOD_WITH_ID( \ |
| 70 | _pluginId, _componentClassId, \ |
| 71 | bt2::internal::FltCompClsBridge<_userComponentClass>::query); \ |
| 72 | BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_INITIALIZE_METHOD_WITH_ID( \ |
| 73 | _pluginId, _componentClassId, \ |
| 74 | bt2::internal::MsgIterClsBridge<_userComponentClass::MessageIterator>::init); \ |
| 75 | BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_FINALIZE_METHOD_WITH_ID( \ |
| 76 | _pluginId, _componentClassId, \ |
| 77 | bt2::internal::MsgIterClsBridge<_userComponentClass::MessageIterator>::finalize); \ |
| 78 | BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_SEEK_BEGINNING_METHODS_WITH_ID( \ |
| 79 | _pluginId, _componentClassId, \ |
| 80 | bt2::internal::MsgIterClsBridge<_userComponentClass::MessageIterator>::seekBeginning, \ |
| 81 | bt2::internal::MsgIterClsBridge<_userComponentClass::MessageIterator>::canSeekBeginning); \ |
| 82 | BT_PLUGIN_FILTER_COMPONENT_CLASS_MESSAGE_ITERATOR_CLASS_SEEK_NS_FROM_ORIGIN_METHODS_WITH_ID( \ |
| 83 | _pluginId, _componentClassId, \ |
| 84 | bt2::internal::MsgIterClsBridge<_userComponentClass::MessageIterator>::seekNsFromOrigin, \ |
| 85 | bt2::internal::MsgIterClsBridge< \ |
| 86 | _userComponentClass::MessageIterator>::canSeekNsFromOrigin); |
| 87 | |
| 88 | #define BT_CPP_PLUGIN_SINK_COMPONENT_CLASS_WITH_ID(_pluginId, _componentClassId, _name, \ |
| 89 | _userComponentClass) \ |
| 90 | BT_PLUGIN_SINK_COMPONENT_CLASS_WITH_ID( \ |
| 91 | _pluginId, _componentClassId, _name, \ |
| 92 | bt2::internal::SinkCompClsBridge<_userComponentClass>::consume); \ |
| 93 | BT_PLUGIN_SINK_COMPONENT_CLASS_INITIALIZE_METHOD_WITH_ID( \ |
| 94 | _pluginId, _componentClassId, \ |
| 95 | bt2::internal::SinkCompClsBridge<_userComponentClass>::init); \ |
| 96 | BT_PLUGIN_SINK_COMPONENT_CLASS_FINALIZE_METHOD_WITH_ID( \ |
| 97 | _pluginId, _componentClassId, \ |
| 98 | bt2::internal::SinkCompClsBridge<_userComponentClass>::finalize); \ |
| 99 | BT_PLUGIN_SINK_COMPONENT_CLASS_GET_SUPPORTED_MIP_VERSIONS_METHOD_WITH_ID( \ |
| 100 | _pluginId, _componentClassId, \ |
| 101 | bt2::internal::SinkCompClsBridge<_userComponentClass>::getSupportedMipVersions); \ |
| 102 | BT_PLUGIN_SINK_COMPONENT_CLASS_INPUT_PORT_CONNECTED_METHOD_WITH_ID( \ |
| 103 | _pluginId, _componentClassId, \ |
| 104 | bt2::internal::SinkCompClsBridge<_userComponentClass>::inputPortConnected); \ |
| 105 | BT_PLUGIN_SINK_COMPONENT_CLASS_GRAPH_IS_CONFIGURED_METHOD_WITH_ID( \ |
| 106 | _pluginId, _componentClassId, \ |
| 107 | bt2::internal::SinkCompClsBridge<_userComponentClass>::graphIsConfigured); \ |
| 108 | BT_PLUGIN_SINK_COMPONENT_CLASS_QUERY_METHOD_WITH_ID( \ |
| 109 | _pluginId, _componentClassId, \ |
| 110 | bt2::internal::SinkCompClsBridge<_userComponentClass>::query); |
| 111 | |
| 112 | #define BT_CPP_PLUGIN_SOURCE_COMPONENT_CLASS(_name, _userComponentClass) \ |
| 113 | BT_CPP_PLUGIN_SOURCE_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _userComponentClass) |
| 114 | |
| 115 | #define BT_CPP_PLUGIN_FILTER_COMPONENT_CLASS(_name, _userComponentClass) \ |
| 116 | BT_CPP_PLUGIN_FILTER_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _userComponentClass) |
| 117 | |
| 118 | #define BT_CPP_PLUGIN_SINK_COMPONENT_CLASS(_name, _userComponentClass) \ |
| 119 | BT_CPP_PLUGIN_SINK_COMPONENT_CLASS_WITH_ID(auto, _name, #_name, _userComponentClass) |
| 120 | |
| 121 | #endif /* BABELTRACE_CPP_COMMON_BT2_PLUGIN_DEV_HPP */ |