CEBL  2.1
cppR_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 
18 
19 #ifndef CPPREXCEPTIONS_H
20 #define CPPREXCEPTIONS_H
21 #include <exception>
22 #include <string>
23 using std::string;
24 
25 
26 
27 
28 class cppRException : public std::exception
29 {
30 private:
31  string message;
32 
33 public:
34  cppRException(string message)
35  {
36  this->message = message;
37  }
38 
39  virtual ~cppRException() throw(){};
40 
41  virtual const char * what() const throw()
42  {
43  return string("cppRException: "+message).c_str();
44  }
45 };
46 
47 
53 inline void cppR_assert(bool condition, const char * message)
54 {
55  if(!condition)
56  throw(cppRException(message));
57 }
58 
59 
60 
61 #endif