lagsht_exceptions.h 1.54 KB
Newer Older
1 2
#ifndef LAGSHTEXCEPTIONS_SEEN
#define LAGSHTEXCEPTIONS_SEEN
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
/*
 *  This file is part of LagSHT.
 *
 *  LagSHT is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  LagSHT is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with libsharp; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

/*
 *  LagSHT is being developed at the Linear Accelerateur Laboratory (LAL)
 *  91898 ORSAY CEDEX - FRANCE
 *  main author: J.E Campagne
 */
26 27 28 29 30 31

#include <exception>
#include <string>

namespace LagSHT {

32

33 34 35 36 37 38 39 40 41 42 43 44 45
class LagSHTError : public std::exception {
public:    
  explicit LagSHTError(const std::string& m) :  msg_(m) { }
  explicit LagSHTError(const char* m): msg_(m) { }
  virtual ~LagSHTError() throw() {}
  //! Implementation of std::exception what() method, returning the exception message
  virtual const char* what() const throw() { return msg_.c_str(); }
  
private:
  std::string msg_;
  
};//LagSHTError

46 47 48 49 50

#define lagsht_assert(testval,msg) \
do { if (testval); else throw LagSHTError(msg); } while(0)


51 52 53
}//end namespace

#endif //LAGSHTEXCEPTIONS_SEEN