SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
error.hpp
Go to the documentation of this file.
1 /*
2  * Copyright(c):
3  * Signal Image and Communications (SIC) Department
4  * http://www.sic.sp2mi.univ-poitiers.fr/
5  * - University of Poitiers, France http://www.univ-poitiers.fr
6  * - XLIM Institute UMR CNRS 7252 http://www.xlim.fr/
7  *
8  * and
9  *
10  * D2 Fluid, Thermic and Combustion
11  * - University of Poitiers, France http://www.univ-poitiers.fr
12  * - PPRIME Institute - UPR CNRS 3346 http://www.pprime.fr
13  * - ISAE-ENSMA http://www.ensma.fr
14  *
15  * Contributor(s):
16  * The SLIP team,
17  * Benoit Tremblais <tremblais_AT_sic.univ-poitiers.fr>,
18  * Laurent David <laurent.david_AT_lea.univ-poitiers.fr>,
19  * Ludovic Chatellier <ludovic.chatellier_AT_univ-poitiers.fr>,
20  * Lionel Thomas <lionel.thomas_AT_univ-poitiers.fr>,
21  * Denis Arrivault <arrivault_AT_sic.univ-poitiers.fr>,
22  * Julien Dombre <julien.dombre_AT_univ-poitiers.fr>.
23  *
24  * Description:
25  * The Simple Library of Image Processing (SLIP) is a new image processing
26  * library. It is written in the C++ language following as much as possible
27  * the ISO/ANSI C++ standard. It is consequently compatible with any system
28  * satisfying the ANSI C++ complience. It works on different Unix , Linux ,
29  * Mircrosoft Windows and Mac OS X plateforms. SLIP is a research library that
30  * was created by the Signal, Image and Communications (SIC) departement of
31  * the XLIM, UMR 7252 CNRS Institute in collaboration with the Fluids, Thermic
32  * and Combustion departement of the P', UPR 3346 CNRS Institute of the
33  * University of Poitiers.
34  *
35  * The SLIP Library source code has been registered to the APP (French Agency
36  * for the Protection of Programs) by the University of Poitiers and CNRS,
37  * under registration number IDDN.FR.001.300034.000.S.P.2010.000.21000.
38 
39  * http://www.sic.sp2mi.univ-poitiers.fr/slip/
40  *
41  * This software is governed by the CeCILL-C license under French law and
42  * abiding by the rules of distribution of free software. You can use,
43  * modify and/ or redistribute the software under the terms of the CeCILL-C
44  * license as circulated by CEA, CNRS and INRIA at the following URL
45  * http://www.cecill.info.
46  * As a counterpart to the access to the source code and rights to copy,
47  * modify and redistribute granted by the license, users are provided only
48  * with a limited warranty and the software's author, the holder of the
49  * economic rights, and the successive licensors have only limited
50  * liability.
51  *
52  * In this respect, the user's attention is drawn to the risks associated
53  * with loading, using, modifying and/or developing or reproducing the
54  * software by the user in light of its specific status of free software,
55  * that may mean that it is complicated to manipulate, and that also
56  * therefore means that it is reserved for developers and experienced
57  * professionals having in-depth computer knowledge. Users are therefore
58  * encouraged to load and test the software's suitability as regards their
59  * requirements in conditions enabling the security of their systems and/or
60  * data to be ensured and, more generally, to use and operate it in the
61  * same conditions as regards security.
62  *
63  * The fact that you are presently reading this means that you have had
64  * knowledge of the CeCILL-C license and that you accept its terms.
65  */
66 
67 
74 #ifndef SLIP_ERROR_HPP
75 #define SLIP_ERROR_HPP
76 
77 #include <string>
78 
79 namespace slip
80 {
81 
82  const std::string FILE_OPEN_ERROR = "Fail to open file: ";
83  const std::string CROSSCORRELATION_BAD_ALGO = "Bad crosscorrelation algorithm selection: standard algorithm by default";
84  const std::string SINGULAR_MATRIX_ERROR = "This matrix is singular";
85  const std::string POSITIVE_DEFINITE_MATRIX_ERROR = "This matrix is not positive definite";
86 
87  const std::string GRID_INIT_POINT_ERROR = "The init points of the grid are different";
88  const std::string GRID_STEP_ERROR = "The grid steps of the grid are different";
89 
90  const std::string FILE_READ_ERROR = "Unable to read the file ";
91  const std::string FILE_WRITE_ERROR = "Unable to write into the file ";
92  const std::string BAD_DIMENSION = "Bad dimension parameter.";
93  const std::string BAD_PARAMETER = "Bad parameter.";
94 
95 
106 class slip_exception : public std::exception {
107 
108 private:
109  std::string package_name;
110  std::string function_name;
111  std::string message;
112  int label;
113 
114 public:
115  slip_exception() throw ();
116  slip_exception(const std::string&, const std::string&, const std::string&) throw ();
117  slip_exception(const slip_exception& orig) throw ();
118  virtual ~slip_exception() throw ();
119 
120  virtual slip_exception & operator=(const slip_exception&) throw ();
121 
122  virtual const char* what() const throw ();
123 
124  std::string what_str() const throw ();
125 
126  const std::string & getFunction_name() const {
127  return this->function_name;
128  }
129 
130  void setFunction_name(std::string function_name) {
131  this->function_name = function_name;
132  }
133 
134  const std::string & getMessage() const {
135  return this->message;
136  }
137 
138  void setMessage(std::string message) {
139  this->message = message;
140  }
141 
142  const std::string & getPackage_name() const {
143  return package_name;
144  }
145 
146  void setPackage_name(std::string package_name) {
147  this->package_name = package_name;
148  }
149 
150  const int & getLabel() const {
151  return this->label;
152  }
153 
154  void setLabel(const int &label) {
155  this->label = label;
156  }
157 
158 };
159 
160 }//::slip
161 
162 
163 namespace slip {
164 
166  : std::exception(), package_name(), function_name(), message(), label(-1) {
167 }
168 
169 slip_exception::slip_exception(const std::string& p_name, const std::string& f_name, const std::string& mess) throw ()
170  : std::exception(), package_name(p_name), function_name(f_name), message(mess), label(0) {
171 }
172 
174  : package_name(orig.package_name), function_name(orig.function_name), message(orig.message), label(orig.label) {
175 }
176 
178 }
179 
181  this->package_name = orig.package_name;
182  this->function_name = orig.function_name;
183  this->message = orig.message;
184  this->label = orig.label;
185  return *this;
186 }
187 
188 const char* slip_exception::what() const throw () {
189  std::string what_mess;
190  what_mess += package_name;
191  what_mess += "::";
192  what_mess += function_name;
193  what_mess += "::";
194  what_mess += message;
195  return what_mess.c_str();
196 }
197 
198 std::string slip_exception::what_str() const throw () {
199  std::string what_mess;
200  what_mess += package_name;
201  what_mess += "::";
202  what_mess += function_name;
203  what_mess += "::";
204  what_mess += message;
205  return what_mess;
206 }
207 }//::slip
208 
209 #endif //SLIP_ERROR_HPP
virtual slip_exception & operator=(const slip_exception &)
Definition: error.hpp:180
const std::string BAD_DIMENSION
Definition: error.hpp:92
const std::string & getMessage() const
Definition: error.hpp:134
void setMessage(std::string message)
Definition: error.hpp:138
const std::string FILE_WRITE_ERROR
Definition: error.hpp:91
standard exception extension name have been changed to eliminate conflicts with QT ...
Definition: error.hpp:106
const int & getLabel() const
Definition: error.hpp:150
const std::string FILE_OPEN_ERROR
Definition: error.hpp:82
const std::string & getFunction_name() const
Definition: error.hpp:126
const std::string SINGULAR_MATRIX_ERROR
Definition: error.hpp:84
const std::string & getPackage_name() const
Definition: error.hpp:142
void setLabel(const int &label)
Definition: error.hpp:154
const std::string GRID_STEP_ERROR
Definition: error.hpp:88
const std::string GRID_INIT_POINT_ERROR
Definition: error.hpp:87
virtual ~slip_exception()
Definition: error.hpp:177
const std::string POSITIVE_DEFINITE_MATRIX_ERROR
Definition: error.hpp:85
void setFunction_name(std::string function_name)
Definition: error.hpp:130
virtual const char * what() const
Definition: error.hpp:188
const std::string BAD_PARAMETER
Definition: error.hpp:93
void setPackage_name(std::string package_name)
Definition: error.hpp:146
std::string what_str() const
Definition: error.hpp:198
const std::string CROSSCORRELATION_BAD_ALGO
Definition: error.hpp:83
const std::string FILE_READ_ERROR
Definition: error.hpp:90