summaryrefslogtreecommitdiff
path: root/libs/audiographer/audiographer/sink.h
blob: b1e5605206d98f40e5e89841447db85889ddfa88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef AUDIOGRAPHER_SINK_H
#define AUDIOGRAPHER_SINK_H

#include <boost/shared_ptr.hpp>

#include "process_context.h"

#include "audiographer/visibility.h"

namespace AudioGrapher
{

/** A sink for data
  * This is a pure virtual interface for all data sinks in AudioGrapher
  */
template <typename T>
class /*LIBAUDIOGRAPHER_API*/ Sink  {
  public:
	virtual ~Sink () {}
	
	/** Process given data.
	  * The data can not be modified, so in-place processing is not allowed.
	  * At least this function must be implemented by deriving classes
	  */
	virtual void process (ProcessContext<T> const & context) = 0;
	
	/** Process given data
	  * Data may be modified, so in place processing is allowed.
	  * The default implementation calls the non-modifying version,
	  * so this function does not need to be overridden.
	  * However, if the sink can do in-place processing,
	  * overriding this is highly recommended.
	  *
	  * If this is not overridden adding "using Sink<T>::process;"
	  * to the deriving class declaration is suggested to avoid
	  * warnings about hidden virtual functions.
	  */
	inline virtual void process (ProcessContext<T> & context)
	{
		this->process (static_cast<ProcessContext<T> const &> (context));
	}
};

} // namespace

#endif // AUDIOGRAPHER_SINK_H