kokkos-utils
0.0.5
Toggle main menu visibility
Loading...
Searching...
No Matches
ConjunctionMatcher.hpp
Go to the documentation of this file.
1
#ifndef KOKKOS_UTILS_CALLBACKS_CONJUNCTIONMATCHER_HPP
2
#define KOKKOS_UTILS_CALLBACKS_CONJUNCTIONMATCHER_HPP
3
4
#include "
kokkos-utils/callbacks/Events.hpp
"
5
#include "
kokkos-utils/callbacks/Matcher.hpp
"
6
7
namespace
Kokkos::utils::callbacks
8
{
9
15
template
<
Matcher
... MatcherTypes>
requires
(
sizeof
...(MatcherTypes) > 1)
16
struct
ConjunctionMatcher
17
{
18
ConjunctionMatcher
() =
default
;
19
20
template
<
typename
... Args>
requires
(
sizeof
...(Args) > 0 &&
sizeof
...(Args) ==
sizeof
...(MatcherTypes))
21
explicit
ConjunctionMatcher
(Args&&... args) :
matchers
(std::forward<Args>(args)...) {}
22
23
template
<Event EventType>
requires
(
MatcherFor<MatcherTypes, EventType>
&& ...)
24
bool
operator()
(
const
EventType& event)
25
{
26
return
std::apply([&event] (MatcherTypes&... matchers_) {
27
return
(matchers_(event) && ...);
28
},
matchers
);
29
}
30
31
std::tuple<MatcherTypes...>
matchers
{};
32
};
33
34
template
<
typename
... MatcherTypes>
35
ConjunctionMatcher
(MatcherTypes&&...) ->
ConjunctionMatcher
<MatcherTypes...>;
36
37
}
// namespace Kokkos::utils::callbacks
38
39
#endif
// KOKKOS_UTILS_CALLBACKS_CONJUNCTIONMATCHER_HPP
Events.hpp
Matcher.hpp
Kokkos::utils::callbacks::MatcherFor
Check that Callable is a matcher for each event in EventTypes.
Definition
Matcher.hpp:35
Kokkos::utils::callbacks::Matcher
Callable is a matcher if it is invocable with at least one event type from Kokkos::utils::callbacks::...
Definition
Matcher.hpp:31
Kokkos::utils::callbacks
Definition
BeginEndTimerListener.hpp:12
Kokkos::utils::callbacks::ConjunctionMatcher
Conjunction of matchers that is true only if all matchers agree.
Definition
ConjunctionMatcher.hpp:17
Kokkos::utils::callbacks::ConjunctionMatcher::ConjunctionMatcher
ConjunctionMatcher()=default
Kokkos::utils::callbacks::ConjunctionMatcher::matchers
std::tuple< MatcherTypes... > matchers
Definition
ConjunctionMatcher.hpp:31
Kokkos::utils::callbacks::ConjunctionMatcher::ConjunctionMatcher
ConjunctionMatcher(Args &&... args)
Definition
ConjunctionMatcher.hpp:21
Kokkos::utils::callbacks::ConjunctionMatcher::operator()
bool operator()(const EventType &event)
Definition
ConjunctionMatcher.hpp:24
include
kokkos-utils
callbacks
ConjunctionMatcher.hpp
Generated on
for kokkos-utils by
1.18.0