Xyce  6.1
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-2015 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.10.2.1 $
41 //
42 // Revision Date : $Date: 2015/04/02 18:20:09 $
43 //
44 // Current Owner : $Author: tvrusso $
45 //-----------------------------------------------------------------------------
46 
47 #include <Xyce_config.h>
48 
49 #include <N_DEV_Message.h>
50 #include <N_DEV_Device.h>
51 #include <N_DEV_DeviceInstance.h>
52 #include <N_DEV_DeviceModel.h>
53 #include <N_UTL_Demangle.h>
54 
55 namespace Xyce {
56 namespace Device {
57 
58 // For DeviceBlock: netlistFilename_, parsedLine_[getNumberOfNodes()].lineNumber_
59 // For OptionBlock: netlistFilename_, parsedLine[0].lineNumber_
60 // For ParameterBlock: netlistFilename_, parsedLine[0].lineNumber_
61 
62 // Currently the model and instance headers are the same, so just use DeviceEntity. If the output wants to be
63 // different, then copy the DeviceEntity code to make DeviceModel and DeviceInstance.
64 
66  deviceEntityHeader(const DeviceEntity &device_entity)
67  : deviceEntity_(device_entity)
68  {}
69 
71 };
72 
73 
74 std::ostream &operator<<(std::ostream &os, const deviceEntityHeader &x)
75 {
76  os << "Device ";
78 
79  return os;
80 }
81 
82 
84  : Report::UserWarning()
85 {
86  at(device_entity.netlistLocation());
87 
88  os() << deviceEntityHeader(device_entity) << ": ";
89 }
90 
91 ParamError::ParamError(const DeviceEntity &device_entity)
92  : Report::UserError()
93 {
94  at(device_entity.netlistLocation());
95 
96  os() << deviceEntityHeader(device_entity) << ": ";
97 }
98 
100  : Report::UserWarning()
101 {
102  at(device_entity.netlistLocation());
103 
104  os() << deviceEntityHeader(device_entity) << ": ";
105 }
106 
108  : Report::UserWarning0()
109 {
110  at(device_entity.netlistLocation());
111 
112  os() << deviceEntityHeader(device_entity) << ": ";
113 }
114 
115 UserError::UserError(const DeviceEntity &device_entity)
116  : Report::UserError()
117 {
118  at(device_entity.netlistLocation());
119 
120  os() << deviceEntityHeader(device_entity) << ": ";
121 }
122 
124  : Report::UserError0()
125 {
126  at(device_entity.netlistLocation());
127 
128  os() << deviceEntityHeader(device_entity) << ": ";
129 }
130 
131 UserFatal::UserFatal(const DeviceEntity &device_entity)
132  : Report::UserFatal()
133 {
134  at(device_entity.netlistLocation());
135 
136  os() << deviceEntityHeader(device_entity) << ": ";
137 }
138 
140  : Report::UserFatal0()
141 {
142  at(device_entity.netlistLocation());
143 
144  os() << deviceEntityHeader(device_entity) << ": ";
145 }
146 
147 DevelFatal::DevelFatal(const DeviceEntity &device_entity, const char *function_name)
148  : Report::DevelFatal()
149 {
150  at(device_entity.netlistLocation());
151  in(function_name);
152 
153  os() << deviceEntityHeader(device_entity) << ": ";
154 }
155 
156 DevelFatal0::DevelFatal0(const DeviceEntity &device_entity, const char *function_name)
157  : Report::DevelFatal0()
158 {
159  at(device_entity.netlistLocation());
160  in(function_name);
161 
162  os() << deviceEntityHeader(device_entity) << ": ";
163 }
164 
165 struct deviceHeader {
167  : device_(device_)
168  {}
169 
170  const Device & device_;
171 };
172 
173 std::ostream &operator<<(std::ostream &os, const deviceHeader &x)
174 {
175  os << "Device " << x.device_.getName();
176 
177  return os;
178 }
179 
181  : Report::UserWarning()
182 {
183  os() << deviceHeader(device) << ": ";
184 }
185 
187  : Report::UserWarning0()
188 {
189  os() << deviceHeader(device) << ": ";
190 }
191 
193  : Report::UserError()
194 {
195  os() << deviceHeader(device) << ": ";
196 }
197 
199  : Report::UserError0()
200 {
201  os() << deviceHeader(device) << ": ";
202 }
203 
205  : Report::UserFatal()
206 {
207  os() << deviceHeader(device) << ": ";
208 }
209 
211  : Report::UserFatal0()
212 {
213  os() << deviceHeader(device) << ": ";
214 }
215 
216 DevelFatal::DevelFatal(const Device &device, const char *function_name)
217  : Report::DevelFatal()
218 {
219  in(function_name);
220 
221  os() << deviceHeader(device) << ": ";
222 }
223 
224 DevelFatal0::DevelFatal0(const Device &device, const char *function_name)
225  : Report::DevelFatal0()
226 {
227  in(function_name);
228 
229  os() << deviceHeader(device) << ": ";
230 }
231 
232 void device_assertion_error(const DeviceEntity &device_entity, const std::type_info &type, const char *label)
233 {
234  DevelFatal0(device_entity).in(demangle(type.name()).c_str()) << "Assertion " << label << " failed";
235 }
236 
237 } // namespace Device
238 } // namespace Xyce
virtual const std::string & getName() const =0
Returns the name given to the device.
deviceEntityHeader(const DeviceEntity &device_entity)
Definition: N_DEV_Message.C:66
Pure virtual class to augment a linear system.
DevelFatal0(const DeviceEntity &device_entity, const char *function_name=0)
const DeviceEntity & deviceEntity_
Definition: N_DEV_Message.C:70
UserWarning0(const DeviceEntity &device_entity)
UserError(const DeviceEntity &device_entity)
UserFatal(const DeviceEntity &device_entity)
ParamError(const DeviceEntity &device_entity)
Definition: N_DEV_Message.C:91
UserError0(const DeviceEntity &device_entity)
UserFatal0(const DeviceEntity &device_entity)
ParamWarning(const DeviceEntity &device_entity)
Definition: N_DEV_Message.C:83
The Device class is an interface for device implementations.
Definition: N_DEV_Device.h:101
virtual std::ostream & printName(std::ostream &os) const =0
deviceHeader(const Device &device_)
DevelFatal(const DeviceEntity &device_entity, const char *function_name=0)
const NetlistLocation & netlistLocation() const
void device_assertion_error(const DeviceEntity &device_entity, const std::type_info &type, const char *label)
UserWarning(const DeviceEntity &device_entity)
Definition: N_DEV_Message.C:99
std::ostream & operator<<(std::ostream &os, const Configuration &configuration)
Definition: N_DEV_Dump.C:134