JackTrip: src/RtError.h Source File

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 {
24 WARNING,
25 DEBUG_WARNING,
26 UNSPECIFIED,
27 NO_DEVICES_FOUND,
28 INVALID_DEVICE,
29 MEMORY_ERROR,
30 INVALID_PARAMETER,
31 INVALID_USE,
32 DRIVER_ERROR,
33 SYSTEM_ERROR,
34 THREAD_ERROR
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_;
57 Type type_;
58 };
59
60 #endif
RtError::getMessage
virtual const std::string & getMessage(void) const
Returns the thrown error message string.
Definition: RtError.h:50
RtError::~RtError
virtual ~RtError(void)
The destructor.
Definition: RtError.h:41
RtError::what
virtual const char * what(void) const
Returns the thrown error message as a c-style string.
Definition: RtError.h:53
RtError::INVALID_PARAMETER
Definition: RtError.h:30
RtError::WARNING
Definition: RtError.h:24
RtError::INVALID_USE
Definition: RtError.h:31
RtError::getType
virtual const Type & getType(void) const
Returns the thrown error message type.
Definition: RtError.h:47
RtError::NO_DEVICES_FOUND
Definition: RtError.h:27
RtError::printMessage
virtual void printMessage(void) const
Prints thrown error message to stderr.
Definition: RtError.h:44
RtError::SYSTEM_ERROR
Definition: RtError.h:33
RtError::Type
Type
Defined RtError types.
Definition: RtError.h:23
RtError::RtError
RtError(const std::string &message, Type type=RtError::UNSPECIFIED)
The constructor.
Definition: RtError.h:38
RtError
Exception handling class for RtAudio & RtMidi.
Definition: RtError.h:19
RtError::message_
std::string message_
Definition: RtError.h:56
RtError::DRIVER_ERROR
Definition: RtError.h:32
RtError::INVALID_DEVICE
Definition: RtError.h:28
RtError::DEBUG_WARNING
Definition: RtError.h:25
RtError::UNSPECIFIED
Definition: RtError.h:26
RtError::MEMORY_ERROR
Definition: RtError.h:29
RtError::type_
Type type_
Definition: RtError.h:57
RtError::THREAD_ERROR
Definition: RtError.h:34