Sink.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2009 by Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // dspsr/Kernel/Classes/dsp/Sink.h
10 
11 #ifndef __dsp_Sink_h
12 #define __dsp_Sink_h
13 
14 #include "dsp/Operation.h"
15 #include "dsp/HasInput.h"
16 
17 namespace dsp {
18 
20  template <class In>
21  class Sink : public Operation, public HasInput<In>
22  {
23 
24  public:
25 
27  Sink (const char* _name) : Operation (_name) { }
28 
30  ~Sink () { }
31 
33  void set_cerr (std::ostream& os) const
34  {
36  if (this->input)
37  this->input->set_cerr(os);
38  }
39 
40  protected:
41 
43  virtual void operation ();
44 
46  virtual void calculation () = 0;
47  };
48 
49 }
50 
52 template <class In>
54 {
55 #if 0
56  if (buffering_policy)
57  buffering_policy -> pre_transformation ();
58 #endif
59 
60  calculation ();
61 
62 #if 0
63  if (buffering_policy)
64  buffering_policy -> post_transformation ();
65 #endif
66 }
67 catch (Error& error)
68 {
69  throw error += "dsp::Sink[" + name + "]::operation";
70 }
71 
72 #endif
Contains all Baseband Data Reduction Library classes.
Definition: ASCIIObservation.h:17
virtual void operation()
Define the Operation pure virtual method.
Definition: Sink.h:53
Operation(const char *name)
All sub-classes must specify a unique name.
Definition: Operation.C:46
virtual void calculation()=0
Declare that sub-classes must define a transformation method.
Sink(const char *_name)
All sub-classes must specify name and capacity for inplace operation.
Definition: Sink.h:37
~Sink()
Destructor.
Definition: Sink.h:40
virtual void set_cerr(std::ostream &) const
Reference::To< const In > input
Container from which input data will be read.
Definition: HasInput.h:49
void set_cerr(std::ostream &os) const
Set verbosity ostream.
Definition: Sink.h:43

Generated using doxygen 1.8.17