codac
codac_Exception.h
Go to the documentation of this file.
1 
12 // For maximum portability, we recommend you use __func__, but provide a fallback definition with the preprocessor:
13 // https://gcc.gnu.org/onlinedocs/gcc-4.8.1/gcc/Function-Names.html
14 #ifndef __CODAC_EXCEPTION_H__
15 #define __CODAC_EXCEPTION_H__
16 
17 #if __STDC_VERSION__ < 199901L
18 # if __GNUC__ >= 2
19 # define __func__ __FUNCTION__
20 # else
21 # define __func__ "<unknown>"
22 # endif
23 #endif
24 
25 #include <iostream>
26 #include <exception>
27 #include <string>
28 #include <sstream>
29 
30 namespace codac
31 {
36  class Exception : public std::exception
37  {
38  public:
39 
46  Exception(const std::string& function_name, const std::string& custom_message);
47 
51  ~Exception() throw() {};
52 
58  virtual const char* what() const throw();
59 
60  protected:
61 
62  std::string m_what_msg;
63  };
64 
65  std::ostream& operator<<(std::ostream& os, const Exception& e);
66 }
67 
68 #endif
FixPoint of a separator The fixpoint of a separator is computed by calling the "::"separate function ...
Definition: codac_capd_helpers.h:9
~Exception()
Exception destructor.
Definition: codac_Exception.h:51
Root class of all exceptions raised by Codac.
Definition: codac_Exception.h:36
virtual const char * what() const
Returns the exception message.
Exception(const std::string &function_name, const std::string &custom_message)
Creates an std::exception related to a C++ function and some custom error message.