Line data Source code
1 : /** 2 : * \file WrapFilter.h 3 : */ 4 : 5 : #ifndef ATK_CORE_WRAPFILTER_H 6 : #define ATK_CORE_WRAPFILTER_H 7 : 8 : #include <ATK/Core/InPointerFilter.h> 9 : #include <ATK/Core/OutPointerFilter.h> 10 : #include <ATK/Core/PipelineGlobalSinkFilter.h> 11 : #include <ATK/Core/TypedBaseFilter.h> 12 : 13 : #include <vector> 14 : 15 : namespace ATK 16 : { 17 : /// Class that can be used to wrap a set of filters. 18 : template <typename DataType_, typename DataType__ = DataType_> 19 : class ATK_CORE_EXPORT WrapFilter final: public TypedBaseFilter<DataType_, DataType__> 20 : { 21 : protected: 22 : /// Simplify parent calls 23 : using Parent = TypedBaseFilter<DataType_, DataType__>; 24 : using Parent::converted_inputs; 25 : using Parent::get_input_sampling_rate; 26 : using Parent::get_output_sampling_rate; 27 : using Parent::outputs; 28 : using Parent::process_conditionnally; 29 : using Parent::reset; 30 : 31 : public: 32 : /// Constructor of the wrapper 33 : WrapFilter(gsl::index nb_input_ports, 34 : gsl::index nb_output_ports, 35 : const std::function<void(std::vector<InPointerFilter<DataType_>>& inputFilters, 36 : std::vector<OutPointerFilter<DataType__>>& outputFilters, 37 : std::vector<gsl::unique_ptr<BaseFilter>>& filters)>& fun); 38 : /// destructor 39 3 : ~WrapFilter() override = default; 40 : 41 : void full_setup() override; 42 : 43 : /// Dry run the internal filters 44 : void dry_run(gsl::index size); 45 : 46 : protected: 47 : void process_impl(gsl::index size) const final; 48 : 49 : mutable std::vector<InPointerFilter<DataType_>> inputFilters; 50 : mutable std::vector<OutPointerFilter<DataType__>> outputFilters; 51 : /// List of filters in this wrapped filters 52 : std::vector<gsl::unique_ptr<BaseFilter>> filters; 53 : mutable PipelineGlobalSinkFilter sink; 54 : }; 55 : } // namespace ATK 56 : 57 : #endif