rt-vamp-plugin-sdk  0.3.1
Real-time Vamp plugin SDK for C++20
EntryPoint.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "vamp/vamp.h"
4 
6 #include "rtvamp/pluginsdk/detail/PluginAdapter.hpp"
7 
8 namespace rtvamp::pluginsdk {
9 
24 template <detail::IsPlugin... Plugins>
25 class EntryPoint {
26 public:
27  static constexpr const VampPluginDescriptor* getDescriptor(
28  unsigned int version,
29  unsigned int index
30  ) {
31  if (version < 1 || version > VAMP_API_VERSION) return {};
32  if (index >= pluginCount) return {};
33  return descriptors[index];
34  }
35 
36 private:
37  static constexpr auto pluginCount = sizeof...(Plugins);
38 
39  static constexpr std::array<const VampPluginDescriptor*, pluginCount> descriptors{
40  {detail::PluginAdapter<Plugins>::getDescriptor()...}
41  };
42 };
43 
44 } // namespace rtvamp::pluginsdk
45 
46 /* -------------------------------------------- Macro ------------------------------------------- */
47 
56 #ifdef _MSC_VER
57  #define RTVAMP_EXPORT_FUNCTION \
58  __pragma(comment(linker, "/EXPORT:" __FUNCTION__"=" __FUNCDNAME__))
59 #else
60  #define RTVAMP_EXPORT_FUNCTION
61 #endif
62 
66 #define RTVAMP_ENTRY_POINT(...) \
67  extern "C" const VampPluginDescriptor* vampGetPluginDescriptor( \
68  unsigned int hostApiVersion, \
69  unsigned int index \
70  ) { \
71  RTVAMP_EXPORT_FUNCTION \
72  return ::rtvamp::pluginsdk::EntryPoint<__VA_ARGS__>::getDescriptor(hostApiVersion, index); \
73  }
Plugin.hpp
rtvamp::pluginsdk::EntryPoint::getDescriptor
static constexpr const VampPluginDescriptor * getDescriptor(unsigned int version, unsigned int index)
Definition: EntryPoint.hpp:27
VampPluginDescriptor
_VampPluginDescriptor VampPluginDescriptor
Definition: PluginHostAdapter.hpp:13
rtvamp::pluginsdk
Definition: EntryPoint.hpp:8
rtvamp::pluginsdk::EntryPoint
Helper class to create the entry point for plugin libraries.
Definition: EntryPoint.hpp:25