20#ifndef ESPRESSO_SRC_CORE_ACTOR_VISITORS_HPP
21#define ESPRESSO_SRC_CORE_ACTOR_VISITORS_HPP
36 static constexpr bool is_exact_match_v = std::is_same_v<T, Actor>;
38 static constexpr bool is_layer_correction_v =
42 template <
typename T, std::enable_if_t<is_exact_match_v<T>> * =
nullptr>
47 template <
typename T, std::enable_if_t<not is_exact_match_v<T> and
48 is_layer_correction_v<T>> * =
nullptr>
50 return std::visit(*
this, obj->base_solver);
54 std::enable_if_t<not is_exact_match_v<T> and
55 not is_layer_correction_v<T>> * =
nullptr>
57 return std::shared_ptr<Actor>{
nullptr};
62template <
typename Actor,
typename Variant>
67template <
typename Actor,
typename Variant>
70 return (optional) ? get_actor_by_type<Actor>(*optional) :
nullptr;
77 static constexpr bool is_exact_match_v = std::is_same_v<T, Actor>;
79 static constexpr bool is_layer_correction_v =
83 template <
typename T, std::enable_if_t<is_exact_match_v<T>> * =
nullptr>
88 template <
typename T, std::enable_if_t<not is_exact_match_v<T> and
89 is_layer_correction_v<T>> * =
nullptr>
91 return std::visit(*
this, obj->base_solver);
95 std::enable_if_t<not is_exact_match_v<T> and
96 not is_layer_correction_v<T>> * =
nullptr>
103template <
typename Actor,
typename Variant>
108template <
typename Actor,
typename Variant>
110 return (optional) ? has_actor_of_type<Actor>(*optional) :
false;
Get an actor of a specific type, recursively.
auto operator()(std::shared_ptr< T > const &obj) const
auto operator()(std::shared_ptr< T > const &) const
Check if an actor of a specific type is active, recursively.
auto operator()(std::shared_ptr< T > const &) const
auto operator()(std::shared_ptr< T > const &obj) const
Whether an actor is a layer correction method.
auto has_actor_of_type(Variant const &variant)
Check if an actor of a specific type is active, recursively.
std::shared_ptr< Actor > get_actor_by_type(Variant const &variant)
Get an active actor of a specific type, recursively.