Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


RtError.h

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     WARNING,           
00025     DEBUG_WARNING,     
00026     UNSPECIFIED,       
00027     NO_DEVICES_FOUND,  
00028     INVALID_DEVICE,    
00029     MEMORY_ERROR,      
00030     INVALID_PARAMETER, 
00031     INVALID_USE,       
00032     DRIVER_ERROR,      
00033     SYSTEM_ERROR,      
00034     THREAD_ERROR       
00035   };
00036 
00038   RtError( const std::string& message, Type type = RtError::UNSPECIFIED ) throw() : message_(message), type_(type) {}
00039  
00041   virtual ~RtError( void ) throw() {}
00042 
00044   virtual void printMessage( void ) const throw() { std::cerr << '\n' << message_ << "\n\n"; }
00045 
00047   virtual const Type& getType(void) const throw() { return type_; }
00048 
00050   virtual const std::string& getMessage(void) const throw() { return message_; }
00051 
00053   virtual const char* what( void ) const throw() { return message_.c_str(); }
00054 
00055  protected:
00056   std::string message_;
00057   Type type_;
00058 };
00059 
00060 #endif

The Synthesis ToolKit in C++ (STK)
©1995-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.