-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fuses Actors and Aborters into a single object with seperate `act` and `check` calls. The motivation for this is that Aborters cannot hold any state by their own currently but need an Actor to point to. To simplify this I propose to couple these two concepts. At the same time I reworked the call mechanism for the actor and aborter functions which concepts and a simpler dispatch mechanism. Class names changed a bit from `ActionList` to `ActorList` for example.
- Loading branch information
Showing
46 changed files
with
736 additions
and
915 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// This file is part of the Acts project. | ||
// | ||
// Copyright (C) 2024 CERN for the benefit of the Acts project | ||
// | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
#pragma once | ||
|
||
#include <concepts> | ||
#include <type_traits> | ||
#include <utility> | ||
|
||
namespace Acts { | ||
|
||
template <typename actor_t> | ||
concept ActorHasResult = requires { typename actor_t::result_type; }; | ||
|
||
template <typename actor_t, typename propagator_state_t, typename stepper_t, | ||
typename navigator_t, typename... Args> | ||
concept ActorHasActWithoutResult = requires( | ||
const actor_t& a, propagator_state_t& state, const stepper_t& stepper, | ||
const navigator_t& navigator, Args&&... args) { | ||
{ | ||
a.act(state, stepper, navigator, std::move<Args>(args)...) | ||
} -> std::same_as<void>; | ||
}; | ||
|
||
template <typename actor_t, typename propagator_state_t, typename stepper_t, | ||
typename navigator_t, typename... Args> | ||
concept ActorHasActWithResult = | ||
ActorHasResult<actor_t> && | ||
requires(const actor_t& a, propagator_state_t& state, | ||
const stepper_t& stepper, const navigator_t& navigator, | ||
typename actor_t::result_type& result, Args&&... args) { | ||
{ | ||
a.act(state, stepper, navigator, result, std::move<Args>(args)...) | ||
} -> std::same_as<void>; | ||
}; | ||
|
||
template <typename actor_t, typename propagator_state_t, typename stepper_t, | ||
typename navigator_t, typename... Args> | ||
concept ActorHasAct = | ||
ActorHasActWithoutResult<actor_t, propagator_state_t, stepper_t, | ||
navigator_t, Args...> || | ||
ActorHasActWithResult<actor_t, propagator_state_t, stepper_t, navigator_t, | ||
Args...>; | ||
|
||
template <typename actor_t, typename propagator_state_t, typename stepper_t, | ||
typename navigator_t, typename... Args> | ||
concept ActorHasAbortWithoutResult = requires( | ||
const actor_t& a, propagator_state_t& state, const stepper_t& stepper, | ||
const navigator_t& navigator, Args&&... args) { | ||
{ | ||
a.checkAbort(state, stepper, navigator, std::move<Args>(args)...) | ||
} -> std::same_as<bool>; | ||
}; | ||
|
||
template <typename actor_t, typename propagator_state_t, typename stepper_t, | ||
typename navigator_t, typename... Args> | ||
concept ActorHasAbortWithResult = | ||
ActorHasResult<actor_t> && | ||
requires(const actor_t& a, propagator_state_t& state, | ||
const stepper_t& stepper, const navigator_t& navigator, | ||
typename actor_t::result_type& result, Args&&... args) { | ||
{ | ||
a.checkAbort(state, stepper, navigator, result, | ||
std::move<Args>(args)...) | ||
} -> std::same_as<bool>; | ||
}; | ||
|
||
template <typename actor_t, typename propagator_state_t, typename stepper_t, | ||
typename navigator_t, typename... Args> | ||
concept ActorHasAbort = | ||
ActorHasAbortWithoutResult<actor_t, propagator_state_t, stepper_t, | ||
navigator_t, Args...> || | ||
ActorHasAbortWithResult<actor_t, propagator_state_t, stepper_t, navigator_t, | ||
Args...>; | ||
|
||
template <typename actor_t, typename propagator_state_t, typename stepper_t, | ||
typename navigator_t, typename... Args> | ||
concept Actor = | ||
ActorHasAct<actor_t, propagator_state_t, stepper_t, navigator_t, Args...> || | ||
ActorHasAbort<actor_t, propagator_state_t, stepper_t, navigator_t, Args...>; | ||
|
||
} // namespace Acts |
Oops, something went wrong.