Midge  v3.9.2
Data Processing Framework
transformer.hh
Go to the documentation of this file.
1 #ifndef _midge_transformer_hh_
2 #define _midge_transformer_hh_
3 
4 #include "_in.hh"
5 #include "_out.hh"
6 #include "node.hh"
7 #include "typeat.hh"
8 #include "typechain.hh"
9 
10 namespace midge
11 {
12 
13  class transformer :
14  virtual public node
15  {
16  protected:
17  transformer();
18 
19  public:
20  virtual ~transformer();
21  };
22 
23  template< class x_in_list, class x_out_list >
24  class _transformer;
25 
26  template< template<class...> class x_in_list, template<class...> class x_out_list, class... x_in_types, class... x_out_types >
27  class _transformer< x_in_list<x_in_types...>, x_out_list<x_out_types...> > :
28  public transformer,
29  public type_start_chain< _in< _type, _index >, x_in_types... >,
30  public type_start_chain< _out< _type, _index >, x_out_types... >
31  {
32  public:
33  using node::in;
34  using node::out;
35 
36  public:
37  _transformer();
38  virtual ~_transformer();
39 
40  protected:
41  template< int x_index >
42  _stream< type_at< x_index, x_in_types... > >& in_stream()
43  {
44  return this->_in< type_at< x_index, x_in_types... >, type_int< x_index > >::get_stream();
45  }
46 
47  template< int x_index >
48  _stream< type_at< x_index, x_out_types... > >& out_stream()
49  {
50  return this->_out< type_at< x_index, x_out_types... >, type_int< x_index > >::get_stream();
51  }
52 
53  template< int x_index >
54  _buffer< type_at< x_index, x_out_types... > >& out_buffer()
55  {
56  return this->_out< type_at< x_index, x_out_types... >, type_int< x_index > >::get_buffer();
57  }
58  };
59 
60  template< template<class...> class x_in_list, template<class...> class x_out_list, class... x_in_types, class... x_out_types >
61  _transformer< x_in_list<x_in_types...>, x_out_list<x_out_types...> >::_transformer() :
62  node(),
63  type_start_chain< _in< _type, _index >, x_in_types... >(),
64  type_start_chain< _out< _type, _index >, x_out_types... >()
65  {
66  }
67  template< template<class...> class x_in_list, template<class...> class x_out_list, class... x_in_types, class... x_out_types >
68  _transformer< x_in_list<x_in_types...>, x_out_list<x_out_types...> >::~_transformer()
69  {
70  }
71 
72 }
73 
74 #endif
Definition: _buffer.hh:11
typename type_at_impl< x_index, x_types... >::type type_at
Determines the type at position x_index within parameter pack x_types.
Definition: typeat.hh:34
_stream< type_at< x_index, x_out_types... > > & out_stream()
Definition: transformer.hh:48
input * in(const std::string &p_label)
Definition: node.cc:42
_buffer< type_at< x_index, x_out_types... > > & out_buffer()
Definition: transformer.hh:54
virtual ~transformer()
Definition: transformer.cc:11
Template prototype.
Definition: typechain.hh:45
The prototype class that gets replaced by a type.
Definition: typechain.hh:36
output * out(const std::string &p_label)
Definition: node.cc:52
std::integral_constant< int, x_value > type_int
Wraps integral constant x_value in a type; value is available as type_int::value. ...
Definition: typeint.hh:9
The prototype class that gets replaced by a type index (or rather the struct that wraps a type&#39;s inde...
Definition: typechain.hh:40