ComPWA
Common Partial-Wave-Analysis Framework
Exceptions.hpp
Go to the documentation of this file.
1 // Copyright (c) 2013, 2017 The ComPWA Team.
2 // This file is part of the ComPWA framework, check
3 // https://github.com/ComPWA/ComPWA/license.txt for details.
4 
9 
10 #ifndef PWAEXCEPTIONS_H
11 #define PWAEXCEPTIONS_H
12 
13 #include <exception>
14 #include <string>
15 
16 namespace ComPWA {
17 
24 class Exception : public std::exception {
25 public:
26  Exception(const Exception &e) throw() : std::exception(e), what_(e.what_) {}
27 
28  Exception &operator=(const Exception &rhs) throw() {
29  what_ = rhs.what_;
30  return *this;
31  }
32 
33  virtual ~Exception() throw() {}
34 
35  virtual const char *what() const throw() { return what_.c_str(); }
36 
37 protected:
38  Exception(const char *w = "") throw() : what_(w) {}
39 
40  Exception(const std::string &w) throw() : what_(w) {}
41 
42  std::string what_;
43 };
44 
45 //------------------------------------------------------------------------------
49 //------------------------------------------------------------------------------
50 class BadConfig : public Exception {
51 public:
52  BadConfig(const std::string &error) : Exception(error) {}
53  BadConfig(const char *error) : Exception(error) {}
54  virtual ~BadConfig() throw() {}
55 };
56 
57 //------------------------------------------------------------------------------
61 //------------------------------------------------------------------------------
62 class BadParameter : public Exception {
63 public:
64  BadParameter(const std::string &error) : Exception(error) {}
65  BadParameter(const char *error) : Exception(error) {}
66  virtual ~BadParameter() throw() {}
67 };
68 
69 //------------------------------------------------------------------------------
73 //------------------------------------------------------------------------------
74 class BadIndex : public Exception {
75 public:
76  BadIndex(const std::string &error) : Exception(error) {}
77  BadIndex(const char *error) : Exception(error) {}
78  virtual ~BadIndex() throw() {}
79 };
80 
81 //------------------------------------------------------------------------------
85 //------------------------------------------------------------------------------
86 class CorruptFile : public Exception {
87 public:
88  CorruptFile(const std::string &error) : Exception(error) {}
89  CorruptFile(const char *error) : Exception(error) {}
90  virtual ~CorruptFile() throw() {}
91 };
92 
93 //------------------------------------------------------------------------------
97 //------------------------------------------------------------------------------
98 class ParameterFixed : public Exception {
99 public:
100  ParameterFixed(const std::string &error = "Parameter fixed")
101  : Exception(error) {}
102  ParameterFixed(const char *error) : Exception(error) {}
103  virtual ~ParameterFixed() throw() {}
104 };
105 
106 //------------------------------------------------------------------------------
110 //------------------------------------------------------------------------------
111 class WrongParType : public Exception {
112 public:
113  WrongParType(const std::string &error = "Parameter type wrong!")
114  : Exception(error) {}
115  WrongParType(const char *error) : Exception(error) {}
116  virtual ~WrongParType() throw() {}
117 };
118 
119 //------------------------------------------------------------------------------
123 //------------------------------------------------------------------------------
124 class BeyondPhsp : public Exception {
125 public:
126  BeyondPhsp(const std::string &error = "Data beyond phsp!")
127  : Exception(error) {}
128  BeyondPhsp(const char *error) : Exception(error) {}
129  virtual ~BeyondPhsp() throw() {}
130 };
131 
132 //------------------------------------------------------------------------------
136 //------------------------------------------------------------------------------
137 class WrongVariableID : public Exception {
138 public:
139  WrongVariableID(const std::string &error = "Variable does not exist!")
140  : Exception(error) {}
141  WrongVariableID(const char *error) : Exception(error) {}
142  virtual ~WrongVariableID() throw() {}
143 };
144 //------------------------------------------------------------------------------
148 //------------------------------------------------------------------------------
150 public:
152  const std::string &error = "Variable not within its limits!")
153  : Exception(error) {}
154  ParameterOutOfBound(const char *error) : Exception(error) {}
155  virtual ~ParameterOutOfBound() throw() {}
156 };
157 //------------------------------------------------------------------------------
161 //------------------------------------------------------------------------------
162 class TreeBuildError : public Exception {
163 public:
164  TreeBuildError(const std::string &error = "Tree can not be build!")
165  : Exception(error) {}
166  TreeBuildError(const char *error) : Exception(error) {}
167  virtual ~TreeBuildError() throw() {}
168 };
169 
170 } /* namespace ComPWA */
171 #endif
172 //******************************************************************************
174 //******************************************************************************
Exception(const Exception &e)
Definition: Exceptions.hpp:26
Parameter not existing.
Definition: Exceptions.hpp:62
BadParameter(const char *error)
Definition: Exceptions.hpp:65
ParameterOutOfBound(const char *error)
Definition: Exceptions.hpp:154
WrongParType(const char *error)
Definition: Exceptions.hpp:115
virtual ~BeyondPhsp()
Definition: Exceptions.hpp:129
BadIndex(const std::string &error)
Definition: Exceptions.hpp:76
Exception(const char *w="")
Definition: Exceptions.hpp:38
Input data file is corrupt or incomplete.
Definition: Exceptions.hpp:86
virtual ~BadConfig()
Definition: Exceptions.hpp:54
BadParameter(const std::string &error)
Definition: Exceptions.hpp:64
CorruptFile(const std::string &error)
Definition: Exceptions.hpp:88
TreeBuildError(const std::string &error="Tree can not be build!")
Definition: Exceptions.hpp:164
BadConfig(const char *error)
Definition: Exceptions.hpp:53
virtual ~BadParameter()
Definition: Exceptions.hpp:66
BeyondPhsp(const std::string &error="Data beyond phsp!")
Definition: Exceptions.hpp:126
cmplx FADDEEVA() w(cmplx z, double relerr)
Definition: Faddeeva.cc:668
BadConfig(const std::string &error)
Definition: Exceptions.hpp:52
BadIndex(const char *error)
Definition: Exceptions.hpp:77
BeyondPhsp(const char *error)
Definition: Exceptions.hpp:128
ParameterFixed(const char *error)
Definition: Exceptions.hpp:102
Exception & operator=(const Exception &rhs)
Definition: Exceptions.hpp:28
Parameter out of bound.
Definition: Exceptions.hpp:149
virtual ~BadIndex()
Definition: Exceptions.hpp:78
WrongVariableID(const std::string &error="Variable does not exist!")
Definition: Exceptions.hpp:139
ComPWA Exceptions base class.
Definition: Exceptions.hpp:24
virtual ~Exception()
Definition: Exceptions.hpp:33
ParameterOutOfBound(const std::string &error="Variable not within its limits!")
Definition: Exceptions.hpp:151
Exception(const std::string &w)
Definition: Exceptions.hpp:40
virtual ~CorruptFile()
Definition: Exceptions.hpp:90
Config is not complete.
Definition: Exceptions.hpp:50
CorruptFile(const char *error)
Definition: Exceptions.hpp:89
Error in tree at construction.
Definition: Exceptions.hpp:162
Parameter cannot be changed.
Definition: Exceptions.hpp:98
TreeBuildError(const char *error)
Definition: Exceptions.hpp:166
WrongVariableID(const char *error)
Definition: Exceptions.hpp:141
Data beyond phasespace requested.
Definition: Exceptions.hpp:124
ParameterFixed(const std::string &error="Parameter fixed")
Definition: Exceptions.hpp:100
Index out of range.
Definition: Exceptions.hpp:74
Variable not found.
Definition: Exceptions.hpp:137
Parameter of wrong type.
Definition: Exceptions.hpp:111
std::string what_
Definition: Exceptions.hpp:42
WrongParType(const std::string &error="Parameter type wrong!")
Definition: Exceptions.hpp:113
virtual const char * what() const
Definition: Exceptions.hpp:35