plugin  0.1.0
source.hpp
1 /*
2  ____
3  / ___| ___ _ _ _ __ ___ ___
4  \___ \ / _ \| | | | '__/ __/ _ \
5  ___) | (_) | |_| | | | (_| __/
6  |____/ \___/ \__,_|_| \___\___|
7 
8 Base class for source 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 
41 template <typename Tout = std::vector<double>>
42 class Source {
43 public:
44  Source() : _error("No error") , _blob_format("none") {}
45  virtual ~Source() {}
46 
55  virtual std::string kind() = 0;
56 
66  virtual return_type get_output(Tout *out, std::vector<unsigned char> *blob = nullptr) = 0;
67 
68 
78  virtual void set_params(void *params){};
79 
88  virtual std::map<std::string, std::string> info() = 0;
89 
97  std::string error() { return _error; }
98 
102  std::string blob_format() { return _blob_format; }
103 
107  bool dummy;
108 
109 
110  static const int version = 2;
111  static const std::string server_name() { return "SourceServer"; }
112 
113 protected:
114  std::string _blob_format;
115  std::string _error;
116 };
117 
118 #ifndef HAVE_MAIN
119 #include <pugg/Driver.h>
120 
122 template <typename Tout = std::vector<double>>
123 class SourceDriver : public pugg::Driver {
124 public:
125  SourceDriver(std::string name, int version)
126  : pugg::Driver(Source<Tout>::server_name(), name, version) {}
127  virtual Source<Tout> *create() = 0;
128 };
130 
131 #endif
132 
133 #endif // FILTER_HPP
Definition: source.hpp:42
std::string blob_format()
Definition: source.hpp:102
bool dummy
Definition: source.hpp:107
virtual std::map< std::string, std::string > info()=0
virtual void set_params(void *params)
Definition: source.hpp:78
virtual return_type get_output(Tout *out, std::vector< unsigned char > *blob=nullptr)=0
std::string error()
Definition: source.hpp:97
virtual std::string kind()=0
Common definitions for the pugg library.
return_type
The return type of common interface functions.
Definition: common.hpp:52