GeoTessCPP
2.0.0
Software to facilitate storage and retrieval of 3D information about the Earth.
|
00001 //- **************************************************************************** 00002 //- 00003 //- Copyright 2009 Sandia Corporation. Under the terms of Contract 00004 //- DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government 00005 //- retains certain rights in this software. 00006 //- 00007 //- BSD Open Source License. 00008 //- All rights reserved. 00009 //- 00010 //- Redistribution and use in source and binary forms, with or without 00011 //- modification, are permitted provided that the following conditions are met: 00012 //- 00013 //- * Redistributions of source code must retain the above copyright notice, 00014 //- this list of conditions and the following disclaimer. 00015 //- * Redistributions in binary form must reproduce the above copyright 00016 //- notice, this list of conditions and the following disclaimer in the 00017 //- documentation and/or other materials provided with the distribution. 00018 //- * Neither the name of Sandia National Laboratories nor the names of its 00019 //- contributors may be used to endorse or promote products derived from 00020 //- this software without specific prior written permission. 00021 //- 00022 //- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00023 //- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00024 //- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00025 //- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 00026 //- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00027 //- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00028 //- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00029 //- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00030 //- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00031 //- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00032 //- POSSIBILITY OF SUCH DAMAGE. 00033 //- 00034 //- **************************************************************************** 00035 00036 #ifndef GEOTESSException_H 00037 #define GEOTESSException_H 00038 00039 // **** _SYSTEM INCLUDES_ ****************************************************** 00040 00041 #include <sstream> 00042 00043 // **** _LOCAL INCLUDES_ ******************************************************* 00044 00045 #include "CPPUtils.h" 00046 #include "GeoTessUtils.h" 00047 00048 // **** _BEGIN GEOTESS NAMESPACE_ ********************************************** 00049 00050 namespace geotess 00051 { 00052 00053 // **** _FORWARD REFERENCES_ *************************************************** 00054 00055 // **** _CLASS DEFINITION_ ***************************************************** 00056 00065 class GEOTESS_EXP_IMP GeoTessException 00066 { 00067 public: 00068 00072 string emessage; 00073 00077 int ecode; 00078 00082 GeoTessException(std::string message, int code) 00083 : emessage(message), ecode(code) 00084 { 00085 } 00086 00093 GeoTessException(ostringstream& os, const string& file, int line, int code) 00094 : emessage(""), ecode(code) 00095 { 00096 os << "OS: " << CPPUtils::getOpSys() << ", Version: " 00097 << GeoTessUtils::getVersion() << ", File: " << file 00098 << ", Line: " << line << endl << endl; 00099 emessage = os.str(); 00100 } 00101 00108 GeoTessException(const string& msg, const string& file, int line, int code) 00109 : emessage(""), ecode(code) 00110 { 00111 emessage = msg + "\nOS: " + CPPUtils::getOpSys() + ", Version: " 00112 + GeoTessUtils::getVersion() + ", File: " + file + ", Line: " 00113 + CPPUtils::itos(line) + "\n\n"; 00114 } 00115 00119 virtual ~GeoTessException() 00120 { 00121 } 00122 00126 static void appendInfo(ostringstream& os, const string& file, int line) 00127 { 00128 os << "Version: " << GeoTessUtils::getVersion() << ", File: " << file 00129 << ", Line: " << line << endl << endl; 00130 } 00131 00135 static void appendInfo(string& msg, const string& file, int line) 00136 { 00137 msg += "\nVersion: " + GeoTessUtils::getVersion() + ", File: " + file 00138 + ", Line: " + CPPUtils::itos(line) + "\n\n"; 00139 } 00140 00141 }; 00142 // end class GeoTessException 00143 00144 }// end geotess namespace 00145 00146 #endif // GEOTESSException_H