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.6.2.2 $
41 //
42 // Revision Date : $Date: 2014/02/27 00:52:16 $
43 //
44 // Current Owner : $Author: tvrusso $
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 " << x.deviceEntity_.getEntityType() << " " << x.deviceEntity_.getName();
75 
76  return os;
77 }
78 
79 
81  : Report::UserWarning()
82 {
83  at(device_entity.netlistLocation());
84 
85  os() << deviceEntityHeader(device_entity) << ": ";
86 }
87 
88 ParamError::ParamError(const DeviceEntity &device_entity)
89  : Report::UserError()
90 {
91  at(device_entity.netlistLocation());
92 
93  os() << deviceEntityHeader(device_entity) << ": ";
94 }
95 
97  : Report::UserWarning()
98 {
99  at(device_entity.netlistLocation());
100 
101  os() << deviceEntityHeader(device_entity) << ": ";
102 }
103 
105  : Report::UserWarning0()
106 {
107  at(device_entity.netlistLocation());
108 
109  os() << deviceEntityHeader(device_entity) << ": ";
110 }
111 
112 UserError::UserError(const DeviceEntity &device_entity)
113  : Report::UserError()
114 {
115  at(device_entity.netlistLocation());
116 
117  os() << deviceEntityHeader(device_entity) << ": ";
118 }
119 
121  : Report::UserError0()
122 {
123  at(device_entity.netlistLocation());
124 
125  os() << deviceEntityHeader(device_entity) << ": ";
126 }
127 
128 UserFatal::UserFatal(const DeviceEntity &device_entity)
129  : Report::UserFatal()
130 {
131  at(device_entity.netlistLocation());
132 
133  os() << deviceEntityHeader(device_entity) << ": ";
134 }
135 
137  : Report::UserFatal0()
138 {
139  at(device_entity.netlistLocation());
140 
141  os() << deviceEntityHeader(device_entity) << ": ";
142 }
143 
144 DevelFatal::DevelFatal(const DeviceEntity &device_entity, const char *function_name)
145  : Report::DevelFatal()
146 {
147  at(device_entity.netlistLocation());
148  in(function_name);
149 
150  os() << deviceEntityHeader(device_entity) << ": ";
151 }
152 
153 DevelFatal0::DevelFatal0(const DeviceEntity &device_entity, const char *function_name)
154  : Report::DevelFatal0()
155 {
156  at(device_entity.netlistLocation());
157  in(function_name);
158 
159  os() << deviceEntityHeader(device_entity) << ": ";
160 }
161 
162 struct deviceHeader {
164  : device_(device_)
165  {}
166 
167  const Device & device_;
168 };
169 
170 std::ostream &operator<<(std::ostream &os, const deviceHeader &x)
171 {
172  os << "Device " << x.device_.getName();
173 
174  return os;
175 }
176 
178  : Report::UserWarning()
179 {
180  os() << deviceHeader(device) << ": ";
181 }
182 
184  : Report::UserWarning0()
185 {
186  os() << deviceHeader(device) << ": ";
187 }
188 
190  : Report::UserError()
191 {
192  os() << deviceHeader(device) << ": ";
193 }
194 
196  : Report::UserError0()
197 {
198  os() << deviceHeader(device) << ": ";
199 }
200 
202  : Report::UserFatal()
203 {
204  os() << deviceHeader(device) << ": ";
205 }
206 
208  : Report::UserFatal0()
209 {
210  os() << deviceHeader(device) << ": ";
211 }
212 
213 DevelFatal::DevelFatal(const Device &device, const char *function_name)
214  : Report::DevelFatal()
215 {
216  in(function_name);
217 
218  os() << deviceHeader(device) << ": ";
219 }
220 
221 DevelFatal0::DevelFatal0(const Device &device, const char *function_name)
222  : Report::DevelFatal0()
223 {
224  in(function_name);
225 
226  os() << deviceHeader(device) << ": ";
227 }
228 
229 void device_assertion_error(const DeviceEntity &device_entity, const std::type_info &type, const char *label)
230 {
231  DevelFatal0(device_entity).in(demangle(type.name()).c_str()) << "Assertion " << label << " failed";
232 }
233 
234 } // namespace Device
235 } // namespace Xyce