Canorus 0.0
RtError.h
Go to the documentation of this file.
1/************************************************************************/
10/************************************************************************/
11
12#ifndef RTERROR_H
13#define RTERROR_H
14
15#include <iostream>
16#include <string>
17
19{
20public:
22 enum Type {
34 };
35
36protected:
37 std::string message_;
39
40public:
42 RtError(const std::string& message, Type type = RtError::UNSPECIFIED) : message_(message), type_(type) {}
43
45 virtual ~RtError(void) {};
46
48 virtual void printMessage(void) { std::cerr << '\n' << message_ << "\n\n"; }
49
51 virtual const Type& getType(void) { return type_; }
52
54 virtual const std::string& getMessage(void) { return message_; }
55
57 virtual const char *getMessageString(void) { return message_.c_str(); }
58};
59
60#endif
Exception handling class for RtAudio & RtMidi.
Definition: RtError.h:19
virtual ~RtError(void)
The destructor.
Definition: RtError.h:45
std::string message_
Definition: RtError.h:37
virtual const std::string & getMessage(void)
Returns the thrown error message string.
Definition: RtError.h:54
RtError(const std::string &message, Type type=RtError::UNSPECIFIED)
The constructor.
Definition: RtError.h:42
Type
Defined RtError types.
Definition: RtError.h:22
@ DEBUG_WARNING
Definition: RtError.h:24
@ WARNING
Definition: RtError.h:23
@ UNSPECIFIED
Definition: RtError.h:25
@ SYSTEM_ERROR
Definition: RtError.h:32
@ DRIVER_ERROR
Definition: RtError.h:31
@ INVALID_PARAMETER
Definition: RtError.h:30
@ MEMORY_ERROR
Definition: RtError.h:29
@ INVALID_DEVICE
Definition: RtError.h:27
@ INVALID_STREAM
Definition: RtError.h:28
@ THREAD_ERROR
Definition: RtError.h:33
@ NO_DEVICES_FOUND
Definition: RtError.h:26
Type type_
Definition: RtError.h:38
virtual const Type & getType(void)
Returns the thrown error message type.
Definition: RtError.h:51
virtual void printMessage(void)
Prints thrown error message to stderr.
Definition: RtError.h:48
virtual const char * getMessageString(void)
Returns the thrown error message as a C string.
Definition: RtError.h:57