Sierra Toolkit  Version of the Day
RuntimeDoomed.cpp
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 #include <vector>
10 #include <stdexcept>
11 
12 #include <stk_util/environment/ReportHandler.hpp>
13 #include <stk_util/environment/RuntimeDoomed.hpp>
14 
15 namespace stk_classic {
16 
17 unsigned int
19 {
21 }
22 
23 
24 void
26 {
28 }
29 
30 
31 void
33  unsigned int max_messages)
34 {
35  set_max_message_count(MSG_DOOMED, max_messages);
36 }
37 
38 
39 unsigned
41 {
43 }
44 
45 
46 void
48  const char * message,
49  const MessageCode & message_code)
50 {
51  report_message(message, MSG_DOOMED, message_code);
52 }
53 
54 
55 void
57  const char * message,
58  const MessageCode & message_code)
59 {
60  report_message(message, MSG_SYMMETRIC | MSG_DOOMED, message_code);
61 }
62 
63 
64 void
66  const char * message,
67  const char * aggregate,
68  const MessageCode & message_code)
69 {
70  add_deferred_message(MSG_DOOMED, message_code.m_id, message_code.m_throttle.m_cutoff, message_code.m_throttle.m_group, message, aggregate);
71 }
72 
73 
75  const MessageCode & message_code)
76  : m_messageCode(message_code)
77 {}
78 
79 
81 {
82  try {
83  report_doomed(message.str().c_str(), m_messageCode);
84  }
85  catch (std::exception &)
86  {}
87 }
88 
89 
91  const MessageCode & message_code)
92  : m_messageCode(message_code)
93 {}
94 
95 
97 {
98  try {
99  report_symmetric_doomed(message.str().c_str(), m_messageCode);
100  }
101  catch (std::exception &)
102  {}
103 }
104 
105 
107  const MessageCode & message_code)
108  : m_messageCode(message_code)
109 {}
110 
111 
113 {
114  try {
115  report_deferred_doomed(message.str().c_str(), aggregate.str().c_str(), m_messageCode);
116  }
117  catch (std::exception &)
118  {}
119 }
120 
121 } // namespace stk_classic
122 
void report_deferred_doomed(const char *message, const char *aggregate, const MessageCode &message_code)
Member function report_deferred_doomed ...
void add_deferred_message(int message_type, MessageId message_id, size_t throttle_cutoff, int throttle_group, const char *header, const char *aggegrate)
Function add_deferred_message adds a message to the deferred message queue.
~RuntimeDoomedDeferred()
Destroys a RuntimeDoomed instance.
void set_max_doomed_count(unsigned int max_messages)
Function set_max_messages sets the maximum number of doomed before no more doomed will be displayed...
RuntimeDoomedDeferred(const MessageCode &message_code)
Creates a new RuntimeDoomedDeferred instance, setting the message code.
std::ostringstream aggregate
Stream to receive message aggregate content.
RuntimeDoomedSymmetric(const MessageCode &message_code=MessageCode::s_defaultMessageCode)
Creates a new RuntimeDoomedSymmetric instance, setting the message code.
std::ostringstream message
Stream to receive message header content.
void report_doomed(const char *message, const MessageCode &message_code)
Function report_symmetric_doomed sends a doomed message to the reporter.
void reset_message_count(unsigned message_type)
Member function reset_message_count ...
Class MessageCode declares a message identifier and throttle characteristics for a message...
Throttle m_throttle
Throttle characteristics.
~RuntimeDoomedAdHoc()
Destroys a RuntimeDoomedAdHoc instance.
void report_symmetric_doomed(const char *message, const MessageCode &message_code)
Function report_symmetric_doomed sends a doomed message to the reporter.
unsigned get_max_message_count(unsigned message_type)
Member function get_max_message_count ...
void report_message(const char *message, unsigned message_type, const MessageCode &message_code)
Member function report_message ...
unsigned get_message_count(unsigned message_type)
Member function get_message_count ...
size_t m_cutoff
Maximum number to display.
~RuntimeDoomedSymmetric()
Destroys a RuntimeDoomedSymmetric instance.
std::ostringstream message
Stream to receive message content.
unsigned int get_doomed_count()
Function get_doomed_count returns the accumulated doomed count.
Message is a fatal error.
Message is symmetrical.
Sierra Toolkit.
void set_max_message_count(unsigned message_type, unsigned max_count)
Member function set_max_message_count ...
std::ostringstream message
Stream to receive message content.
unsigned get_max_doomed_count()
Function set_max_messages sets the maximum number of doomed and doomed messages displayed before the ...
RuntimeDoomedAdHoc(const MessageCode &message_code=MessageCode::s_defaultMessageCode)
Creates a new RuntimeDoomedAdHoc instance, setting the message code.
MessageId m_id
Message identifier.
int m_group
Throttle group of message.
void reset_doomed_count()
Function reset_doomed_count sets the accumulated doomed count to zero.