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;
23 PluginFunctionRep *_rep;
43 virtual void eval(
Tuple &retval,
Tuple &args) = 0;
47 typedef PluginRegistryInfo<PluginFunction> PluginFunctionRegistryInfo;
49 void SB_EXPORT plugin_function_callback(
const PluginFunctionRegistryInfo &info);
52 struct PluginRegistryCallback<PluginFunctionRegistryInfo> {
53 void operator()(
const PluginFunctionRegistryInfo &info)
55 plugin_function_callback(info);
59 typedef PluginRegistryCallback<PluginFunctionRegistryInfo> PluginFunctionRegistryCallback;
61 typedef PluginRegistry<PluginFunction,
62 PluginFunctionRegistryInfo,
63 PluginFunctionRegistryCallback> PluginFunctionRegistry;
68 #ifndef STREAMBASE_PLUGIN_VERSION_DEFINED
69 #define STREAMBASE_PLUGIN_VERSION_DEFINED
71 extern "C" __declspec( dllexport ) inline const
char*streambase_plugin_version() {
return ((
char *)&StreamBaseVersion::INFO_LINE);}
74 class SB_EXPORT PluginRegistryFunction {
76 static bool Add(PluginRegistry<PluginFunction, PluginRegistryInfo<PluginFunction>, PluginRegistryCallback< PluginRegistryInfo<PluginFunction> > >::Info* streambase_plugin_info) {
77 return (PluginRegistry<PluginFunction>::get().add(*streambase_plugin_info),
true);
81 #define STREAMBASE_DEFINE_PLUGIN_FUNCTION(ClassName, FuncName) \
82 const SimplePluginRegistryInfo<PluginFunction, ClassName> ClassName::_streambase_plugin_info(FuncName); \
83 bool ClassName::_streambase_plugin_registered= \
84 PluginRegistryFunction::Add((PluginRegistryInfo<PluginFunction>*)&(ClassName::_streambase_plugin_info));
86 #define STREAMBASE_DECLARE_PLUGIN_FUNCTION(ClassName) \
88 static const SimplePluginRegistryInfo<PluginFunction, ClassName> _streambase_plugin_info; \
89 static bool _streambase_plugin_registered;
92 #define STREAMBASE_DECLARE_PLUGIN_FUNCTION(ClassName) \
93 STREAMBASE_DECLARE_PLUGIN_REG_CLASS(PluginFunction, ClassName)
95 #define STREAMBASE_DEFINE_PLUGIN_FUNCTION(ClassName, FuncName) \
96 STREAMBASE_DEFINE_PLUGIN_REG_CLASS_WITH_KEY(PluginFunction, ClassName, FuncName)
99 #endif // !defined(DOXYGEN_SKIP)
102 #endif //PLUGIN_FUNCTION_H