|
|
|||
Warning, file /acts/Core/include/Acts/Navigation/MultiNavigationPolicy.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 // This file is part of the ACTS project. 0002 // 0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project 0004 // 0005 // This Source Code Form is subject to the terms of the Mozilla Public 0006 // License, v. 2.0. If a copy of the MPL was not distributed with this 0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/. 0008 0009 #pragma once 0010 0011 #include "Acts/Navigation/INavigationPolicy.hpp" 0012 #include "Acts/Utilities/Zip.hpp" 0013 0014 namespace Acts { 0015 0016 /// Combined navigation policy that calls all contained other navigation 0017 /// policies. This class manages multiple navigation policies and executes 0018 /// them sequentially to populate the navigation stream with candidates. 0019 class MultiNavigationPolicy final : public INavigationPolicy { 0020 public: 0021 /// Constructor from multiple unique_ptr policies 0022 /// @tparam Policies The types of the navigation policies 0023 /// @param policies Unique pointers to navigation policies 0024 template <typename... Policies> 0025 explicit MultiNavigationPolicy(std::unique_ptr<Policies>... policies) 0026 : MultiNavigationPolicy{[](auto... args) { 0027 std::vector<std::unique_ptr<INavigationPolicy>> policyPtrs; 0028 0029 if constexpr (sizeof...(args) > 0) { 0030 auto fill = [&policyPtrs](auto& policy) { 0031 policyPtrs.push_back(std::move(policy)); 0032 }; 0033 0034 (fill(args), ...); 0035 } 0036 0037 return policyPtrs; 0038 }(std::move(policies)...)} {} 0039 0040 /// Constructor from a vector of navigation policies 0041 /// @param policies Vector of unique pointers to navigation policies 0042 explicit MultiNavigationPolicy( 0043 std::vector<std::unique_ptr<INavigationPolicy>>&& policies); 0044 0045 /// Connect this policy to a navigation delegate 0046 /// @param delegate The navigation delegate to connect to 0047 void connect(NavigationDelegate& delegate) const override; 0048 0049 /// Access the contained navigation policies 0050 /// @return Span of const unique pointers to the navigation policies 0051 std::span<const std::unique_ptr<INavigationPolicy>> policies() const; 0052 0053 /// Visit this policy first, and then all child policies one by one. 0054 /// @param visitor The function to call for each policy 0055 void visit(const std::function<void(const INavigationPolicy&)>& visitor) 0056 const override; 0057 0058 /// Marker state for MultiNavigationPolicy. 0059 /// 0060 /// Carries no data: the child policy states live contiguously on the manager 0061 /// stack directly below this one and are addressed by count (which always 0062 /// equals the number of contained policies). This marker is pushed instead of 0063 /// the default @c EmptyState only when at least one child has a real state, so 0064 /// that the navigator knows isValid() must be consulted for this volume. 0065 struct State {}; 0066 0067 /// Check if all child policies are in a valid state 0068 /// @param gctx The geometry context 0069 /// @param args The navigation arguments 0070 /// @param state The navigation policy state to check 0071 /// @param logger Logger for debug output 0072 /// @return True if all child policy states are valid, false otherwise 0073 bool isValid(const GeometryContext& gctx, const NavigationArguments& args, 0074 NavigationPolicyState& state, 0075 const Logger& logger) const override; 0076 0077 /// Create and initialize states for this policy and all child policies 0078 /// @param gctx The geometry context 0079 /// @param args The navigation arguments 0080 /// @param stateManager The state manager to push the new states onto 0081 /// @param logger Logger for debug output 0082 void createState(const GeometryContext& gctx, const NavigationArguments& args, 0083 NavigationPolicyStateManager& stateManager, 0084 const Logger& logger) const override; 0085 0086 /// Remove the states for this policy and all child policies from the state 0087 /// manager 0088 /// @param stateManager The state manager to pop the states from 0089 /// @param logger Logger for debug output 0090 void popState(NavigationPolicyStateManager& stateManager, 0091 const Logger& logger) const override; 0092 0093 private: 0094 /// Initialize navigation candidates by calling all contained policies 0095 /// @param gctx The geometry context 0096 /// @param args The navigation arguments 0097 /// @param state The navigation policy state 0098 /// @param stream The navigation stream to populate 0099 /// @param logger Logger for debug output 0100 void initializeCandidates(const GeometryContext& gctx, 0101 const NavigationArguments& args, 0102 NavigationPolicyState& state, 0103 AppendOnlyNavigationStream& stream, 0104 const Logger& logger) const; 0105 0106 /// Vector of unique pointers to the contained navigation policies 0107 std::vector<std::unique_ptr<INavigationPolicy>> m_policyPtrs; 0108 0109 /// Vector of navigation delegates, one for each policy 0110 std::vector<NavigationDelegate> m_delegates; 0111 }; 0112 } // namespace Acts
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|