00001 /************************************************************************/ 00010 /************************************************************************/ 00011 00012 #ifndef RTERROR_H 00013 #define RTERROR_H 00014 00015 #include <exception> 00016 #include <iostream> 00017 #include <string> 00018 00019 class RtError : public std::exception 00020 { 00021 public: 00023 enum Type { 00024 UNSPECIFIED, 00025 NO_DEVICES_FOUND, 00026 INVALID_DEVICE, 00027 MEMORY_ERROR, 00028 INVALID_PARAMETER, 00029 INVALID_USE, 00030 DRIVER_ERROR, 00031 SYSTEM_ERROR, 00032 THREAD_ERROR 00033 }; 00034 00036 RtError( const std::string& message, Type type = RtError::UNSPECIFIED ) throw() : message_(message), type_(type) {} 00037 00039 virtual ~RtError( void ) throw() {} 00040 00042 virtual void printMessage( void ) throw() { std::cerr << '\n' << message_ << "\n\n"; } 00043 00045 virtual const Type& getType(void) throw() { return type_; } 00046 00048 virtual const std::string& getMessage(void) throw() { return message_; } 00049 00051 virtual const char* what( void ) const throw() { return message_.c_str(); } 00052 00053 protected: 00054 std::string message_; 00055 Type type_; 00056 }; 00057 00058 #endif
![]() |
©2001-2007 Gary P. Scavone, McGill University. All Rights Reserved. Maintained by Gary P. Scavone. |