RuntimeDoomed.cpp

00001 /*------------------------------------------------------------------------*/
00002 /*                 Copyright 2010 Sandia Corporation.                     */
00003 /*  Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive   */
00004 /*  license for use of this work by or on behalf of the U.S. Government.  */
00005 /*  Export of this program may require a license from the                 */
00006 /*  United States Government.                                             */
00007 /*------------------------------------------------------------------------*/
00008 
00009 #include <vector>
00010 #include <stdexcept>
00011 
00012 #include <stk_util/environment/ReportHandler.hpp>
00013 #include <stk_util/environment/RuntimeDoomed.hpp>
00014 
00015 namespace stk {
00016 
00017 unsigned int
00018 get_doomed_count()
00019 {
00020   return get_message_count(MSG_DOOMED);
00021 }
00022 
00023 
00024 void
00025 reset_doomed_count()
00026 {
00027   reset_message_count(MSG_DOOMED);
00028 }
00029 
00030 
00031 void
00032 set_max_doomed_count(
00033   unsigned int  max_messages)
00034 {
00035   set_max_message_count(MSG_DOOMED, max_messages);
00036 }
00037 
00038 
00039 unsigned
00040 get_max_doomed_count()
00041 {
00042   return get_max_message_count(MSG_DOOMED);
00043 }
00044 
00045 
00046 void
00047 report_doomed(
00048   const char *          message,
00049   const MessageCode &   message_code)
00050 {
00051   report_message(message, MSG_DOOMED, message_code);
00052 }
00053 
00054 
00055 void
00056 report_symmetric_doomed(
00057   const char *          message,
00058   const MessageCode &   message_code)
00059 {
00060   report_message(message, MSG_SYMMETRIC | MSG_DOOMED, message_code);
00061 }
00062  
00063 
00064 void
00065 report_deferred_doomed(
00066   const char *          message,
00067   const char *          aggregate,
00068   const MessageCode &   message_code)
00069 {
00070   add_deferred_message(MSG_DOOMED, message_code.m_id, message_code.m_throttle.m_cutoff, message_code.m_throttle.m_group, message, aggregate);
00071 }
00072 
00073 
00074 RuntimeDoomedAdHoc::RuntimeDoomedAdHoc(
00075   const MessageCode & message_code)
00076   : m_messageCode(message_code)
00077 {}
00078 
00079 
00080 RuntimeDoomedAdHoc::~RuntimeDoomedAdHoc()
00081 {
00082   try {
00083     report_doomed(message.str().c_str(), m_messageCode);
00084   }
00085   catch (std::exception &)
00086   {}
00087 }
00088 
00089 
00090 RuntimeDoomedSymmetric::RuntimeDoomedSymmetric(
00091   const MessageCode & message_code)
00092   : m_messageCode(message_code)
00093 {}
00094 
00095 
00096 RuntimeDoomedSymmetric::~RuntimeDoomedSymmetric()
00097 {
00098   try {
00099     report_symmetric_doomed(message.str().c_str(), m_messageCode);
00100   }
00101   catch (std::exception &)
00102   {}
00103 }
00104 
00105 
00106 RuntimeDoomedDeferred::RuntimeDoomedDeferred(
00107   const MessageCode & message_code)
00108   : m_messageCode(message_code)
00109 {}
00110 
00111 
00112 RuntimeDoomedDeferred::~RuntimeDoomedDeferred()
00113 {
00114   try {
00115     report_deferred_doomed(message.str().c_str(), aggregate.str().c_str(), m_messageCode);
00116   }
00117   catch (std::exception &)
00118   {}
00119 }
00120 
00121 } // namespace stk
00122 

Generated on Tue Jul 13 09:27:32 2010 for Sierra Toolkit by  doxygen 1.4.7