lagsht_exceptions.h 679 Bytes
Newer Older
1 2 3 4 5 6 7 8
#ifndef LAGSHTEXCEPTIONS_SEEN
#define LAGSHTEXCEPTIONS_SEEN

#include <exception>
#include <string>

namespace LagSHT {

9

10 11 12 13 14 15 16 17 18 19 20 21 22
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

23 24 25 26 27

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


28 29 30
}//end namespace

#endif //LAGSHTEXCEPTIONS_SEEN