JackTrip
RtError.h
Go to the documentation of this file.
1 /************************************************************************/
10 /************************************************************************/
11 
12 #ifndef RTERROR_H
13 #define RTERROR_H
14 
15 #include <exception>
16 #include <iostream>
17 #include <string>
18 
19 class RtError : public std::exception
20 {
21  public:
23  enum Type {
35  };
36 
38  RtError( const std::string& message, Type type = RtError::UNSPECIFIED ) throw() : message_(message), type_(type) {}
39 
41  virtual ~RtError( void ) throw() {}
42 
44  virtual void printMessage( void ) const throw() { std::cerr << '\n' << message_ << "\n\n"; }
45 
47  virtual const Type& getType(void) const throw() { return type_; }
48 
50  virtual const std::string& getMessage(void) const throw() { return message_; }
51 
53  virtual const char* what( void ) const throw() { return message_.c_str(); }
54 
55  protected:
56  std::string message_;
58 };
59 
60 #endif
virtual const std::string & getMessage(void) const
Returns the thrown error message string.
Definition: RtError.h:50
virtual ~RtError(void)
The destructor.
Definition: RtError.h:41
virtual const char * what(void) const
Returns the thrown error message as a c-style string.
Definition: RtError.h:53
Definition: RtError.h:30
Definition: RtError.h:24
Definition: RtError.h:31
virtual const Type & getType(void) const
Returns the thrown error message type.
Definition: RtError.h:47
Definition: RtError.h:27
virtual void printMessage(void) const
Prints thrown error message to stderr.
Definition: RtError.h:44
Definition: RtError.h:33
Type
Defined RtError types.
Definition: RtError.h:23
RtError(const std::string &message, Type type=RtError::UNSPECIFIED)
The constructor.
Definition: RtError.h:38
Exception handling class for RtAudio & RtMidi.
Definition: RtError.h:19
std::string message_
Definition: RtError.h:56
Definition: RtError.h:32
Definition: RtError.h:28
Definition: RtError.h:25
Definition: RtError.h:26
Definition: RtError.h:29
Type type_
Definition: RtError.h:57
Definition: RtError.h:34