20 #ifndef __TPIE_PIPELINING_NUMERIC_H__
21 #define __TPIE_PIPELINING_NUMERIC_H__
24 #include <tpie/pipelining/node.h>
25 #include <tpie/pipelining/pipe_base.h>
26 #include <tpie/pipelining/factory_helpers.h>
31 template <
typename dest_t>
36 linear_t(dest_t dest, item_type factor, item_type term) : factor(factor), term(term), dest(std::move(dest)) {
38 set_name(
"Linear transform", PRIORITY_INSIGNIFICANT);
40 void push(
const item_type & item) {
41 dest.push(item*factor+term);
44 item_type factor, term;
48 template <
typename dest_t>
53 range_t(dest_t dest, item_type from, item_type to, item_type increment) : from(from), to(to), increment(increment), dest(std::move(dest)) {}
56 stream_size_type items = (from - to) / increment;
62 for (item_type i=from; i < to; i += increment) {
82 inline pipe_middle<factory<bits::linear_t, T, T> >
88 inline pipe_begin<factory<bits::range_t, T, T, T> >
89 range(T from, T to, T increment = 1) {
90 return factory<bits::range_t, T, T, T>(from, to, increment);
95 #endif //__TPIE_PIPELINING_NUMERIC_H__