func.h
Go to the documentation of this file.
32 auto *terminal_ptr = dynamic_cast<Out<std::decay_t<keyT>, std::decay_t<valueT>> *>(base_terminal_ptr);
45 auto *terminal_ptr = static_cast<Out<std::decay_t<keyT>, std::decay_t<valueT>> *>(base_terminal_ptr);
79 inline std::enable_if_t<(std::is_convertible_v<decltype(*(std::declval<TTBasePtrs>())), TTBase &> && ...), bool>
81 auto traverse = ttg::make_traverse([](auto &&x) { std::forward<decltype(x)>(x)->make_executable(); });
84 auto world = [&](auto&& tt0, auto&&... tts) { return tt0->get_world(); }(std::forward<TTBasePtrs>(tts)...);
106 template <std::size_t outindex, std::size_t inindex, typename producer_tt_ptr, typename successor_tt_ptr>
116 template <std::size_t outindex, std::size_t inindex, typename producer_tt_ptr, typename successor_tt_ptr>
157 template <typename keyT, typename valueT, typename output_terminalT, ttg::Runtime Runtime = ttg::ttg_runtime>
197 template <size_t i, typename keyT, typename valueT, typename... out_keysT, typename... out_valuesT,
212 inline std::enable_if_t<meta::is_none_void_v<keyT, std::decay_t<valueT>>, void> send(size_t i, const keyT &key,
215 static_assert(!meta::is_output_terminal_v<std::decay_t<valueT>> && !meta::is_output_terminal_tuple_v<std::decay_t<valueT>>, "ttg::send(i, key, x) - invalid invocation, x cannot be a terminal or a tuple of terminals; did you mean to call another version of send, e.g. sendk<i>(key, x)?");
229 inline std::enable_if_t<meta::is_none_void_v<keyT, std::decay_t<valueT>>, void> send(const keyT &key,
232 static_assert(!meta::is_output_terminal_v<std::decay_t<valueT>> && !meta::is_output_terminal_tuple_v<std::decay_t<valueT>>, "ttg::send<i>(key, x) - invalid invocation, x cannot be a terminal or a tuple of terminals; did you mean to call another version of send, e.g. sendk<i>(key, x)?");
256 static_assert(!meta::is_output_terminal_v<std::decay_t<keyT>> && !meta::is_output_terminal_tuple_v<std::decay_t<keyT>>, "ttg::sendk(i, x) - invalid invocation, x cannot be a terminal or a tuple of terminals; did you mean to call another version of send, e.g. send<i>(x)?");
270 static_assert(!meta::is_output_terminal_v<std::decay_t<keyT>> && !meta::is_output_terminal_tuple_v<std::decay_t<keyT>>, "ttg::sendk<i>(x) - invalid invocation, x cannot be a terminal or a tuple of terminals; did you mean to call another version of send, e.g. send<i>(x)?");
294 inline std::enable_if_t<!meta::is_void_v<std::decay_t<valueT>>, void> sendv(std::size_t i, valueT &&value) {
296 static_assert(!meta::is_output_terminal_v<std::decay_t<valueT>> && !meta::is_output_terminal_tuple_v<std::decay_t<valueT>>, "ttg::sendv(i, x) - invalid invocation, x cannot be a terminal or a tuple of terminals; did you mean to call another version of send, e.g. send<i>(x)?");
311 static_assert(!meta::is_output_terminal_v<std::decay_t<valueT>> && !meta::is_output_terminal_tuple_v<std::decay_t<valueT>>, "ttg::sendv<i>(x) - invalid invocation, x cannot be a terminal or a tuple of terminals; did you mean to call another version of send, e.g. send<i>(x)?");
345 template <size_t KeyId, size_t i, size_t... I, typename... RangesT, typename valueT, typename... out_keysT,
350 if (std::distance(std::begin(std::get<KeyId>(keylists)), std::end(std::get<KeyId>(keylists))) > 0) {
364 if (std::distance(std::begin(std::get<KeyId>(keylists)), std::end(std::get<KeyId>(keylists))) > 0) {
366 auto *terminal_ptr = detail::get_out_terminal<key_t, valueT>(i, "ttg::broadcast(keylists, value)");
371 auto *terminal_ptr = detail::get_out_terminal<key_t, valueT>(i, "ttg::broadcast(keylists, value)");
379 template <size_t KeyId, size_t i, size_t... I, typename... RangesT, typename... out_keysT, typename... out_valuesT>
380 inline void broadcast(const std::tuple<RangesT...> &keylists, std::tuple<ttg::Out<out_keysT, out_valuesT>...> &t) {
382 if (std::distance(std::begin(std::get<KeyId>(keylists)), std::end(std::get<KeyId>(keylists))) > 0) {
396 if (std::distance(std::begin(std::get<KeyId>(keylists)), std::end(std::get<KeyId>(keylists))) > 0) {
412 template <size_t i, typename rangeT, typename valueT, typename... out_keysT, typename... out_valuesT,
414 inline void broadcast(const rangeT &keylist, valueT &&value, std::tuple<ttg::Out<out_keysT, out_valuesT>...> &t) {
423 auto *terminal_ptr = detail::get_out_terminal<key_t, valueT>(i, "ttg::broadcast(keylist, value)");
432 template <size_t i, size_t... I, typename... RangesT, typename valueT, typename... out_keysT, typename... out_valuesT,
442 template <size_t i, size_t... I, typename... RangesT, typename valueT, ttg::Runtime Runtime = ttg::ttg_runtime>
452 inline void broadcastk(const rangeT &keylist, std::tuple<ttg::Out<out_keysT, out_valuesT>...> &t) {
468 template <size_t i, size_t... I, typename... RangesT, typename... out_keysT, typename... out_valuesT,
470 inline void broadcastk(const std::tuple<RangesT...> &keylists, std::tuple<ttg::Out<out_keysT, out_valuesT>...> &t) {
484 inline std::enable_if_t<!meta::is_void_v<keyT>, void> set_size(const keyT &key, const std::size_t size,
494 inline std::enable_if_t<!meta::is_void_v<keyT>, void> set_size(const keyT &key, const std::size_t size,
507 inline std::enable_if_t<!meta::is_void_v<keyT>, void> set_size(const keyT &key, const std::size_t size) {
524 inline void set_size(const std::size_t size, std::tuple<ttg::Out<out_keysT, out_valuesT>...> &t) {
543 inline std::enable_if_t<!meta::is_void_v<keyT>, void> finalize(const keyT &key, ttg::Out<out_keyT, out_valueT> &t) {
558 inline std::enable_if_t<!meta::is_void_v<keyT>, void> finalize(std::size_t i, const keyT &key) {
Definition: terminal.h:143
Definition: terminal.h:429
std::enable_if_t< meta::is_void_v< Key > &&!meta::is_void_v< Value >, void > sendv(Value &&value)
Definition: terminal.h:487
std::enable_if_t< meta::is_all_void_v< Key, Value >, void > send()
Definition: terminal.h:514
std::enable_if_t<!meta::is_void_v< Key > &&meta::is_void_v< Value >, void > sendk(const Key &key)
Definition: terminal.h:475
Definition: terminal.h:373
std::enable_if_t<!meta::is_void_v< Key >, void > finalize(const Key &key)
Definition: terminal.h:409
std::enable_if_t<!meta::is_void_v< Key >, void > set_size(const Key &key, std::size_t size)
Definition: terminal.h:393
static const std::vector< TerminalBase * > * get_outputs_tls_ptr()
Returns this thread's pointer to the vector of output terminals.
Definition: tt.h:229
Definition: terminal.h:12
virtual void connect(TerminalBase *in)=0
auto get_out_base_terminal(size_t i, const char *func)
Definition: func.h:51
void broadcast(const std::tuple< RangesT... > &keylists, valueT &&value, std::tuple< ttg::Out< out_keysT, out_valuesT >... > &t)
Definition: func.h:347
constexpr bool is_output_terminal_v
detects whether a given type is an output terminal type
Definition: terminal.h:615
constexpr bool is_output_terminal_tuple_v
Definition: terminal.h:629
auto fuse(const Edge< keyT, valuesT > &...args)
Fuse edges into one This allows receiving one data from either of the combined edges.
Definition: func.h:137
void send(const keyT &key, valueT &&value, ttg::Out< keyT, valueT > &t)
Sends a task id and a value to the given output terminal.
Definition: func.h:158
std::enable_if_t<(std::is_convertible_v< decltype(*(std::declval< TTBasePtrs >))), TTBase & > bool make_graph_executable(TTBasePtrs &&...tts)
Definition: func.h:80
void sendk(const keyT &key, ttg::Out< keyT, void > &t)
Sends a task id (without an accompanying value) to the given output terminal.
Definition: func.h:169
void sendv(valueT &&value, ttg::Out< void, valueT > &t)
Sends a value (without an accompanying task id) to the given output terminal.
Definition: func.h:179
void connect(ttg::Out< keyT, valueT > *out, ttg::In< keyT, valueT > *in)
Connect output terminal to successor input terminal.
Definition: func.h:93
auto make_traverse(TTVisitor &&tt_v=trivial_1param_lambda, InVisitor &&in_v=trivial_1param_lambda, OutVisitor &&out_v=trivial_1param_lambda)
Definition: traverse.h:205
std::enable_if_t<!meta::is_void_v< keyT >, void > set_size(const keyT &key, const std::size_t size, ttg::Out< keyT, out_valueT > &t)
Definition: func.h:484
std::enable_if_t<!meta::is_void_v< keyT >, void > finalize(const keyT &key, ttg::Out< out_keyT, out_valueT > &t)
Finalize streaming input terminals connecting to the given output terminal for tasks identified by ke...
Definition: func.h:543
void broadcast(const rangeT &keylist, valueT &&value, std::tuple< ttg::Out< out_keysT, out_valuesT >... > &t)
Definition: func.h:414
void broadcastk(const rangeT &keylist, std::tuple< ttg::Out< out_keysT, out_valuesT >... > &t)
Definition: func.h:452
Definition: func.h:21