13#ifndef RTCTK_COMPONENTFRAMEWORK_PATTERNGENERATION_HPP
14#define RTCTK_COMPONENTFRAMEWORK_PATTERNGENERATION_HPP
39template <
typename InputIter,
typename T,
typename U>
40constexpr void GenerateRamp(InputIter begin, InputIter end, T offset, U slope) {
41 typename std::iterator_traits<InputIter>::value_type counter = offset;
42 typename std::iterator_traits<InputIter>::value_type delta = slope;
43 auto generator = [&counter, delta]() {
48 std::generate(begin, end, generator);
86template <
typename InputIter,
typename T>
89 using C =
typename std::iterator_traits<InputIter>::value_type;
90 if constexpr (IS_COMPLEX_TYPE<C>) {
91 typename C::value_type cast_offset = offset;
92 if (sample_id % 2 == 0) {
93 GenerateRamp(begin, end, C(cast_offset, cast_offset + 1), C(+2, +2));
95 GenerateRamp(begin, end, C(-cast_offset, -cast_offset - 1), C(-2, -2));
97 }
else if constexpr (std::is_signed_v<C>) {
98 C cast_offset = offset;
99 if (sample_id % 2 == 0) {
105 C cast_offset = offset;
106 if (sample_id % 2 == 0) {
109 GenerateRamp(begin, end, std::numeric_limits<C>::max() - cast_offset, -1);
Definition: commandReplier.cpp:22
constexpr void GenerateRamp(InputIter begin, InputIter end, T offset, U slope)
Generates a ramp of values.
Definition: patternGeneration.hpp:40
constexpr void GenerateAlternatingRamp(InputIter begin, InputIter end, std::uint32_t sample_id, T offset)
Generates a ramp of values alternating on the sample ID.
Definition: patternGeneration.hpp:88
Provides useful mechanisms to test various type traits.