20 #include "SheafSystem/error_message.h" 22 #include "SheafSystem/assert_contract.h" 23 #include "SheafSystem/std_iostream.h" 24 #include "SheafSystem/std_sstream.h" 25 #include "SheafSystem/std_stdexcept.h" 51 ensure(source() ==
"");
53 ensure(level() == INFORMATION);
76 ensure(text() == xother.
text());
77 ensure(level() == xother.
level());
95 _text = xother.
text();
96 _level = xother.
level();
102 ensure(source() == xother.
source());
103 ensure(text() == xother.
text());
104 ensure(level() == xother.
level());
139 require(xlevel != LEVEL_TYPE_UB);
140 require(!xsource.empty());
141 require(!xtext.empty());
152 ensure(level() == xlevel);
153 ensure(source() == xsource);
154 ensure(text() == xtext);
168 require(xlevel != LEVEL_TYPE_UB);
169 require(!xfile.empty());
180 _source +=
" at line ";
187 ensure(level() == xlevel);
188 ensure(text() == xtext);
233 cerr << level_name(_level) <<
": " 234 <<
"In " << _source <<
": " 241 throw std::logic_error(level_name(_level));
259 require((0 <= xlevel ) && (xlevel < LEVEL_TYPE_UB));
263 static const string names[LEVEL_TYPE_UB] =
272 const string& result = names[xlevel];
276 ensure(!result.empty());
296 if(xmsg.
level() != error_message::UNSPECIFIED)
298 xos << error_message::level_name(xmsg.
level()) <<
": ";
301 xos <<
"In " << xmsg.
source() <<
": " << xmsg.
text();
void post(bool xforce_exit=false) const
Registers this message with the message handling subsystem.
virtual ~error_message()
Destructor.
std::string text() const
The text of this message.
level_type
The set of predefined error levels.
std::string source() const
The source of this message.
error_message()
Default constructor.
level_type level() const
The level of this message.
SHEAF_DLL_SPEC std::ostream & operator<<(std::ostream &os, const dof_descriptor_array &p)
Insert dof_descriptor_array& p into ostream& os.
error_message & operator=(const error_message &xother)
Assignment operator.
static const std::string & level_name(level_type xlevel)
The name of level xlevel.
A message to report error conditions.