5 #ifndef STREAMBASE_PLUGIN_FUNCTION_H
6 #define STREAMBASE_PLUGIN_FUNCTION_H
8 #include "StreamBase.hpp"
9 #include "StreamBaseVersion.hpp"
12 #include "DataType.hpp"
13 #include "PluginException.hpp"
14 #include "PluginRegistry.hpp"
18 class PluginFunctionRep;
40 virtual void eval(
Tuple &retval,
Tuple &args) = 0;
44 typedef PluginRegistryInfo<PluginFunction> PluginFunctionRegistryInfo;
46 void SB_EXPORT plugin_function_callback(
const PluginFunctionRegistryInfo &info);
49 struct PluginRegistryCallback<PluginFunctionRegistryInfo> {
50 void operator()(
const PluginFunctionRegistryInfo &info)
52 plugin_function_callback(info);
56 typedef PluginRegistryCallback<PluginFunctionRegistryInfo> PluginFunctionRegistryCallback;
58 typedef PluginRegistry<PluginFunction,
59 PluginFunctionRegistryInfo,
60 PluginFunctionRegistryCallback> PluginFunctionRegistry;
65 #ifndef STREAMBASE_PLUGIN_VERSION_DEFINED
66 #define STREAMBASE_PLUGIN_VERSION_DEFINED
68 extern "C" __declspec( dllexport ) inline const
char*streambase_plugin_version() {
return ((
char *)&StreamBaseVersion::INFO_LINE);}
71 class SB_EXPORT PluginRegistryFunction {
73 static bool Add(PluginRegistry<PluginFunction, PluginRegistryInfo<PluginFunction>, PluginRegistryCallback< PluginRegistryInfo<PluginFunction> > >::Info* streambase_plugin_info) {
74 return (PluginRegistry<PluginFunction>::get().add(*streambase_plugin_info),
true);
78 #define STREAMBASE_DEFINE_PLUGIN_FUNCTION(ClassName, FuncName) \
79 const SimplePluginRegistryInfo<PluginFunction, ClassName> ClassName::_streambase_plugin_info(FuncName); \
80 bool ClassName::_streambase_plugin_registered= \
81 PluginRegistryFunction::Add((PluginRegistryInfo<PluginFunction>*)&(ClassName::_streambase_plugin_info));
83 #define STREAMBASE_DECLARE_PLUGIN_FUNCTION(ClassName) \
85 static const SimplePluginRegistryInfo<PluginFunction, ClassName> _streambase_plugin_info; \
86 static bool _streambase_plugin_registered;
89 #define STREAMBASE_DECLARE_PLUGIN_FUNCTION(ClassName) \
90 STREAMBASE_DECLARE_PLUGIN_REG_CLASS(PluginFunction, ClassName)
92 #define STREAMBASE_DEFINE_PLUGIN_FUNCTION(ClassName, FuncName) \
93 STREAMBASE_DEFINE_PLUGIN_REG_CLASS_WITH_KEY(PluginFunction, ClassName, FuncName)
96 #endif // !defined(DOXYGEN_SKIP)
99 #endif //PLUGIN_FUNCTION_H