kokkos-execution
0.0.1
Toggle main menu visibility
Loading...
Searching...
No Matches
check_rcvr_env_queryable_with.hpp
Go to the documentation of this file.
1
#ifndef KOKKOS_EXECUTION_TESTS_UTILS_CHECK_RCVR_ENV_QUERYABLE_WITH_HPP
2
#define KOKKOS_EXECUTION_TESTS_UTILS_CHECK_RCVR_ENV_QUERYABLE_WITH_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/env.hpp
"
9
#include "
kokkos-execution/impl/type_traits.hpp
"
10
11
#include "
tests/utils/stdexec.hpp
"
12
18
19
namespace
Tests::Utils
{
20
21
template
<
bool
IsQueryable, stdexec::sender Sndr,
typename
... Queries>
22
struct
CheckRcvrEnvQueryableWithSender
;
23
24
template
<
bool
IsQueryable,
typename
... Queries>
25
struct
check_rcvr_env_queryable_with_t
{
26
[[nodiscard]]
27
constexpr
auto
operator()
() const noexcept {
28
return
stdexec::__closure(*
this
);
29
}
30
31
template
<stdexec::sender Sndr>
32
[[nodiscard]]
33
constexpr
auto
operator()
(Sndr&& sndr)
const
{
34
return
CheckRcvrEnvQueryableWithSender
<IsQueryable, Sndr, Queries...>{std::forward<Sndr>(sndr)};
35
}
36
};
37
38
template
<
bool
IsQueryable, stdexec::sender Sndr,
typename
... Queries>
39
struct
CheckRcvrEnvQueryableWithSender
{
40
using
sender_concept
= stdexec::sender_tag;
41
42
Sndr
sndr
;
// NOLINT(cppcoreguidelines-avoid-const-or-ref-data-members)
43
44
KOKKOS_EXECUTION_COMPL_SIGS_KEEP
(
CheckRcvrEnvQueryableWithSender
, Sndr)
45
46
template
<stdexec::__decays_to<CheckRcvrEnvQueryableWithSender> Self, stdexec::receiver Rcvr>
47
[[nodiscard]]
48
constexpr
STDEXEC_EXPLICIT_THIS_BEGIN(
49
auto
connect
)(
this
Self&& self, Rcvr rcvr)
// NOLINT(cppcoreguidelines-missing-std-forward)
50
noexcept
(stdexec::__nothrow_connectable<
KOKKOS_EXECUTION_IMPL_MEMBER_CVREF_T
(Self,
sndr
), Rcvr&&>)
51
-> stdexec::connect_result_t<
KOKKOS_EXECUTION_IMPL_MEMBER_CVREF_T
(Self,
sndr
), Rcvr&&> {
52
static_assert
(
check_rcvr_env<Rcvr>
());
53
return
stdexec::connect(std::forward<Self>(self).
sndr
, std::move(rcvr));
54
}
55
STDEXEC_EXPLICIT_THIS_END(
connect
)
56
57
template
<stdexec::receiver Rcvr>
58
static
consteval
bool
check_rcvr_env
() {
59
if
constexpr
(IsQueryable) {
60
static_assert
(
61
(stdexec::__queryable_with<stdexec::env_of_t<Rcvr>, Queries> && ...),
62
"The receiver environment is not queryable with at least one query from the given set of queries."
);
63
}
else
{
64
static_assert
(
65
((!stdexec::__queryable_with<stdexec::env_of_t<Rcvr>, Queries>) && ...),
66
"The receiver environment is queryable with at least one query from the given set of queries."
);
67
}
68
return
true
;
69
}
70
71
KOKKOS_EXECUTION_IMPL_FORWARDING_ATTRIBUTES_GET_ENV
(Sndr,
sndr
)
72
};
73
74
template
<
typename
... Queries>
75
inline
constexpr
check_rcvr_env_queryable_with_t
<
true
, Queries...>
check_rcvr_env_queryable_with
{};
76
77
template
<
typename
... Queries>
78
inline
constexpr
check_rcvr_env_queryable_with_t
<
false
, Queries...>
check_rcvr_env_not_queryable_with
{};
79
80
}
// namespace Tests::Utils
81
82
#endif
// KOKKOS_EXECUTION_TESTS_UTILS_CHECK_RCVR_ENV_QUERYABLE_WITH_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
env.hpp
stdexec.hpp
Tests::Utils
Definition
atomic.hpp:59
Tests::Utils::check_rcvr_env_not_queryable_with
constexpr check_rcvr_env_queryable_with_t< false, Queries... > check_rcvr_env_not_queryable_with
Definition
check_rcvr_env_queryable_with.hpp:78
Tests::Utils::check_rcvr_env_queryable_with
constexpr check_rcvr_env_queryable_with_t< true, Queries... > check_rcvr_env_queryable_with
Definition
check_rcvr_env_queryable_with.hpp:75
Tests::Utils::CheckRcvrEnvQueryableWithSender
Definition
check_rcvr_env_queryable_with.hpp:39
Tests::Utils::CheckRcvrEnvQueryableWithSender::sndr
Sndr sndr
Definition
check_rcvr_env_queryable_with.hpp:42
Tests::Utils::CheckRcvrEnvQueryableWithSender::check_rcvr_env
static consteval bool check_rcvr_env()
Definition
check_rcvr_env_queryable_with.hpp:58
Tests::Utils::CheckRcvrEnvQueryableWithSender::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_queryable_with.hpp:55
Tests::Utils::CheckRcvrEnvQueryableWithSender::sender_concept
stdexec::sender_tag sender_concept
Definition
check_rcvr_env_queryable_with.hpp:40
Tests::Utils::check_rcvr_env_queryable_with_t
Definition
check_rcvr_env_queryable_with.hpp:25
Tests::Utils::check_rcvr_env_queryable_with_t::operator()
constexpr auto operator()() const noexcept
Definition
check_rcvr_env_queryable_with.hpp:27
Tests::Utils::check_rcvr_env_queryable_with_t::operator()
constexpr auto operator()(Sndr &&sndr) const
Definition
check_rcvr_env_queryable_with.hpp:33
stdexec.hpp
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_queryable_with.hpp
Generated on
for kokkos-execution by
1.18.0