RoadError.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (c) 2008-2015 C.B. Barber. All rights reserved.
4 ** $Id: //main/2015/qhull/src/libqhullcpp/RoadError.cpp#2 $$Change: 2066 $
5 ** $DateTime: 2016/01/18 19:29:17 $$Author: bbarber $
6 **
7 ****************************************************************************/
8 
9 #
10 #
11 
12 #include "libqhullcpp/RoadError.h"
13 
14 #include <string>
15 #include <sstream>
16 #include <iostream>
17 
18 using std::cerr;
19 using std::cout;
20 using std::string;
21 
22 #ifdef _MSC_VER // Microsoft Visual C++ -- warning level 4
23 #endif
24 
25 namespace orgQhull {
26 
27 #
28 
29 const char * RoadError::
32 ROADtag= "QH";
33 
34 std::ostringstream RoadError::
36 
37 #
38 
41 : error_code(0)
42 , log_event()
43 , error_message()
44 { }
45 
47 RoadError(const RoadError &other)
48 : error_code(other.error_code)
49 , log_event(other.log_event)
50 , error_message(other.error_message)
51 {
52 }//copy construct
53 
55 RoadError(int code, const std::string &message)
56 : error_code(code)
57 , log_event(message.c_str())
58 , error_message(log_event.toString(ROADtag, error_code))
59 {
60  log_event.cstr_1= error_message.c_str(); // overwrites initial value
61 }
62 
64 RoadError(int code, const char *fmt)
65 : error_code(code)
66 , log_event(fmt)
67 , error_message()
68 { }
69 
71 RoadError(int code, const char *fmt, int d)
72 : error_code(code)
73 , log_event(fmt, d)
74 , error_message()
75 { }
76 
78 RoadError(int code, const char *fmt, int d, int d2)
79 : error_code(code)
80 , log_event(fmt, d, d2)
81 , error_message()
82 { }
83 
85 RoadError(int code, const char *fmt, int d, int d2, float f)
86 : error_code(code)
87 , log_event(fmt, d, d2, f)
88 , error_message()
89 { }
90 
92 RoadError(int code, const char *fmt, int d, int d2, float f, const char *s)
93 : error_code(code)
94 , log_event(fmt, d, d2, f, s)
95 , error_message(log_event.toString(ROADtag, code)) // char * may go out of scope
96 { }
97 
99 RoadError(int code, const char *fmt, int d, int d2, float f, const void *x)
100 : error_code(code)
101 , log_event(fmt, d, d2, f, x)
102 , error_message()
103 { }
104 
106 RoadError(int code, const char *fmt, int d, int d2, float f, int i)
107 : error_code(code)
108 , log_event(fmt, d, d2, f, i)
109 , error_message()
110 { }
111 
113 RoadError(int code, const char *fmt, int d, int d2, float f, long long i)
114 : error_code(code)
115 , log_event(fmt, d, d2, f, i)
116 , error_message()
117 { }
118 
120 RoadError(int code, const char *fmt, int d, int d2, float f, double e)
121 : error_code(code)
122 , log_event(fmt, d, d2, f, e)
123 , error_message()
124 { }
125 
127 operator=(const RoadError &other)
128 {
129  error_code= other.error_code;
131  log_event= other.log_event;
132  return *this;
133 }//operator=
134 
135 #
136 const char * RoadError::
137 what() const throw()
138 {
139  if(error_message.empty()){
140  error_message= log_event.toString(ROADtag, error_code);
141  }
142  return error_message.c_str();
143 }//what
144 
145 #
146 
147 void RoadError::
152 {
153  global_log << what() << endl;
154 }//logError
155 
156 
157 }//namespace orgQhull
158 
orgQhull::RoadError::what
virtual const char * what() const
Definition: RoadError.cpp:137
obb.fmt
fmt
Definition: obb.py:145
orgQhull
QhullRidge – Qhull's ridge structure, ridgeT, as a C++ class.
Definition: Coordinates.cpp:21
orgQhull::RoadError
Definition: RoadError.h:32
orgQhull::RoadLogEvent::toString
std::string toString(const char *tag, int code) const
Definition: RoadLogEvent.cpp:29
orgQhull::RoadError::logErrorLastResort
void logErrorLastResort() const
Definition: RoadError.cpp:151
orgQhull::RoadError::global_log
static std::ostringstream global_log
Not reentrant – only used by RoadError::logErrorLastResort()
Definition: RoadError.h:42
orgQhull::RoadError::RoadError
RoadError()
Definition: RoadError.cpp:40
orgQhull::RoadError::log_event
RoadLogEvent log_event
Non-zero code (not logged), maybe returned as program status.
Definition: RoadError.h:37
x
x
orgQhull::RoadError::operator=
RoadError & operator=(const RoadError &other)
Definition: RoadError.cpp:127
QTest::toString
char * toString(const std::string &s)
Definition: RoadTest.h:94
RoadError.h
orgQhull::RoadError::error_message
std::string error_message
Format string w/ arguments.
Definition: RoadError.h:38
orgQhull::RoadLogEvent::cstr_1
const char * cstr_1
One additional argument (for logging)
Definition: RoadLogEvent.h:37
orgQhull::RoadError::ROADtag
static const char * ROADtag
Definition: RoadError.h:41
orgQhull::RoadError::error_code
int error_code
Definition: RoadError.h:36


hpp-fcl
Author(s):
autogenerated on Fri Aug 2 2024 02:45:15