2013-08-08 09:54:33 +00:00
|
|
|
/*=============================================================================
|
2015-01-10 10:13:57 +00:00
|
|
|
Copyright (c) 2011-2015 Bolero MURAKAMI
|
2013-08-08 09:54:33 +00:00
|
|
|
https://github.com/bolero-MURAKAMI/Sprout
|
|
|
|
|
|
|
|
Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
=============================================================================*/
|
2013-02-01 11:21:01 +00:00
|
|
|
#ifndef SPROUT_ITERATOR_AMPLITUDE_SPECTRUM_ITERATOR_HPP
|
|
|
|
#define SPROUT_ITERATOR_AMPLITUDE_SPECTRUM_ITERATOR_HPP
|
|
|
|
|
|
|
|
#include <iterator>
|
|
|
|
#include <sprout/config.hpp>
|
|
|
|
#include <sprout/iterator/transform_iterator.hpp>
|
|
|
|
#include <sprout/numeric/dft/amplitude_spectrum_value.hpp>
|
|
|
|
|
|
|
|
namespace sprout {
|
|
|
|
//
|
|
|
|
// amplitude_value
|
|
|
|
//
|
2013-02-07 16:14:42 +00:00
|
|
|
template<typename T = void>
|
2013-02-01 11:21:01 +00:00
|
|
|
class amplitude_value {
|
|
|
|
public:
|
|
|
|
typedef typename T::value_type result_type;
|
|
|
|
typedef T argument_type;
|
|
|
|
public:
|
2013-02-07 16:14:42 +00:00
|
|
|
SPROUT_CONSTEXPR typename T::value_type
|
|
|
|
operator()(T const& value) const {
|
|
|
|
return sprout::amplitude_spectrum_value(value);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
template<>
|
|
|
|
class amplitude_value<void> {
|
|
|
|
public:
|
|
|
|
template<typename T>
|
|
|
|
SPROUT_CONSTEXPR typename T::value_type
|
|
|
|
operator()(T const& value) const {
|
2013-02-01 11:21:01 +00:00
|
|
|
return sprout::amplitude_spectrum_value(value);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
//
|
|
|
|
// make_amplitude_spectrum_iterator
|
|
|
|
//
|
|
|
|
template<typename Iterator>
|
|
|
|
inline SPROUT_CONSTEXPR sprout::transform_iterator<sprout::amplitude_value<typename std::iterator_traits<Iterator>::value_type>, Iterator>
|
|
|
|
make_amplitude_spectrum_iterator(Iterator it) {
|
|
|
|
return sprout::transform_iterator<sprout::amplitude_value<typename std::iterator_traits<Iterator>::value_type>, Iterator>(
|
|
|
|
it, sprout::amplitude_value<typename std::iterator_traits<Iterator>::value_type>()
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} // namespace sprout
|
|
|
|
|
|
|
|
#endif // #ifndef SPROUT_ITERATOR_AMPLITUDE_SPECTRUM_ITERATOR_HPP
|