Move request pipe setup into separate function
[ardour.git] / libs / audiographer / audiographer / sink.h
1 #ifndef AUDIOGRAPHER_SINK_H
2 #define AUDIOGRAPHER_SINK_H
3
4 #include <boost/shared_ptr.hpp>
5
6 #include "process_context.h"
7
8 namespace AudioGrapher
9 {
10
11 /** A sink for data
12   * This is a pure virtual interface for all data sinks in AudioGrapher
13   */
14 template <typename T>
15 class Sink  {
16   public:
17         virtual ~Sink () {}
18         
19         /** Process given data.
20           * The data can not be modified, so in-place processing is not allowed.
21           * At least this function must be implemented by deriving classes
22           */
23         virtual void process (ProcessContext<T> const & context) = 0;
24         
25         /** Process given data
26           * Data may be modified, so in place processing is allowed.
27           * The default implementation calls the non-modifying version,
28           * so this function does not need to be overriden.
29           * However, if the sink can do in-place processing,
30           * overriding this is highly recommended.
31           *
32           * If this is not overridden adding "using Sink<T>::process;"
33           * to the deriving class declaration is suggested to avoid
34           * warnings about hidden virtual functions.
35           */
36         inline virtual void process (ProcessContext<T> & context)
37         {
38                 this->process (static_cast<ProcessContext<T> const &> (context));
39         }
40 };
41
42 } // namespace
43
44 #endif // AUDIOGRAPHER_SINK_H
45