00001 /****************************************************************************** 00002 * 00003 * Purpose: Declaration of the PCIDSKException class. All exceptions thrown 00004 * by the PCIDSK library will be of this type. 00005 * 00006 ****************************************************************************** 00007 * Copyright (c) 2009 00008 * PCI Geomatics, 50 West Wilmot Street, Richmond Hill, Ont, Canada 00009 * 00010 * Permission is hereby granted, free of charge, to any person obtaining a 00011 * copy of this software and associated documentation files (the "Software"), 00012 * to deal in the Software without restriction, including without limitation 00013 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00014 * and/or sell copies of the Software, and to permit persons to whom the 00015 * Software is furnished to do so, subject to the following conditions: 00016 * 00017 * The above copyright notice and this permission notice shall be included 00018 * in all copies or substantial portions of the Software. 00019 * 00020 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00021 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00022 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00023 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00024 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 00025 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 00026 * DEALINGS IN THE SOFTWARE. 00027 ****************************************************************************/ 00028 #ifndef __INCLUDE_PCIDSK_EXCEPTION_H 00029 #define __INCLUDE_PCIDSK_EXCEPTION_H 00030 00031 #include "pcidsk_config.h" 00032 00033 #include <string> 00034 #include <cstdarg> 00035 #include <stdexcept> 00036 00037 namespace PCIDSK 00038 { 00039 /************************************************************************/ 00040 /* Exception */ 00041 /************************************************************************/ 00042 00043 class PCIDSKException : public std::exception 00044 { 00045 public: 00046 PCIDSKException(const char *fmt, ... ); 00047 virtual ~PCIDSKException() throw(); 00048 00049 void vPrintf( const char *fmt, va_list list ); 00050 virtual const char *what() const throw() { return message.c_str(); } 00051 private: 00052 std::string message; 00053 }; 00054 00055 void PCIDSK_DLL ThrowPCIDSKException( const char *fmt, ... ); 00056 00057 } // end namespace PCIDSK 00058 00059 #endif // __INCLUDE_PCIDSK_EXCEPTION_H