kokkos-execution
0.0.1
Toggle main menu visibility
Loading...
Searching...
No Matches
check_rcvr_env.hpp
Go to the documentation of this file.
1
#ifndef KOKKOS_EXECUTION_TESTS_UTILS_CHECK_RCVR_ENV_HPP
2
#define KOKKOS_EXECUTION_TESTS_UTILS_CHECK_RCVR_ENV_HPP
3
4
#include "
kokkos-execution/stdexec.hpp
"
5
6
#include "
kokkos-execution/impl/attributes.hpp
"
7
#include "
kokkos-execution/impl/completion_signatures.hpp
"
8
#include "
kokkos-execution/impl/type_traits.hpp
"
9
10
namespace
Tests::Utils
{
11
12
template
<
typename
ExpectedEnv,
typename
Sndr>
13
struct
CheckRcvrEnvSender
{
14
using
sender_concept
= stdexec::sender_tag;
15
16
Sndr
sndr
;
17
18
KOKKOS_EXECUTION_COMPL_SIGS_KEEP
(
CheckRcvrEnvSender
, Sndr)
19
20
template
<stdexec::__decays_to<CheckRcvrEnvSender> Self, stdexec::receiver Rcvr>
21
[[nodiscard]]
22
constexpr
STDEXEC_EXPLICIT_THIS_BEGIN(
23
auto
connect
)(
this
Self&& self, Rcvr rcvr)
// NOLINT(cppcoreguidelines-missing-std-forward)
24
noexcept
(stdexec::__nothrow_connectable<
KOKKOS_EXECUTION_IMPL_MEMBER_CVREF_T
(Self,
sndr
), Rcvr&&>)
25
-> stdexec::connect_result_t<
KOKKOS_EXECUTION_IMPL_MEMBER_CVREF_T
(Self,
sndr
), Rcvr&&> {
26
static_assert
(std::same_as<ExpectedEnv, stdexec::env_of_t<Rcvr>>);
27
return
stdexec::connect(std::forward<Self>(self).
sndr
, std::move(rcvr));
28
}
29
STDEXEC_EXPLICIT_THIS_END(
connect
)
30
31
KOKKOS_EXECUTION_IMPL_FORWARDING_ATTRIBUTES_GET_ENV
(Sndr,
sndr
)
32
};
33
35
template <typename ExpectedEnv>
36
struct
check_rcvr_env_t
{
37
[[nodiscard]]
38
constexpr
auto
operator()
() const noexcept {
39
return
stdexec::__closure(*
this
);
40
}
41
42
template
<stdexec::sender Sndr>
43
[[nodiscard]]
44
constexpr
auto
operator()
(Sndr&&
sndr
)
const
{
45
return
CheckRcvrEnvSender<ExpectedEnv, Sndr>
{std::forward<Sndr>(
sndr
)};
46
}
47
};
48
49
template
<
typename
ExpectedEnv>
50
inline
constexpr
check_rcvr_env_t<ExpectedEnv>
check_rcvr_env
{};
51
52
}
// namespace Tests::Utils
53
54
#endif
// KOKKOS_EXECUTION_TESTS_UTILS_CHECK_RCVR_ENV_HPP
attributes.hpp
KOKKOS_EXECUTION_IMPL_FORWARDING_ATTRIBUTES_GET_ENV
#define KOKKOS_EXECUTION_IMPL_FORWARDING_ATTRIBUTES_GET_ENV(_type_, _obj_)
Definition
attributes.hpp:30
completion_signatures.hpp
KOKKOS_EXECUTION_COMPL_SIGS_KEEP
#define KOKKOS_EXECUTION_COMPL_SIGS_KEEP(_decayed_self_type_, _sndr_type_)
Definition
completion_signatures.hpp:43
stdexec.hpp
Tests::Utils
Definition
atomic.hpp:59
Tests::Utils::check_rcvr_env
constexpr check_rcvr_env_t< ExpectedEnv > check_rcvr_env
Definition
check_rcvr_env.hpp:50
Tests::Utils::CheckRcvrEnvSender
Definition
check_rcvr_env.hpp:13
Tests::Utils::CheckRcvrEnvSender::sndr
Sndr sndr
Definition
check_rcvr_env.hpp:16
Tests::Utils::CheckRcvrEnvSender::sender_concept
stdexec::sender_tag sender_concept
Definition
check_rcvr_env.hpp:14
Tests::Utils::CheckRcvrEnvSender::connect
device constexpr auto connect(_Ts &&... __args) &&noexcept(noexcept(__static_connect(std::move(*this), static_cast< _Ts && >(__args)...))) -> decltype(__static_connect(std::move(*this), static_cast< _Ts && >(__args)...))
Definition
check_rcvr_env.hpp:29
Tests::Utils::check_rcvr_env_t
Check that the receiver environment is of type ExpectedEnv.
Definition
check_rcvr_env.hpp:36
Tests::Utils::check_rcvr_env_t::operator()
constexpr auto operator()(Sndr &&sndr) const
Definition
check_rcvr_env.hpp:44
Tests::Utils::check_rcvr_env_t::operator()
constexpr auto operator()() const noexcept
Definition
check_rcvr_env.hpp:38
type_traits.hpp
KOKKOS_EXECUTION_IMPL_MEMBER_CVREF_T
#define KOKKOS_EXECUTION_IMPL_MEMBER_CVREF_T(_Self_, _member_)
Yields the type of member _member_ as accessed from expression _Self_, preserving the cv and ref qual...
Definition
type_traits.hpp:17
tests
utils
check_rcvr_env.hpp
Generated on
for kokkos-execution by
1.18.0