CEBL  2.1
Exceptions.hpp
Go to the documentation of this file.
1 /*
2 * CEBL : CSU EEG Brain-Computer Interface Lab
3 *
4 * Author: Jeshua Bratman - jeshuabratman@gmail.com
5 *
6 * This file is part of CEBL.
7 *
8 * CEBL is free software; you can redistribute it and/or modify it.
9 * We only ask that if you use our code that you cite the source in
10 * your project or publication.
11 *
12 * EEG Group (www.cs.colostate.edu/eeg)
13 * Department of Computer Science
14 * Colorado State University
15 *
16 */
17 
26 #ifndef EXCEPTIONS_H
27 #define EXCEPTIONS_H
28 
29 #include <exception>
30 #include <string>
31 using std::string;
32 
34 class FileException : public std::exception
35 {
36 private:
37 
38  string message;
39 
40 public:
41  FileException(string message)
42  {
43  this->message = message;
44  }
45 
46  virtual ~FileException() throw(){};
47 
48  virtual const char * what() const throw()
49  {
50  return string("FileException: "+message).c_str();
51  }
52 };
54 class MatrixException : public std::exception
55 {
56 private:
57 
58  string message;
59 
60 public:
61  MatrixException(string message)
62  {
63  this->message = message;
64  }
65 
66  virtual ~MatrixException() throw(){};
67 
68  virtual const char * what() const throw()
69  {
70  return string("MatrixException: "+message).c_str();
71  }
72 };
73 
75 class DataException : public std::exception
76 {
77 protected:
78  string message;
79 
80 public:
82  {
83  this->message = message;
84  }
85 
86  virtual ~DataException() throw() {};
87 
88  virtual const char * what() const throw()
89  {
90  return string("DataException: " + message).c_str();
91  }
92 };
93 
95 {
96 public:
98  {}
99  virtual ~DataExceptionUnderflow() throw() {};
100 
101  virtual const char * what() const throw()
102  {
103  return string("DataExceptionUnderflow: " + message).c_str();
104  }
105 };
106 
107 
108 
110 class DeviceException : public std::exception
111 {
112 protected:
113  string message;
114 
115 public:
117  {
118  this->message = message;
119  }
120 
121  virtual ~DeviceException() throw() {};
122 
123  virtual const char * what() const throw()
124  {
125  return string("DeviceException: " + message).c_str();
126  }
127 };
128 
130 class DataSourceException : public std::exception
131 {
132 protected:
133  string message;
134 
135 public:
137  {
138  this->message = message;
139  }
140 
141  virtual ~DataSourceException() throw() {};
142 
143  virtual const char * what() const throw()
144  {
145  return string("DataSourceException: " + message).c_str();
146  }
147 };
148 
150 class DataProcessException : public std::exception
151 {
152 protected:
153  string message;
154 
155 public:
157  {
158  this->message = message;
159  }
160 
161  virtual ~DataProcessException() throw() {};
162 
163  virtual const char * what() const throw()
164  {
165  return string("DataProcessException: " + message).c_str();
166  }
167 };
168 
170 class PluginException : public std::exception
171 {
172 protected:
173  string message;
174 
175 public:
177  {
178  this->message = message;
179  }
180 
181  virtual ~PluginException() throw() {};
182 
183  virtual const char * what() const throw()
184  {
185  return string("PluginException: " + message).c_str();
186  }
187 };
188 
189 
191 class TrainingException : public std::exception
192 {
193 protected:
194  string message;
195 
196 public:
198  {
199  this->message = message;
200  }
201 
202  virtual ~TrainingException() throw() {};
203 
204  virtual const char * what() const throw()
205  {
206  return string("TrainingException: " + message).c_str();
207  }
208 };
209 
211 class ClassificationException : public std::exception
212 {
213 protected:
214  string message;
215 
216 public:
218  {
219  this->message = message;
220  }
221 
222  virtual ~ClassificationException() throw() {};
223 
224  virtual const char * what() const throw()
225  {
226  return string("ClassificationException: " + message).c_str();
227  }
228 };
229 
230 
232 class FeatureException : public std::exception
233 {
234 protected:
235  string message;
236 
237 public:
239  {
240  this->message = message;
241  }
242 
243  virtual ~FeatureException() throw() {};
244 
245  virtual const char * what() const throw()
246  {
247  return string("FeatureException: " + message).c_str();
248  }
249 };
250 
251 
253 class InturruptException : public std::exception
254 {
255 protected:
256  string message;
257 
258 public:
260  {
261  this->message = message;
262  }
263 
264  virtual ~InturruptException() throw() {};
265 
266  virtual const char * what() const throw()
267  {
268  return string("InturruptException: " + message).c_str();
269  }
270 };
271 
272 
273 
275 class StringTableException : public std::exception
276 {
277 protected:
278  string message;
279 
280 public:
282  {
283  this->message = message;
284  }
285 
286  virtual ~StringTableException() throw() {};
287 
288  virtual const char * what() const throw()
289  {
290  return string("StringTableException: " + message).c_str();
291  }
292 };
293 
294 #endif