plugin  0.1.0
All Classes Files Functions Variables Enumerations Macros Pages
filter.hpp
1 /*
2  _____ _ _ _
3  | ___(_) | |_ ___ _ __
4  | |_ | | | __/ _ \ '__|
5  | _| | | | || __/ |
6  |_| |_|_|\__\___|_|
7 
8 Base class for filter plugins
9 */
10 #ifndef FILTER_HPP
11 #define FILTER_HPP
12 
13 #include <iostream>
14 #include <string>
15 #include <vector>
16 #include <map>
17 #include "common.hpp"
18 
19 #ifdef _WIN32
20 #define EXPORTIT __declspec(dllexport)
21 #else
22 #define EXPORTIT
23 #endif
24 
42 template <typename Tin = std::vector<double>,
43  typename Tout = std::vector<double>>
44 class Filter {
45 public:
46  Filter() : _error("No error"), dummy(false) {}
47  virtual ~Filter() {}
48 
57  virtual std::string kind() = 0;
58 
68  virtual return_type load_data(Tin &data) = 0;
69 
79  virtual return_type process(Tout *out) = 0;
80 
90  virtual void set_params(void *params){};
91 
100  virtual std::map<std::string, std::string> info() = 0;
101 
109  std::string error() { return _error; }
110 
114  bool dummy = false;
115 
119  static const int version = 2;
120 
124  static const std::string server_name() { return "FilterServer"; }
125 
126 private:
127  std::string _error;
128 };
129 
130 #ifndef HAVE_MAIN
131 #include <pugg/Driver.h>
132 
134 template <typename Tin = std::vector<double>,
135  typename Tout = std::vector<double>>
136 class FilterDriver : public pugg::Driver {
137 public:
138  FilterDriver(std::string name, int version)
139  : pugg::Driver(Filter<Tin, Tout>::server_name(), name, version) {}
140  virtual Filter<Tin, Tout> *create() = 0;
141 };
142 // @endcond
143 
144 #endif
145 
146 #endif // FILTER_HPP
Definition: filter.hpp:44
virtual return_type load_data(Tin &data)=0
bool dummy
Definition: filter.hpp:114
std::string error()
Definition: filter.hpp:109
static const int version
Definition: filter.hpp:119
virtual std::string kind()=0
static const std::string server_name()
Definition: filter.hpp:124
virtual return_type process(Tout *out)=0
virtual void set_params(void *params)
Definition: filter.hpp:90
virtual std::map< std::string, std::string > info()=0
Common definitions for the pugg library.
return_type
The return type of common interface functions.
Definition: common.hpp:52