libsdr  0.1.0
A simple SDR library
exception.hh
1 #ifndef __SDR_EXCEPTION_HH__
2 #define __SDR_EXCEPTION_HH__
3 
4 #include <exception>
5 #include <sstream>
6 
7 namespace sdr {
8 
10 class SDRError : public std::exception, public std::stringstream {
11 public:
13  SDRError(): std::exception(), std::stringstream() { }
15  SDRError(const SDRError &other)
16  : std::exception(), std::stringstream() { this->str(other.str()); }
18  virtual ~SDRError() throw() { }
20  virtual const char *what() const throw() { return this->str().c_str(); }
21 };
22 
24 class ConfigError : public SDRError {
25 public:
29  ConfigError(const ConfigError &other): SDRError(other) {}
31  virtual ~ConfigError() throw() { }
32 };
33 
34 
36 class RuntimeError: public SDRError {
37 public:
41  RuntimeError(const RuntimeError &other): SDRError(other) {}
43  virtual ~RuntimeError() throw() { }
44 };
45 
46 
47 
48 }
49 #endif // __SDR_EXCEPTION_HH__
virtual ~ConfigError()
Destructor.
Definition: exception.hh:31
virtual const char * what() const
Implements the std::exception interface.
Definition: exception.hh:20
ConfigError(const ConfigError &other)
Copy constructor.
Definition: exception.hh:29
Definition: autocast.hh:8
Definition: operators.hh:9
Base class of all SDR exceptions.
Definition: exception.hh:10
The runtime error class.
Definition: exception.hh:36
virtual ~RuntimeError()
Destructor.
Definition: exception.hh:43
SDRError(const SDRError &other)
Copy constructor.
Definition: exception.hh:15
RuntimeError()
Constructor.
Definition: exception.hh:39
RuntimeError(const RuntimeError &other)
Copy constructor.
Definition: exception.hh:41
The configuration error class.
Definition: exception.hh:24
ConfigError()
Constructor.
Definition: exception.hh:27
virtual ~SDRError()
Destructor.
Definition: exception.hh:18
SDRError()
Constructor.
Definition: exception.hh:13