Midge  v3.9.2
Data Processing Framework
_output.hh
Go to the documentation of this file.
1 #ifndef _midge__output_hh_
2 #define _midge__output_hh_
3 
4 #include "midge_error.hh"
5 #include "_stream.hh"
6 #include "output.hh"
7 
8 namespace midge
9 {
10 
11  template< class x_node, class x_type >
12  class _output :
13  public output
14  {
15  public:
16  _output( x_node* p_node, _stream< x_type >* (x_node::*p_member)() ) :
17  f_node( p_node ),
18  f_member( p_member )
19  {
20  }
21  virtual ~_output()
22  {
23  }
24 
25  public:
26  stream* get()
27  {
28  _stream< x_type >* t_typed_stream = (f_node->*f_member)();
29  stream* t_stream = dynamic_cast< stream* >( t_typed_stream );
30  if( t_stream == NULL )
31  {
32  throw error() << "output <" << get_name() << "> on node <" << f_node->get_name() << "> cannot cast stream up from specific type";
33  }
34 
35  return t_stream;
36  }
37 
38  private:
39  x_node* f_node;
40  _stream< x_type >* (x_node::*f_member)();
41  };
42 
43 }
44 
45 #endif
virtual ~_output()
Definition: _output.hh:21
Definition: _buffer.hh:11
x_node * f_node
Definition: _output.hh:39
_output(x_node *p_node, _stream< x_type > *(x_node::*p_member)())
Definition: _output.hh:16
_stream< x_type > *(x_node::* f_member)()
Definition: _output.hh:40