mf
Media Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
filter_node.h
Go to the documentation of this file.
1 #ifndef MF_FLOW_FILTER_NODE_H_
2 #define MF_FLOW_FILTER_NODE_H_
3 
4 #include "node.h"
5 #include <memory>
6 #include <utility>
7 
8 namespace mf { namespace flow {
9 
10 class filter;
11 class graph;
12 class node_job;
13 
15 class filter_node : public node {
16 private:
17  std::unique_ptr<filter> filter_;
18 
19 protected:
20  void setup_filter();
22  void process_filter(node_job&);
23 
24 
25 public:
26  filter_node(graph& gr);
27  ~filter_node();
28 
29  template<typename Filter, typename... Args>
30  Filter& set_filter(Args&&... args) {
31  Filter* filter = new Filter(*this, std::forward<Args>(args)...);
32  filter_.reset(filter);
33  return *filter;
34  }
35 
36  filter& this_filter() { return *filter_; }
37  const filter& this_filter() const { return *filter_; }
38 
39  virtual node_input& add_input(time_unit past_window, time_unit future_window) = 0;
40  virtual node_output& add_output(const frame_format& format) = 0;
41 };
42 
43 }}
44 
45 #endif
Input port of node in flow graph.
Definition: node.h:166
Output port of node in flow graph.
Definition: node.h:108
filter_node(graph &gr)
Definition: filter_node.cc:6
const filter & this_filter() const
Definition: filter_node.h:37
std::ptrdiff_t time_unit
Discrete time unit type.
Definition: common.h:52
void process_filter(node_job &)
Definition: filter_node.cc:20
Node in flow graph, base class.
Definition: node.h:19
~filter_node()
Definition: filter_node.cc:8
void setup_filter()
Definition: filter_node.cc:10
Filter which performs concrete processing, base class.
Definition: filter.h:15
Node which delegates concrete frame processing to associated filter object.
Definition: filter_node.h:15
void pre_process_filter(node_job &)
Definition: filter_node.cc:15
filter & this_filter()
Definition: filter_node.h:36
virtual node_input & add_input(time_unit past_window, time_unit future_window)=0
Work unit of flow graph node.
Definition: node_job.h:13
virtual node_output & add_output(const frame_format &format)=0
Filter & set_filter(Args &&...args)
Definition: filter_node.h:30
Graph containing interconnected nodes through which media frames flow.
Definition: graph.h:23
Format information of type-erased frame of ndarray_view_generic.
Definition: frame_format.h:14