3 #ifndef VISR_LIBRBBL_FFT_WRAPPER_FACTORY_HPP_INCLUDED 4 #define VISR_LIBRBBL_FFT_WRAPPER_FACTORY_HPP_INCLUDED 12 #include <boost/algorithm/string.hpp> 13 #include <boost/function.hpp> 21 template<
typename SampleType>
29 template<
typename SampleType>
40 static std::unique_ptr<FftWrapperBase<SampleType> >
41 create( std::string
const & wrapperName, std::size_t fftSize, std::size_t alignElements );
46 template<
class FftWrapper >
47 static void registerWrapper( std::string
const & wrapperName );
53 static std::string listImplementations();
58 using CreateFunction = boost::function< FftWrapperBase<SampleType>* ( std::size_t, std::size_t ) >;
60 explicit Creator( CreateFunction fcn );
62 std::unique_ptr< FftWrapperBase<SampleType> > create( std::size_t fftSize,
63 std::size_t alignElements)
const;
65 CreateFunction mCreateFunction;
68 template<
class WrapperType >
69 class TCreator:
public Creator
73 : Creator( &TCreator<WrapperType>::construct )
77 static WrapperType* construct( std::size_t fftSize, std::size_t alignmentElement )
79 return new WrapperType( fftSize, alignmentElement );
83 using CreatorTable = std::map<std::string, Creator >;
85 static CreatorTable & creatorTable();
93 template<
typename SampleType >
94 template<
class WrapperType >
97 std::string lowerName(wrapperName);
98 boost::algorithm::to_lower(lowerName);
99 creatorTable().insert( std::make_pair( lowerName,
100 TCreator<WrapperType>() ) );
106 #endif // #ifndef VISR_LIBRBBL_FFT_WRAPPER_FACTORY_HPP_INCLUDED Definition: fft_wrapper_factory.hpp:30
Definition: options.cpp:10
static void registerWrapper(std::string const &wrapperName)
Definition: fft_wrapper_factory.hpp:95