5 #ifndef STREAMBASE_PLUGIN_AGGREGATE_H
6 #define STREAMBASE_PLUGIN_AGGREGATE_H
8 #include "StreamBase.hpp"
9 #include "StreamBaseVersion.hpp"
12 #include "DataType.hpp"
13 #include "PluginException.hpp"
14 #include "PluginRegistry.hpp"
18 class PluginAggregateRep;
37 virtual void initialize() = 0;
41 virtual void increment(
const Tuple &args) = 0;
46 virtual void calculate(
Tuple &retval) = 0;
57 virtual std::string
save() {
return std::string(); }
61 virtual void load(std::string data) {}
64 typedef PluginRegistryInfo<PluginAggregate> PluginAggregateRegistryInfo;
66 void SB_EXPORT plugin_aggregate_callback(
const PluginAggregateRegistryInfo &info);
70 struct PluginRegistryCallback<PluginAggregateRegistryInfo> {
71 void operator()(
const PluginAggregateRegistryInfo &info)
73 plugin_aggregate_callback(info);
77 typedef PluginRegistryCallback<PluginAggregateRegistryInfo> PluginAggregateRegistryCallback;
79 typedef PluginRegistry<PluginAggregate,
80 PluginAggregateRegistryInfo,
81 PluginAggregateRegistryCallback> PluginAggregateRegistry;
85 #ifndef STREAMBASE_PLUGIN_VERSION_DEFINED
86 #define STREAMBASE_PLUGIN_VERSION_DEFINED
88 extern "C" __declspec( dllexport ) inline const
char*streambase_plugin_version() {
return ((
char *)&StreamBaseVersion::INFO_LINE);}
98 class SB_EXPORT PluginRegistryAggregate {
100 static bool Add(PluginRegistry<PluginAggregate, PluginRegistryInfo<PluginAggregate>, PluginRegistryCallback< PluginRegistryInfo<PluginAggregate> > >::Info* streambase_plugin_info) {
101 return (PluginRegistry<PluginAggregate>::get().add(*streambase_plugin_info),
true);
105 #define STREAMBASE_DEFINE_PLUGIN_AGGREGATE(ClassName, FuncName) \
106 const SimplePluginRegistryInfo<PluginAggregate, ClassName> ClassName::_streambase_plugin_info(FuncName); \
107 bool ClassName::_streambase_plugin_registered = \
108 PluginRegistryAggregate::Add((PluginRegistryInfo<PluginAggregate>*)&(ClassName::_streambase_plugin_info));
110 #define STREAMBASE_DECLARE_PLUGIN_AGGREGATE(ClassName) \
112 static const SimplePluginRegistryInfo<PluginAggregate, ClassName> _streambase_plugin_info; \
113 static bool _streambase_plugin_registered;
116 #define STREAMBASE_DECLARE_PLUGIN_AGGREGATE(ClassName) \
117 STREAMBASE_DECLARE_PLUGIN_REG_CLASS(PluginAggregate, ClassName)
119 #define STREAMBASE_DEFINE_PLUGIN_AGGREGATE(ClassName, FuncName) \
120 STREAMBASE_DEFINE_PLUGIN_REG_CLASS_WITH_KEY(PluginAggregate, ClassName, FuncName)
123 #endif // !defined(DOXYGEN_SKIP)
127 #endif //PLUGIN_AGGREGATE_H