21 #ifndef INCLUDE_FKIE_MESSAGE_FILTERS_COMBINER_POLICIES_FIFO_IMPL_H_
22 #define INCLUDE_FKIE_MESSAGE_FILTERS_COMBINER_POLICIES_FIFO_IMPL_H_
25 #include "../helpers/tuple.h"
26 #include "../helpers/scoped_unlock.h"
30 namespace combiner_policies
33 template<
typename... IOs>
36 if (max_queue_size == 0)
throw std::invalid_argument(
"max_queue_size must not be zero");
38 [
this, max_queue_size](
auto I)
40 std::get<I>(this->in_).set_capacity(max_queue_size);
45 template<
typename... IOs>
46 template<std::
size_t N>
47 void Fifo<IOs...>::add(std::unique_lock<std::mutex>& lock,
const std::tuple_element_t<N, IncomingTuples>& item)
49 std::get<N>(in_).push_back(item);
50 while (has_complete_tuple())
52 MaybeOutgoingTuples tmp = assemble_output();
54 [
this, &tmp, &lock](
auto... Is)
57 this->emit(std::tuple_cat(*std::get<Is>(tmp)...));
63 template<
typename... IOs>
68 [
this, &result](
auto I)
70 if (std::get<I>(this->in_).empty()) result =
false;
77 template<
typename... IOs>
80 MaybeOutgoingTuples tmp;
84 std::get<I>(tmp) = std::get<I>(this->in_).front();
85 std::get<I>(this->in_).pop_front();
91 template<
typename... IOs>
97 std::get<I>(this->in_).clear();