Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-17 07:58:45

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 <exception>
0012 #include <memory>
0013 #include <string>
0014 
0015 namespace Acts {
0016 class Surface;
0017 
0018 /// @brief Exception type failures to merge two surfaces
0019 class SurfaceMergingException : public std::exception {
0020  public:
0021   /// Constructor for surface merging exception
0022   /// @param surfaceA First surface that failed to merge
0023   /// @param surfaceB Second surface that failed to merge
0024   /// @param reason Description of why the merge failed
0025   SurfaceMergingException(std::weak_ptr<const Surface> surfaceA,
0026                           std::weak_ptr<const Surface> surfaceB,
0027                           const std::string& reason)
0028       : m_surfaceA(std::move(surfaceA)),
0029         m_surfaceB(std::move(surfaceB)),
0030         m_message(std::string{"Failure to merge surfaces: "} + reason) {}
0031 
0032   /// Get exception description
0033   /// @return C-style string describing the exception
0034   const char* what() const throw() override { return m_message.c_str(); }
0035 
0036  private:
0037   std::weak_ptr<const Surface> m_surfaceA;
0038   std::weak_ptr<const Surface> m_surfaceB;
0039   std::string m_message;
0040 };
0041 
0042 }  // namespace Acts