You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Exception.h 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #ifndef LEPTON_EXCEPTION_H_
  2. #define LEPTON_EXCEPTION_H_
  3. /* -------------------------------------------------------------------------- *
  4. * Lepton *
  5. * -------------------------------------------------------------------------- *
  6. * This is part of the Lepton expression parser originating from *
  7. * Simbios, the NIH National Center for Physics-Based Simulation of *
  8. * Biological Structures at Stanford, funded under the NIH Roadmap for *
  9. * Medical Research, grant U54 GM072970. See https://simtk.org. *
  10. * *
  11. * Portions copyright (c) 2009 Stanford University and the Authors. *
  12. * Authors: Peter Eastman *
  13. * Contributors: *
  14. * *
  15. * Permission is hereby granted, free of charge, to any person obtaining a *
  16. * copy of this software and associated documentation files (the "Software"), *
  17. * to deal in the Software without restriction, including without limitation *
  18. * the rights to use, copy, modify, merge, publish, distribute, sublicense, *
  19. * and/or sell copies of the Software, and to permit persons to whom the *
  20. * Software is furnished to do so, subject to the following conditions: *
  21. * *
  22. * The above copyright notice and this permission notice shall be included in *
  23. * all copies or substantial portions of the Software. *
  24. * *
  25. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *
  26. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *
  27. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *
  28. * THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
  29. * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
  30. * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
  31. * USE OR OTHER DEALINGS IN THE SOFTWARE. *
  32. * -------------------------------------------------------------------------- */
  33. #include <exception>
  34. #include <string>
  35. namespace Lepton
  36. {
  37. /**
  38. * This class is used for all exceptions thrown by Lepton.
  39. */
  40. class Exception final : public std::exception
  41. {
  42. public:
  43. Exception(const std::string& message) : message(message) { }
  44. ~Exception() throw() override { }
  45. const char* what() const throw() override { return message.c_str(); }
  46. private:
  47. std::string message;
  48. };
  49. } // namespace Lepton
  50. #endif /*LEPTON_EXCEPTION_H_*/