10#include "introspect.hpp"
11#include "processor.hpp"
12#include "type_list.hpp"
21template <
typename EventList,
bool Inverted,
typename Downstream>
22 requires processor<Downstream>
24 Downstream downstream;
27 explicit select(Downstream downstream)
28 : downstream(std::move(downstream)) {}
30 [[nodiscard]]
auto introspect_node() const -> processor_info {
31 return processor_info(
this,
"select");
34 [[nodiscard]]
auto introspect_graph() const -> processor_graph {
35 return downstream.introspect_graph().push_entry_point(
this);
38 template <
typename AnyEvent>
40 (convertible_to_type_list_member<std::remove_cvref_t<AnyEvent>,
41 EventList> != Inverted) and
42 handler_for<Downstream, std::remove_cvref_t<AnyEvent>>)
43 void handle(AnyEvent &&event) {
44 downstream.handle(std::forward<AnyEvent>(event));
47 template <
typename AnyEvent>
48 requires(convertible_to_type_list_member<std::remove_cvref_t<AnyEvent>,
49 EventList> == Inverted)
50 void handle(AnyEvent && ) {}
52 void flush() { downstream.flush(); }
76template <
typename EventList,
typename Downstream>
78 return internal::select<EventList, false, Downstream>(
79 std::move(downstream));
100template <
typename Downstream>
auto select_none(Downstream downstream) {
101 return internal::select<type_list<>,
false, Downstream>(
102 std::move(downstream));
124template <
typename EventList,
typename Downstream>
126 return internal::select<EventList, true, Downstream>(
127 std::move(downstream));
147template <
typename Downstream>
auto select_all(Downstream downstream) {
148 return internal::select<type_list<>,
true, Downstream>(
149 std::move(downstream));
auto select_all(Downstream downstream)
Create a processor that passes all events.
Definition select.hpp:147
auto select(Downstream downstream)
Create a processor that passes a given set of events and discards others.
Definition select.hpp:77
auto select_none(Downstream downstream)
Create a processor that passes no events.
Definition select.hpp:100
auto select_except(Downstream downstream)
Create a processor that discards a given set of events and passes others.
Definition select.hpp:125
libtcspc namespace.
Definition acquire.hpp:30