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