Sierra Toolkit
Version of the Day
|
Files | |
file | RuntimeMessage.hpp |
Classes | |
class | stk_classic::RuntimeDoomedAdHoc |
Class RuntimeDoomedAdHoc reports an ad hoc doomed message to the report system. More... | |
class | stk_classic::RuntimeDoomedSymmetric |
Class RuntimeDoomedSymmetric reports a fatal error message to the report system. More... | |
class | stk_classic::RuntimeDoomedDeferred |
Class RuntimeDoomedDeferred reports a deferred fatal error message to the report system. More... | |
struct | stk_classic::Throttle |
Class Throttle describes the cutoff limits for a message throttle. More... | |
struct | stk_classic::MessageCode |
Class MessageCode declares a message identifier and throttle characteristics for a message. THESE MUST BE DECLARED STATIC. More... | |
class | stk_classic::RuntimeWarningAdHoc |
Class RuntimeWarningAdHoc reports an ad hoc warning message to the report system. More... | |
class | stk_classic::RuntimeWarningSymmetric |
Class RuntimeWarningSymmetric reports a symmetric warning message to the report system. More... | |
class | stk_classic::RuntimeWarningDeferred |
Class RuntimeWarningDeferred reports a deferred warning message to the report system. More... | |
Macros | |
#define | XSTR_TRACE_LINE(s) STR_TRACE_LINE(s) |
Define statements to add FILE___ and __LINE. More... | |
#define | STR_TRACE_LINE(s) #s |
#define | COUT_TRACE " File::Line="<<__FILE__<<":"<<__LINE__ |
#define | STR_TRACE (std::string(__FILE__) + ":" + XSTR_TRACE_LINE(__LINE__)) |
#define | StackTrace std::string(std::string(" exception thrown from ") + stk_classic::source_relative_path(STR_TRACE)) |
#define | ThrowGenericCond(expr, message, handler) |
#define | ThrowGeneric(message, handler) |
#define | ThrowRequireMsg(expr, message) ThrowGenericCond(expr, message, handle_assert) |
#define | ThrowRequire(expr) ThrowRequireMsg(expr, "") |
#define | ThrowAssert(expr) ThrowRequire(expr) |
#define | ThrowAssertMsg(expr, message) ThrowRequireMsg(expr,message) |
#define | ThrowErrorMsgIf(expr, message) ThrowGenericCond( !(expr), message, handle_error) |
#define | ThrowErrorIf(expr) ThrowErrorMsgIf(expr, "") |
#define | ThrowErrorMsg(message) ThrowGeneric( message, handle_error ) |
#define | ThrowInvalidArgMsgIf(expr, message) ThrowGenericCond( !(expr), message, handle_invalid_arg) |
#define | ThrowInvalidArgIf(expr) ThrowInvalidArgMsgIf(expr, "") |
Typedefs | |
typedef void(* | stk_classic::REH) (const char *message, int type) |
Type definition REH is a pointer to a function of type void that takes a const std::exception reference as a parameter. | |
typedef void(* | stk_classic::ErrorHandler) (const char *expr, const std::string &location, std::ostringstream &message) |
ErrorHandler defines the signature of functions that can be used to handle errors. expr is the expression of the failing error-check, location is a raw code location (something like file:line, no prose), and message is the error message. | |
typedef ptrdiff_t | stk_classic::MessageId |
Typedef MessageId defines a message identifier. More... | |
Enumerations | |
enum | stk_classic::MessageType { stk_classic::MSG_WARNING = 0, stk_classic::MSG_DOOMED = 1, stk_classic::MSG_EXCEPTION = 2, stk_classic::MSG_INFORMATION = 3, stk_classic::MSG_TYPE_MASK = 0x0FFFFFFF, stk_classic::MSG_SYMMETRIC = 0x80000000, stk_classic::MSG_DEFERRED = 0x40000000, MSG_UNUSED0 = 0x20000000, MSG_UNUSED1 = 0x10000000 } |
Enumeration MessageType declares the global message types. More... | |
enum | stk_classic::ThrottleGroup { MSG_APPLICATION = 0, MSG_TIME_STEP = 1 } |
Enumeration ThrottleGroup lists defined throttling groups. More... | |
Functions | |
void | stk_classic::default_report_handler (const char *message, int type) |
Function default_report_handler is the default error reporter for sierra exceptions. Note that it is implemented in Fmwk_sierra.C so that it can participate. More... | |
REH | stk_classic::set_report_handler (REH reh) |
Function set_report_handler sets the exception report function to be called when an report_exception() is called. More... | |
void | stk_classic::report (const char *message, int type) |
Function report calls the current exception reporter to report the message in x. More... | |
std::string | stk_classic::source_relative_path (const std::string &path) |
Function source_relative_path strips everything through "/src/", "/include/", "/App_", or "/stk_" so that error message output doesn't mention names. More... | |
void | stk_classic::default_assert_handler (const char *expr, const std::string &location, std::ostringstream &message) |
void | stk_classic::default_error_handler (const char *expr, const std::string &location, std::ostringstream &message) |
void | stk_classic::default_invalid_arg_handler (const char *expr, const std::string &location, std::ostringstream &message) |
ErrorHandler | stk_classic::set_assert_handler (ErrorHandler handler) |
ErrorHandler | stk_classic::set_error_handler (ErrorHandler handler) |
ErrorHandler | stk_classic::set_invalid_arg_handler (ErrorHandler handler) |
void | stk_classic::handle_assert (const char *expr, const std::string &location, std::ostringstream &message) |
void | stk_classic::handle_error (const char *expr, const std::string &location, std::ostringstream &message) |
void | stk_classic::handle_invalid_arg (const char *expr, const std::string &location, std::ostringstream &message) |
unsigned int | stk_classic::get_doomed_count () |
Function get_doomed_count returns the accumulated doomed count. | |
bool | stk_classic::is_doomed () |
Function is_doomed returns true if get_doomed_count() > 0. More... | |
void | stk_classic::reset_doomed_count () |
Function reset_doomed_count sets the accumulated doomed count to zero. | |
void | stk_classic::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. More... | |
unsigned | stk_classic::get_max_doomed_count () |
Function set_max_messages sets the maximum number of doomed and doomed messages displayed before the message is thrown as a RuntimeError exception. | |
void | stk_classic::report_doomed (const char *message, const MessageCode &message_code=MessageCode::s_defaultMessageCode) |
Function report_symmetric_doomed sends a doomed message to the reporter. More... | |
void | stk_classic::report_symmetric_doomed (const char *message, const MessageCode &message_code=MessageCode::s_defaultMessageCode) |
Function report_symmetric_doomed sends a doomed message to the reporter. More... | |
void | stk_classic::report_deferred_doomed (const char *message, const char *aggregate, const MessageCode &message_code) |
Member function report_deferred_doomed ... More... | |
unsigned | stk_classic::get_message_count (unsigned message_type) |
Member function get_message_count ... More... | |
void | stk_classic::reset_message_count (unsigned message_type) |
Member function reset_message_count ... More... | |
void | stk_classic::set_max_message_count (unsigned message_type, unsigned max_count) |
Member function set_max_message_count ... More... | |
unsigned | stk_classic::get_max_message_count (unsigned message_type) |
Member function get_max_message_count ... More... | |
const std::string & | stk_classic::get_message_name (unsigned message_type) |
Member function get_message_name ... More... | |
void | stk_classic::register_message_type (unsigned message_type, unsigned max_count, const char *name) |
Member function set_message_name ... More... | |
void | stk_classic::reset_throttle_group (int throttle_group) |
Function reset_message_group sets the count to zero of all messages in the specified throttle group. More... | |
void | stk_classic::report_message (const char *message, unsigned message_type, const MessageCode &message_code) |
Member function report_message ... More... | |
void | stk_classic::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. More... | |
void | stk_classic::report_deferred_messages (ParallelMachine comm) |
Function report_deferred_messages aggregates and reports the message on the root processor. More... | |
void | stk_classic::aggregate_messages (ParallelMachine comm, std::ostringstream &os, const char *separator=", ") |
Function aggregate_messages writes a message message to the output string by joining the messages from each processor, in order. Each message is separated by the specified separation string. More... | |
std::ostream & | stk_classic::operator<< (std::ostream &os, const MessageType &message_type) |
Function operator<< writes the message type name to the output stream. If the symmetric bit is set, "parallel" is prefixed to the name. More... | |
unsigned | stk_classic::get_warning_count () |
Function get_warning_count returns the accumulated warning count. | |
void | stk_classic::reset_warning_count () |
Function reset_warning_count sets the accumulated warning count to zero. | |
void | stk_classic::set_max_warning_count (unsigned int max_messages) |
Function set_max_messages sets the maximum number of warning before no more warning will be displayed. More... | |
unsigned | stk_classic::get_max_warning_count () |
Function set_max_messages sets the maximum number of warning and doomed messages displayed before the message is thrown as a RuntimeError exception. | |
void | stk_classic::report_warning (const char *message, const MessageCode &message_code=MessageCode::s_defaultMessageCode) |
Member function report_warning ... More... | |
void | stk_classic::report_symmetric_warning (const char *message, const MessageCode &message_code=MessageCode::s_defaultMessageCode) |
Function report_symmetric_warning sends a warning message to the reporter. More... | |
void | stk_classic::report_deferred_warning (const char *message, const char *aggregate, const MessageCode &message_code) |
Member function report_deferred_warning ... More... | |
#define XSTR_TRACE_LINE | ( | s | ) | STR_TRACE_LINE(s) |
Define statements to add FILE___ and __LINE.
These just make it a little easier to add the FILE and LINE macros into the traceback functions. Inline functions do not work because the FILE and LINE expansions take place before the compiler inlining.
Definition at line 169 of file ReportHandler.hpp.
#define ThrowGenericCond | ( | expr, | |
message, | |||
handler | |||
) |
Definition at line 194 of file ReportHandler.hpp.
#define ThrowGeneric | ( | message, | |
handler | |||
) |
Definition at line 208 of file ReportHandler.hpp.
typedef ptrdiff_t stk_classic::MessageId |
Typedef MessageId defines a message identifier.
Message identifiers must be consist from reference to reference, unique for each instance, and yet consist within each instance across multiple processors. To meet these criteria, the message identifier is implemented as a static memory location. It must be declared by the application developer as static. This results in the linker selecting an address for each instance, which never changes from reference to reference, is unique for each instance and the same regardless of executable (assuming the executable is mapped into the same memory location for each process). In order to remove the pointer-ness of the static memory location, the address is cast to a pointer difference type which is an integral type by subtracting the zero pointer from it.
Definition at line 42 of file RuntimeMessage.hpp.
Enumeration MessageType declares the global message types.
Currently warning and doomed (error) message types are defined. Additional type may be added after MSG_DOOMED. The MSG_SYMMETRIC bit indicates that the message was generated identically across all processors.
Definition at line 53 of file RuntimeMessage.hpp.
Enumeration ThrottleGroup lists defined throttling groups.
When messages are throttled, the throttle count may be reset at varior points during an application run. Some throttles defined for the application, while other may be reset at each time step or other interval. This allows warnings to be repeated at each time step rather than cut off.
Definition at line 75 of file RuntimeMessage.hpp.
void stk_classic::default_report_handler | ( | const char * | message, |
int | type | ||
) |
Function default_report_handler is the default error reporter for sierra exceptions. Note that it is implemented in Fmwk_sierra.C so that it can participate.
message | a char const pointer to the message to be displayed. |
type | an int value of the type of message from the enumeration type |
Definition at line 65 of file ReportHandler.cpp.
Function set_report_handler sets the exception report function to be called when an report_exception() is called.
reh | a REH of the new exception reporter. |
Definition at line 82 of file ReportHandler.cpp.
void stk_classic::report | ( | const char * | message, |
int | type | ||
) |
Function report calls the current exception reporter to report the message in x.
message | a char const pointer to the message to report. |
type | an int value of the type of message. |
Definition at line 73 of file ReportHandler.cpp.
std::string stk_classic::source_relative_path | ( | const std::string & | path | ) |
Function source_relative_path strips everything through "/src/", "/include/", "/App_", or "/stk_" so that error message output doesn't mention names.
path | a std::string const reference to the original path. |
Definition at line 97 of file ReportHandler.cpp.
void stk_classic::default_assert_handler | ( | const char * | expr, |
const std::string & | location, | ||
std::ostringstream & | message | ||
) |
A function used to create and throw nice-looking exceptions for assertion failures.
Definition at line 115 of file ReportHandler.cpp.
void stk_classic::default_error_handler | ( | const char * | expr, |
const std::string & | location, | ||
std::ostringstream & | message | ||
) |
A function used to create and throw nice-looking exceptions for runtime errors.
Definition at line 122 of file ReportHandler.cpp.
void stk_classic::default_invalid_arg_handler | ( | const char * | expr, |
const std::string & | location, | ||
std::ostringstream & | message | ||
) |
A function used to create and throw nice-looking exceptions for invalid argument errors.
Definition at line 129 of file ReportHandler.cpp.
ErrorHandler stk_classic::set_assert_handler | ( | ErrorHandler | handler | ) |
Change the error handler for ThrowAssert and ThrowRequire.
Definition at line 136 of file ReportHandler.cpp.
ErrorHandler stk_classic::set_error_handler | ( | ErrorHandler | handler | ) |
Change the error handler for ThrowError.
Definition at line 147 of file ReportHandler.cpp.
ErrorHandler stk_classic::set_invalid_arg_handler | ( | ErrorHandler | handler | ) |
Change the error handler for ThrowInvalidArg.
Definition at line 158 of file ReportHandler.cpp.
void stk_classic::handle_assert | ( | const char * | expr, |
const std::string & | location, | ||
std::ostringstream & | message | ||
) |
Makes the call to the current assert handler
Definition at line 169 of file ReportHandler.cpp.
void stk_classic::handle_error | ( | const char * | expr, |
const std::string & | location, | ||
std::ostringstream & | message | ||
) |
Makes the call to the current error handler
Definition at line 176 of file ReportHandler.cpp.
void stk_classic::handle_invalid_arg | ( | const char * | expr, |
const std::string & | location, | ||
std::ostringstream & | message | ||
) |
Makes the call to the current invalid_arg handler
Definition at line 183 of file ReportHandler.cpp.
|
inline |
Function is_doomed returns true if get_doomed_count() > 0.
Definition at line 37 of file RuntimeDoomed.hpp.
void stk_classic::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.
max_messages | an int variable ... |
Definition at line 32 of file RuntimeDoomed.cpp.
void stk_classic::report_doomed | ( | const char * | message, |
const MessageCode & | message_code = MessageCode::s_defaultMessageCode |
||
) |
Function report_symmetric_doomed sends a doomed message to the reporter.
Since the issue causing the doomed error may occur thousands of times during a run, it is desirable to throttle the number of times that a message is displayed. If you desire to limit the number of times a message is displayed, obtain a unique id via the get_next_message_id() function. This function allows you to assign the maximum display count. When the count of messages reported with this message id exceeds the display count, it is no longer displayed. The default id zero (0) is assigned which has an extremely large display count.
message | a char const pointer to a message that is to be displayed. |
message_code | a MessageCode const pointer to a cross-processor unique identification of this message. |
Definition at line 47 of file RuntimeDoomed.cpp.
void stk_classic::report_symmetric_doomed | ( | const char * | message, |
const MessageCode & | message_code = MessageCode::s_defaultMessageCode |
||
) |
Function report_symmetric_doomed sends a doomed message to the reporter.
Since the issue causing the doomed error may occur thousands of times during a run, it is desirable to throttle the number of times that a message is displayed. If you desire to limit the number of times a message is displayed, obtain a unique id via the get_next_message_id() function. This function allows you to assign the maximum display count. When the count of messages reported with this message id exceeds the display count, it is no longer displayed. The default id zero (0) is assigned which has an extremely large display count.
message | a char const pointer to a message that is to be displayed. |
message_code | a MessageCode const pointer to a cross-processor unique identification of this message. |
Definition at line 56 of file RuntimeDoomed.cpp.
void stk_classic::report_deferred_doomed | ( | const char * | message, |
const char * | aggregate, | ||
const MessageCode & | message_code | ||
) |
Member function report_deferred_doomed ...
message | a std::string const ... |
aggregate | a std::string const ... |
message_code | a MessageCode const ... |
Definition at line 65 of file RuntimeDoomed.cpp.
unsigned stk_classic::get_message_count | ( | unsigned | message_type | ) |
Member function get_message_count ...
message_type | an unsigned int ... |
Definition at line 169 of file RuntimeMessage.cpp.
void stk_classic::reset_message_count | ( | unsigned | message_type | ) |
Member function reset_message_count ...
message_type | an unsigned int ... |
Definition at line 185 of file RuntimeMessage.cpp.
void stk_classic::set_max_message_count | ( | unsigned | message_type, |
unsigned | max_count | ||
) |
Member function set_max_message_count ...
message_type | an unsigned int ... |
max_count | an unsigned int ... |
Definition at line 201 of file RuntimeMessage.cpp.
unsigned stk_classic::get_max_message_count | ( | unsigned | message_type | ) |
Member function get_max_message_count ...
message_type | an unsigned int ... |
Definition at line 210 of file RuntimeMessage.cpp.
const std::string & stk_classic::get_message_name | ( | unsigned | message_type | ) |
Member function get_message_name ...
message_type | an unsigned int ... |
Definition at line 193 of file RuntimeMessage.cpp.
void stk_classic::register_message_type | ( | unsigned | message_type, |
unsigned | max_count, | ||
const char * | name | ||
) |
Member function set_message_name ...
message_type | an unsigned int ... |
max_count | an unsigned int ... |
name | a std::string const ... |
Definition at line 156 of file RuntimeMessage.cpp.
void stk_classic::reset_throttle_group | ( | int | throttle_group | ) |
Function reset_message_group sets the count to zero of all messages in the specified throttle group.
throttle_group | an int value of the throttle group to reset. |
Definition at line 257 of file RuntimeMessage.cpp.
void stk_classic::report_message | ( | const char * | message, |
unsigned | message_type, | ||
const MessageCode & | message_code | ||
) |
Member function report_message ...
message | an char const pointer ... |
message_type | an unsigned int ... |
message_code | a MessageCode ... |
Definition at line 218 of file RuntimeMessage.cpp.
void stk_classic::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.
message_type | an int value of the message type, usually WARNING or DOOMED |
message_id | a MessageId value of the message identifier |
throttle_cutoff | a size_t value to display before the message is no longer displayed. |
throttle_group | an int value to identify the throttle group that this message belongs to. |
header | a char const pointer to the message header string. |
aggegrate | a char const pointer to the message aggregation string. |
Definition at line 267 of file RuntimeMessage.cpp.
void stk_classic::report_deferred_messages | ( | ParallelMachine | comm | ) |
Function report_deferred_messages aggregates and reports the message on the root processor.
comm | a ParallelMachine communicator. |
Definition at line 291 of file RuntimeMessage.cpp.
void stk_classic::aggregate_messages | ( | ParallelMachine | comm, |
std::ostringstream & | os, | ||
const char * | separator = ", " |
||
) |
Function aggregate_messages writes a message message to the output string by joining the messages from each processor, in order. Each message is separated by the specified separation string.
comm | a ParallelMachine communicator. |
os | a std::ostream reference to the output stream to receive the aggregated message. |
separator | a char const pointer to the separation string. |
Definition at line 398 of file RuntimeMessage.cpp.
std::ostream & stk_classic::operator<< | ( | std::ostream & | os, |
const MessageType & | message_type | ||
) |
Function operator<< writes the message type name to the output stream. If the symmetric bit is set, "parallel" is prefixed to the name.
os | a std::ostream reference to the output stream. |
message_type | a MessageType const reference to write the name of. |
Definition at line 478 of file RuntimeMessage.cpp.
void stk_classic::set_max_warning_count | ( | unsigned int | max_messages | ) |
Function set_max_messages sets the maximum number of warning before no more warning will be displayed.
max_messages | an int variable ... |
Definition at line 29 of file RuntimeWarning.cpp.
void stk_classic::report_warning | ( | const char * | message, |
const MessageCode & | message_code = MessageCode::s_defaultMessageCode |
||
) |
Member function report_warning ...
message | a char const pointer ... |
message_code | a MessageCode const ... |
Definition at line 44 of file RuntimeWarning.cpp.
void stk_classic::report_symmetric_warning | ( | const char * | message, |
const MessageCode & | message_code = MessageCode::s_defaultMessageCode |
||
) |
Function report_symmetric_warning sends a warning message to the reporter.
Since the issue causing the warnign may occure thousands of times during a run, it is desirable to throttle the number of times that a message is displayed. If you desire to limit the number of times a message is displayed, obtain a unique id via the get_next_message_id() function. This function allows you to assign the maximum display count. When the count of messages reported with this message id exceeds the display count, it is no longer displayed. The default id zero (0) is assigned which has an extremely large display count.
message | a char const pointer to a message that is to be displayed. |
message_code | a size_t value of the message id for the message. |
Definition at line 53 of file RuntimeWarning.cpp.
void stk_classic::report_deferred_warning | ( | const char * | message, |
const char * | aggregate, | ||
const MessageCode & | message_code | ||
) |
Member function report_deferred_warning ...
message | a std::string const ... |
aggregate | a std::string const ... |
message_code | a MessageCode const ... |
Definition at line 62 of file RuntimeWarning.cpp.