16 #ifndef GRPPI_COMMON_FARM_PATTERN_H
17 #define GRPPI_COMMON_FARM_PATTERN_H
19 #include <type_traits>
28 template <
typename Transformer>
39 farm_t(
int n, Transformer && t) noexcept :
40 cardinality_{n}, transformer_{t}
63 return transformer_(std::forward<I>(item));
68 Transformer transformer_;
Representation of farm pattern. Represents a farm of n replicas from a transformer.
Definition: farm_pattern.h:29
auto operator()(I &&item) const
Invokes the transformer of the farm over a data item.
Definition: farm_pattern.h:62
int cardinality() const noexcept
Farm's cardinality or number of replicas.
Definition: farm_pattern.h:47
Transformer transformer_type
Definition: farm_pattern.h:32
farm_t(int n, Transformer &&t) noexcept
Constructs a farm with a cardinality and a transformer.
Definition: farm_pattern.h:39
Transformer & transformer()
Return the transformer function stored in the farm pattern.
Definition: farm_pattern.h:55
Definition: callable_traits.h:21
typename std::enable_if_t< is_farm< T >, int > requires_farm
Definition: farm_pattern.h:85
static constexpr bool is_farm
Definition: farm_pattern.h:82
Definition: farm_pattern.h:74