30 #include <type_traits> 31 #include <unordered_set> 34 #include <pdi/pdi_fwd.h> 35 #include <pdi/logger.h> 56 virtual ~
Plugin() noexcept(
false);
65 #define PLUGIN_API_VERSION_MAJOR (0ul) 67 #define PLUGIN_API_VERSION_MINOR (0ul) 69 #define PLUGIN_API_VERSION_PATCH (1ul) 71 #define PLUGIN_API_VERSION ((PLUGIN_API_VERSION_MAJOR<<24) + (PLUGIN_API_VERSION_MINOR<<16) + (PLUGIN_API_VERSION_PATCH<<8)) 89 struct has_dependencies {
91 static constexpr decltype(C::dependencies(),
bool()) test(
int)
96 static constexpr
bool test(...)
100 static constexpr
bool value = test<T>(int());
109 typename std::enable_if<has_dependencies<T>::value, std::pair<std::unordered_set<std::string>, std::unordered_set<std::string>>>::type plugin_dependencies()
111 return T::dependencies();
120 typename std::enable_if<!has_dependencies<T>::value, std::pair<std::unordered_set<std::string>, std::unordered_set<std::string>>>::type plugin_dependencies()
144 #define PDI_PLUGIN(name)\ 145 _Pragma("clang diagnostic push")\ 146 _Pragma("clang diagnostic ignored \"-Wmissing-prototypes\"")\ 147 _Pragma("clang diagnostic ignored \"-Wreturn-type-c-linkage\"")\ 148 extern "C" ::std::unique_ptr<::PDI::Plugin> PDI_EXPORT PDI_plugin_##name##_loader(::PDI::Context& ctx, PC_tree_t conf) \ 150 auto plugin = ::std::unique_ptr<name##_plugin>{new name##_plugin{ctx, conf}};\ 151 ::PDI::plugin_api_version(PLUGIN_API_VERSION);\ 154 extern "C" ::std::pair<::std::unordered_set<::std::string>, ::std::unordered_set<::std::string>> PDI_EXPORT PDI_plugin_##name##_dependencies() \ 156 return ::plugin_dependencies<name##_plugin>();\ 158 _Pragma("clang diagnostic pop") 160 #endif // PDI_PLUGIN_H_
unsigned long plugin_api_version(unsigned long expected_version=0)
Checks compatibility with a plugin API.
The class PDI plugins should implement.
Definition: plugin.h:42
Definition: array_datatype.h:37