Sierra Toolkit  Version of the Day
RuntimeWarning.hpp
1 /*------------------------------------------------------------------------*/
2 /* Copyright 2010 Sandia Corporation. */
3 /* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */
4 /* license for use of this work by or on behalf of the U.S. Government. */
5 /* Export of this program may require a license from the */
6 /* United States Government. */
7 /*------------------------------------------------------------------------*/
8 
9 #ifndef STK_UTIL_ENVIRONMENT_RUNTIMEWARNING_HPP
10 #define STK_UTIL_ENVIRONMENT_RUNTIMEWARNING_HPP
11 
12 #include <sstream>
13 
15 
16 namespace stk_classic {
17 
18 typedef std::ostream &(*OStreamFunctionPtr)(std::ostream &);
19 typedef std::ios_base &(*IOSBaseFunctionPtr)(std::ios_base &);
20 
25 
30 unsigned get_warning_count();
31 
36 void reset_warning_count();
37 
45 void set_max_warning_count(unsigned int max_messages);
46 
52 unsigned get_max_warning_count();
53 
62 void report_warning(const char *message, const MessageCode &message_code = MessageCode::s_defaultMessageCode);
63 
79 void report_symmetric_warning(const char *message, const MessageCode &message_code = MessageCode::s_defaultMessageCode);
80 
91 void report_deferred_warning(const char *message, const char *aggregate, const MessageCode &message_code);
92 
111 {
112 public:
121 
130 
131 private:
137 
142  RuntimeWarningAdHoc &operator=(const RuntimeWarningAdHoc &);
143 
144 public:
151  RuntimeWarningAdHoc &operator<<(OStreamFunctionPtr f) {
152  f(message);
153  return *this;
154  }
155 
162  RuntimeWarningAdHoc &operator<<(IOSBaseFunctionPtr f) {
163  f(message);
164  return *this;
165  }
166 
176  template <class T>
178  message << t;
179  return *this;
180  }
181 
182 public:
183  std::ostringstream message;
184 
185 private:
186  const MessageCode m_messageCode;
187 };
188 
189 
206 {
207 public:
216 
225 
226 private:
232 
238 
239 public:
246  RuntimeWarningSymmetric &operator<<(OStreamFunctionPtr f) {
247  f(message);
248  return *this;
249  }
250 
257  RuntimeWarningSymmetric &operator<<(IOSBaseFunctionPtr f) {
258  f(message);
259  return *this;
260  }
261 
271  template <class T>
273  message << t;
274  return *this;
275  }
276 
277 public:
278  std::ostringstream message;
279 
280 private:
281  const MessageCode m_messageCode;
282 };
283 
284 
306 {
307 public:
315  explicit RuntimeWarningDeferred(const MessageCode &message_code);
316 
324 
325 private:
331 
337 
338 public:
345  RuntimeWarningDeferred &operator<<(OStreamFunctionPtr f) {
346  f(message);
347  return *this;
348  }
349 
356  RuntimeWarningDeferred &operator<<(IOSBaseFunctionPtr f) {
357  f(message);
358  return *this;
359  }
360 
370  template <class T>
372  message << t;
373  return *this;
374  }
375 
376 public:
377  std::ostringstream message;
378  std::ostringstream aggregate;
379 
380 private:
381  const MessageCode m_messageCode;
382 };
383 
387 
388 } // namespace stk_classic
389 
390 #endif // STK_UTIL_ENVIRONMENT_RUNTIMEWARNING_HPP
stk_classic::RuntimeWarningAdHoc
Class RuntimeWarningAdHoc reports an ad hoc warning message to the report system.
Definition: RuntimeWarning.hpp:110
stk_classic::RuntimeWarningSymmetric::~RuntimeWarningSymmetric
~RuntimeWarningSymmetric()
Destroys a RuntimeWarningSymmetric instance.
Definition: RuntimeWarning.cpp:93
stk_classic::RuntimeWarningAdHoc::~RuntimeWarningAdHoc
~RuntimeWarningAdHoc()
Destroys a RuntimeWarningAdHoc instance.
Definition: RuntimeWarning.cpp:77
RuntimeMessage.hpp
stk_classic::RuntimeWarningDeferred::message
std::ostringstream message
Stream to receive message header content.
Definition: RuntimeWarning.hpp:377
stk_classic::RuntimeWarningDeferred
Class RuntimeWarningDeferred reports a deferred warning message to the report system.
Definition: RuntimeWarning.hpp:305
stk_classic::RuntimeWarningDeferred::operator<<
RuntimeWarningDeferred & operator<<(const T &t)
Member function operator<< passes any data type to the exception string class for conversion to a str...
Definition: RuntimeWarning.hpp:371
stk_classic::RuntimeWarningDeferred::aggregate
std::ostringstream aggregate
Stream to receive message aggregate content.
Definition: RuntimeWarning.hpp:378
stk_classic::reset_warning_count
void reset_warning_count()
Function reset_warning_count sets the accumulated warning count to zero.
Definition: RuntimeWarning.cpp:22
stk_classic::RuntimeWarningSymmetric::operator<<
RuntimeWarningSymmetric & operator<<(OStreamFunctionPtr f)
Member function operator<< passes the ios_base manipulator to the output stream.
Definition: RuntimeWarning.hpp:246
stk_classic::RuntimeWarningSymmetric
Class RuntimeWarningSymmetric reports a symmetric warning message to the report system.
Definition: RuntimeWarning.hpp:205
stk_classic::RuntimeWarningAdHoc::operator<<
RuntimeWarningAdHoc & operator<<(OStreamFunctionPtr f)
Member function operator<< passes the ios_base manipulator to the output stream.
Definition: RuntimeWarning.hpp:151
stk_classic::RuntimeWarningAdHoc::operator<<
RuntimeWarningAdHoc & operator<<(IOSBaseFunctionPtr f)
Member function operator<< passes the ios_base manipulator to the output stream.
Definition: RuntimeWarning.hpp:162
stk_classic::RuntimeWarningSymmetric::operator<<
RuntimeWarningSymmetric & operator<<(IOSBaseFunctionPtr f)
Member function operator<< passes the ios_base manipulator to the output stream.
Definition: RuntimeWarning.hpp:257
stk_classic::report_deferred_warning
void report_deferred_warning(const char *message, const char *aggregate, const MessageCode &message_code)
Member function report_deferred_warning ...
Definition: RuntimeWarning.cpp:62
stk_classic::report_symmetric_warning
void report_symmetric_warning(const char *message, const MessageCode &message_code)
Function report_symmetric_warning sends a warning message to the reporter.
Definition: RuntimeWarning.cpp:53
stk_classic::RuntimeWarningDeferred::~RuntimeWarningDeferred
~RuntimeWarningDeferred()
Destroys a RuntimeWarning instance.
Definition: RuntimeWarning.cpp:109
stk_classic
Sierra Toolkit.
Definition: AlgorithmRunner.cpp:16
stk_classic::RuntimeWarningAdHoc::message
std::ostringstream message
Stream to receive message content.
Definition: RuntimeWarning.hpp:183
stk_classic::get_max_warning_count
unsigned get_max_warning_count()
Function set_max_messages sets the maximum number of warning and doomed messages displayed before the...
Definition: RuntimeWarning.cpp:37
stk_classic::RuntimeWarningDeferred::RuntimeWarningDeferred
RuntimeWarningDeferred(const MessageCode &message_code)
Creates a new RuntimeWarningDeferred instance, setting the message code.
Definition: RuntimeWarning.cpp:103
stk_classic::RuntimeWarningDeferred::operator<<
RuntimeWarningDeferred & operator<<(IOSBaseFunctionPtr f)
Member function operator<< passes the ios_base manipulator to the output stream.
Definition: RuntimeWarning.hpp:356
stk_classic::RuntimeWarningSymmetric::RuntimeWarningSymmetric
RuntimeWarningSymmetric(MessageCode &message_code=MessageCode::s_defaultMessageCode)
Creates a new RuntimeWarning instance, setting the message code.
Definition: RuntimeWarning.cpp:87
stk_classic::MessageCode
Class MessageCode declares a message identifier and throttle characteristics for a message....
Definition: RuntimeMessage.hpp:124
stk_classic::RuntimeWarningDeferred::operator<<
RuntimeWarningDeferred & operator<<(OStreamFunctionPtr f)
Member function operator<< passes the ios_base manipulator to the output stream.
Definition: RuntimeWarning.hpp:345
stk_classic::RuntimeWarningAdHoc::RuntimeWarningAdHoc
RuntimeWarningAdHoc(MessageCode &message_code=MessageCode::s_defaultMessageCode)
Creates a new RuntimeWarningAdHoc instance, setting the message code.
Definition: RuntimeWarning.cpp:71
stk_classic::MessageCode::s_defaultMessageCode
static MessageCode s_defaultMessageCode
Default message code.
Definition: RuntimeMessage.hpp:161
stk_classic::set_max_warning_count
void set_max_warning_count(unsigned int max_warnings)
Function set_max_messages sets the maximum number of warning before no more warning will be displayed...
Definition: RuntimeWarning.cpp:29
stk_classic::report_warning
void report_warning(const char *message, const MessageCode &message_code)
Member function report_warning ...
Definition: RuntimeWarning.cpp:44
stk_classic::RuntimeWarningSymmetric::operator<<
RuntimeWarningSymmetric & operator<<(const T &t)
Member function operator<< passes any data type to the exception string class for conversion to a str...
Definition: RuntimeWarning.hpp:272
stk_classic::RuntimeWarningAdHoc::operator<<
RuntimeWarningAdHoc & operator<<(const T &t)
Member function operator<< passes any data type to the exception string class for conversion to a str...
Definition: RuntimeWarning.hpp:177
stk_classic::RuntimeWarningSymmetric::message
std::ostringstream message
Stream to receive message content.
Definition: RuntimeWarning.hpp:278
stk_classic::get_warning_count
unsigned get_warning_count()
Function get_warning_count returns the accumulated warning count.
Definition: RuntimeWarning.cpp:15