Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_DEV_Message.C
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // Copyright Notice
3 //
4 // Copyright 2002 Sandia Corporation. Under the terms
5 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
6 // Government retains certain rights in this software.
7 //
8 // Xyce(TM) Parallel Electrical Simulator
9 // Copyright (C) 2002-2014 Sandia Corporation
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //-----------------------------------------------------------------------------
24 
25 //-----------------------------------------------------------------------------
26 // Filename : $RCSfile: N_DEV_Message.C,v $
27 //
28 // Purpose : Contains the class definition for the N_ERH_ErrorMgr
29 // class. This class is the error handler for Xyce.
30 //
31 // Special Notes :
32 //
33 // Creator : Eric Keiter, SNL, Parallel Computational Sciences
34 //
35 // Creation Date : 3/15/00
36 //
37 // Revision Information:
38 // ---------------------
39 //
40 // Revision Number: $Revision: 1.8 $
41 //
42 // Revision Date : $Date: 2014/05/16 15:06:08 $
43 //
44 // Current Owner : $Author: dgbaur $
45 //-----------------------------------------------------------------------------
46 
47 #include <N_DEV_Message.h>
48 #include <N_DEV_Device.h>
49 #include <N_DEV_DeviceInstance.h>
50 #include <N_DEV_DeviceModel.h>
51 #include <N_UTL_Demangle.h>
52 
53 namespace Xyce {
54 namespace Device {
55 
56 // For DeviceBlock: netlistFileName_, parsedLine_[getNumberOfNodes()].lineNumber_
57 // For OptionBlock: netlistFileName_, parsedLine[0].lineNumber_
58 // For ParameterBlock: netlistFileName_, parsedLine[0].lineNumber_
59 
60 // Currently the model and instance headers are the same, so just use DeviceEntity. If the output wants to be
61 // different, then copy the DeviceEntity code to make DeviceModel and DeviceInstance.
62 
64  deviceEntityHeader(const DeviceEntity &device_entity)
65  : deviceEntity_(device_entity)
66  {}
67 
69 };
70 
71 
72 std::ostream &operator<<(std::ostream &os, const deviceEntityHeader &x)
73 {
74  os << "Device ";
76 
77  return os;
78 }
79 
80 
82  : Report::UserWarning()
83 {
84  at(device_entity.netlistLocation());
85 
86  os() << deviceEntityHeader(device_entity) << ": ";
87 }
88 
89 ParamError::ParamError(const DeviceEntity &device_entity)
90  : Report::UserError()
91 {
92  at(device_entity.netlistLocation());
93 
94  os() << deviceEntityHeader(device_entity) << ": ";
95 }
96 
98  : Report::UserWarning()
99 {
100  at(device_entity.netlistLocation());
101 
102  os() << deviceEntityHeader(device_entity) << ": ";
103 }
104 
106  : Report::UserWarning0()
107 {
108  at(device_entity.netlistLocation());
109 
110  os() << deviceEntityHeader(device_entity) << ": ";
111 }
112 
113 UserError::UserError(const DeviceEntity &device_entity)
114  : Report::UserError()
115 {
116  at(device_entity.netlistLocation());
117 
118  os() << deviceEntityHeader(device_entity) << ": ";
119 }
120 
122  : Report::UserError0()
123 {
124  at(device_entity.netlistLocation());
125 
126  os() << deviceEntityHeader(device_entity) << ": ";
127 }
128 
129 UserFatal::UserFatal(const DeviceEntity &device_entity)
130  : Report::UserFatal()
131 {
132  at(device_entity.netlistLocation());
133 
134  os() << deviceEntityHeader(device_entity) << ": ";
135 }
136 
138  : Report::UserFatal0()
139 {
140  at(device_entity.netlistLocation());
141 
142  os() << deviceEntityHeader(device_entity) << ": ";
143 }
144 
145 DevelFatal::DevelFatal(const DeviceEntity &device_entity, const char *function_name)
146  : Report::DevelFatal()
147 {
148  at(device_entity.netlistLocation());
149  in(function_name);
150 
151  os() << deviceEntityHeader(device_entity) << ": ";
152 }
153 
154 DevelFatal0::DevelFatal0(const DeviceEntity &device_entity, const char *function_name)
155  : Report::DevelFatal0()
156 {
157  at(device_entity.netlistLocation());
158  in(function_name);
159 
160  os() << deviceEntityHeader(device_entity) << ": ";
161 }
162 
163 struct deviceHeader {
165  : device_(device_)
166  {}
167 
168  const Device & device_;
169 };
170 
171 std::ostream &operator<<(std::ostream &os, const deviceHeader &x)
172 {
173  os << "Device " << x.device_.getName();
174 
175  return os;
176 }
177 
179  : Report::UserWarning()
180 {
181  os() << deviceHeader(device) << ": ";
182 }
183 
185  : Report::UserWarning0()
186 {
187  os() << deviceHeader(device) << ": ";
188 }
189 
191  : Report::UserError()
192 {
193  os() << deviceHeader(device) << ": ";
194 }
195 
197  : Report::UserError0()
198 {
199  os() << deviceHeader(device) << ": ";
200 }
201 
203  : Report::UserFatal()
204 {
205  os() << deviceHeader(device) << ": ";
206 }
207 
209  : Report::UserFatal0()
210 {
211  os() << deviceHeader(device) << ": ";
212 }
213 
214 DevelFatal::DevelFatal(const Device &device, const char *function_name)
215  : Report::DevelFatal()
216 {
217  in(function_name);
218 
219  os() << deviceHeader(device) << ": ";
220 }
221 
222 DevelFatal0::DevelFatal0(const Device &device, const char *function_name)
223  : Report::DevelFatal0()
224 {
225  in(function_name);
226 
227  os() << deviceHeader(device) << ": ";
228 }
229 
230 void device_assertion_error(const DeviceEntity &device_entity, const std::type_info &type, const char *label)
231 {
232  DevelFatal0(device_entity).in(demangle(type.name()).c_str()) << "Assertion " << label << " failed";
233 }
234 
235 } // namespace Device
236 } // namespace Xyce