LCOV - code coverage report
Current view: top level - lepton - Exception.h (source / functions) Hit Total Coverage
Test: plumed test coverage (other modules) Lines: 6 6 100.0 %
Date: 2026-11-05 10:19:06 Functions: 3 4 75.0 %

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

Generated by: LCOV version 1.16