24 #ifndef PSS_ASTROTYPES_SIGPROC_DATAFACTORY_H
25 #define PSS_ASTROTYPES_SIGPROC_DATAFACTORY_H
35 namespace astrotypes {
80 template<
typename DataT,
typename AdapterT>
101 template<Header::DataType DataType, std::
size_t nifs, std::
size_t nbits>
104 template<std::
size_t nifs, std::
size_t nbits>
110 template<std::
size_t nifs, std::
size_t nbits>
116 template<Header::DataType DataType,
bool Dummy=true>
131 template<Header::DataType DataType,
unsigned Nifs,
unsigned Nbits=8>
132 struct BitsRuntimeMap {
133 template<
typename... Args>
135 void exec(
unsigned number_of_bits, Args&&... args) {
136 if(number_of_bits != Nbits) BitsRuntimeMap<DataType, Nifs, BitToUnsignedInt<Nbits>::next>
::exec(number_of_bits, std::forward<Args>(args)...);
141 >>
::exec(std::forward<Args>(args)...);
145 template<Header::DataType DataType,
unsigned Nifs>
146 struct BitsRuntimeMap<DataType, Nifs, 0> {
147 template<
typename... Args>
149 void exec(
unsigned number_of_bits, Args&&...) {
150 static const std::string err(std::string(
"number of bits not supported: "));
151 throw std::runtime_error(std::string(err + std::to_string(number_of_bits)));
155 template<Header::DataType DataType,
unsigned N=1>
156 struct NifsRuntimeMap {
157 template<
typename... Args>
159 void exec(
unsigned nifs,
unsigned number_of_bits, Args&&... args) {
160 if(nifs != N) NifsRuntimeMap<DataType, N+1>::exec(nifs, number_of_bits, std::forward<Args>(args)...);
161 BitsRuntimeMap<DataType, N>::exec(number_of_bits, std::forward<Args>(args)...);
165 template<Header::DataType DataType>
166 struct NifsRuntimeMap<DataType, DataFactoryTraits::MaxNifs + 1> {
167 template<
typename... Args>
169 void exec(
unsigned,
unsigned, Args&&...) {
170 static const std::string err(std::string(
"max nifs supported=") + std::to_string(DataFactoryTraits::MaxNifs));
171 throw std::runtime_error(err);
176 template<
typename... Args>
189 throw std::runtime_error(
"sigproc: unsupported data type");
198 #endif // PSS_ASTROTYPES_SIGPROC_DATAFACTORY_H
A template class representing values associated with a time and frequecny such as Stokes values or vo...
A template class representing values associated with a time and frequecny such as Stokes values or vo...
Determines the static data type from a set of runtime parmmeters Once determined a user provided temp...
static void exec(Header const &h, Args &&...args)