GeoTessCPP 2.6.1 Software to facilitate storage and retrieval of 3D information about the Earth.

Loading...
Searching...
No Matches
GeoTessException.h
Go to the documentation of this file.
1//- ****************************************************************************
2//-
3//- Copyright 2009 Sandia Corporation. Under the terms of Contract
4//- DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government
5//- retains certain rights in this software.
6//-
7//- BSD Open Source License.
8//- All rights reserved.
9//-
10//- Redistribution and use in source and binary forms, with or without
11//- modification, are permitted provided that the following conditions are met:
12//-
13//- * Redistributions of source code must retain the above copyright notice,
14//- this list of conditions and the following disclaimer.
15//- * Redistributions in binary form must reproduce the above copyright
16//- notice, this list of conditions and the following disclaimer in the
17//- documentation and/or other materials provided with the distribution.
18//- * Neither the name of Sandia National Laboratories nor the names of its
19//- contributors may be used to endorse or promote products derived from
20//- this software without specific prior written permission.
21//-
22//- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23//- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24//- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25//- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
26//- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27//- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28//- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29//- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30//- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31//- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32//- POSSIBILITY OF SUCH DAMAGE.
33//-
34//- ****************************************************************************
35
36#ifndef GEOTESSException_H
37#define GEOTESSException_H
38
39// **** _SYSTEM INCLUDES_ ******************************************************
40
41#include <sstream>
42
43// **** _LOCAL INCLUDES_ *******************************************************
44
45#include "CPPUtils.h"
46#include "GeoTessUtils.h"
47
48// **** _BEGIN GEOTESS NAMESPACE_ **********************************************
49
50 namespace geotess
51{
52
53// **** _FORWARD REFERENCES_ ***************************************************
54
55// **** _CLASS DEFINITION_ *****************************************************
56
65 class GEOTESS_EXP_IMP GeoTessException
66{
67 public:
68
72 string emessage;
73
77 int ecode;
78
82 GeoTessException(std::string message, int code)
83 : emessage(message), ecode(code)
84 {
85 }
86
93 GeoTessException(ostringstream& os, const string& file, int line, int code)
94 : emessage(""), ecode(code)
95 {
96 os << "OS: " << CPPUtils::getOpSys() << ", Version: "
97 << GeoTessUtils::getVersion() << ", File: " << file
98 << ", Line: " << line << endl << endl;
99 emessage = os.str();
100 }
101
108 GeoTessException(const string& msg, const string& file, int line, int code)
109 : emessage(""), ecode(code)
110 {
111 emessage = msg + "\nOS: " + CPPUtils::getOpSys() + ", Version: "
112 + GeoTessUtils::getVersion() + ", File: " + file + ", Line: "
113 + CPPUtils::itos(line) + "\n\n";
114 }
115
119 virtual ~GeoTessException()
120 {
121 }
122
126 static void appendInfo(ostringstream& os, const string& file, int line)
127 {
128 os << "Version: " << GeoTessUtils::getVersion() << ", File: " << file
129 << ", Line: " << line << endl << endl;
130 }
131
135 static void appendInfo(string& msg, const string& file, int line)
136 {
137 msg += "\nVersion: " + GeoTessUtils::getVersion() + ", File: " + file
138 + ", Line: " + CPPUtils::itos(line) + "\n\n";
139 }
140
141};
142// end class GeoTessException
143
144}// end geotess namespace
145
146#endif // GEOTESSException_H
GEOTESS_EXP_IMP
#define GEOTESS_EXP_IMP
Definition CPPGlobals.h:71
CPPUtils.h
GeoTessUtils.h
geotess::CPPUtils::getOpSys
static const string getOpSys()
geotess::CPPUtils::itos
static string itos(int i, const string &frmt="%d")
geotess::GeoTessException::ecode
int ecode
Definition GeoTessException.h:77
geotess::GeoTessException::GeoTessException
GeoTessException(ostringstream &os, const string &file, int line, int code)
Definition GeoTessException.h:93
geotess::GeoTessException::~GeoTessException
virtual ~GeoTessException()
Definition GeoTessException.h:119
geotess::GeoTessException::GeoTessException
GeoTessException(std::string message, int code)
Definition GeoTessException.h:82
geotess::GeoTessException::emessage
string emessage
Definition GeoTessException.h:72
geotess::GeoTessException::GeoTessException
GeoTessException(const string &msg, const string &file, int line, int code)
Definition GeoTessException.h:108
geotess::GeoTessException::appendInfo
static void appendInfo(ostringstream &os, const string &file, int line)
Definition GeoTessException.h:126
geotess::GeoTessException::appendInfo
static void appendInfo(string &msg, const string &file, int line)
Definition GeoTessException.h:135
geotess::GeoTessUtils::getVersion
static string getVersion()
Definition GeoTessUtils.h:125
geotess
Definition ArrayReuse.h:55