File indexing completed on 2025-01-18 09:10:56
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include <concepts>
0012 #include <type_traits>
0013 #include <utility>
0014
0015 namespace Acts {
0016
0017 template <typename actor_t>
0018 concept ActorHasResult = requires { typename actor_t::result_type; };
0019
0020 template <typename actor_t>
0021 struct ActorHasResultStruct {
0022 static constexpr bool value = ActorHasResult<actor_t>;
0023 };
0024
0025 template <typename actor_t, typename propagator_state_t, typename stepper_t,
0026 typename navigator_t, typename... Args>
0027 concept ActorHasActWithoutResult = requires(
0028 const actor_t& a, propagator_state_t& state, const stepper_t& stepper,
0029 const navigator_t& navigator, Args&&... args) {
0030 {
0031 a.act(state, stepper, navigator, std::move<Args>(args)...)
0032 } -> std::same_as<void>;
0033 };
0034
0035 template <typename actor_t, typename propagator_state_t, typename stepper_t,
0036 typename navigator_t, typename... Args>
0037 concept ActorHasActWithResult =
0038 ActorHasResult<actor_t> &&
0039 requires(const actor_t& a, propagator_state_t& state,
0040 const stepper_t& stepper, const navigator_t& navigator,
0041 typename actor_t::result_type& result, Args&&... args) {
0042 {
0043 a.act(state, stepper, navigator, result, std::move<Args>(args)...)
0044 } -> std::same_as<void>;
0045 };
0046
0047 template <typename actor_t, typename propagator_state_t, typename stepper_t,
0048 typename navigator_t, typename... Args>
0049 concept ActorHasAct =
0050 ActorHasActWithoutResult<actor_t, propagator_state_t, stepper_t,
0051 navigator_t, Args...> ||
0052 ActorHasActWithResult<actor_t, propagator_state_t, stepper_t, navigator_t,
0053 Args...>;
0054
0055 template <typename actor_t, typename propagator_state_t, typename stepper_t,
0056 typename navigator_t, typename... Args>
0057 concept ActorHasAbortWithoutResult = requires(
0058 const actor_t& a, propagator_state_t& state, const stepper_t& stepper,
0059 const navigator_t& navigator, Args&&... args) {
0060 {
0061 a.checkAbort(state, stepper, navigator, std::move<Args>(args)...)
0062 } -> std::same_as<bool>;
0063 };
0064
0065 template <typename actor_t, typename propagator_state_t, typename stepper_t,
0066 typename navigator_t, typename... Args>
0067 concept ActorHasAbortWithResult =
0068 ActorHasResult<actor_t> &&
0069 requires(const actor_t& a, propagator_state_t& state,
0070 const stepper_t& stepper, const navigator_t& navigator,
0071 typename actor_t::result_type& result, Args&&... args) {
0072 {
0073 a.checkAbort(state, stepper, navigator, result,
0074 std::move<Args>(args)...)
0075 } -> std::same_as<bool>;
0076 };
0077
0078 template <typename actor_t, typename propagator_state_t, typename stepper_t,
0079 typename navigator_t, typename... Args>
0080 concept ActorHasAbort =
0081 ActorHasAbortWithoutResult<actor_t, propagator_state_t, stepper_t,
0082 navigator_t, Args...> ||
0083 ActorHasAbortWithResult<actor_t, propagator_state_t, stepper_t, navigator_t,
0084 Args...>;
0085
0086 template <typename actor_t, typename propagator_state_t, typename stepper_t,
0087 typename navigator_t, typename... Args>
0088 concept Actor =
0089 ActorHasAct<actor_t, propagator_state_t, stepper_t, navigator_t, Args...> ||
0090 ActorHasAbort<actor_t, propagator_state_t, stepper_t, navigator_t, Args...>;
0091
0092 }