cgma
|
#include <CubitMessage.hpp>
Public Member Functions | |
virtual | ~CubitMessage () |
void | set_logging_file_setting (const CubitString &filename, CubitBoolean resume_flag=CUBIT_FALSE) |
void | set_debug_file_setting (const int index, const CubitString &filename) |
CubitString | logging_filename () const |
CubitString | logging_errors_filename () const |
int | is_debug_flag_set (int flag) |
int | debug_flag (const int index) |
void | debug_flag (const int index, const int flag) |
int | number_of_debug_flags () |
virtual void | set_debug_flag_gui (bool) |
virtual int | is_debug_flag_gui_set () |
virtual int | print_debug_gui (const char *,...) |
virtual void | internal_error (const int message_type, std::ofstream *output_stream, const CubitString &str) |
int | print_error (const CubitString &str) |
int | print_warning (const CubitString &str) |
int | print_info (const CubitString &str) |
int | print_debug (const CubitString &str) |
void | print_diagnostic (const CubitString &str) |
int | reset_error_count (int value=0) |
int | error_count () |
int | reset_warning_count (int value=0) |
int | warning_count () |
void | output_debug_information (int from=1, int to=-1, int step=1) |
void | output_debug_information (CubitString &match) |
void | output_logging_information () |
void | start_expected_error_count (int error_count, bool less_than_accepted) |
void | stop_expected_error_count (const CubitString &message) |
Static Public Member Functions | |
static CubitMessage * | instance () |
static void | free_instance () |
static void | delete_instance () |
static bool | get_info_flag () |
static void | set_info_flag (bool flag) |
static bool | get_warning_flag () |
static void | set_warning_flag (bool flag) |
static bool | get_error_flag () |
static void | set_error_flag (bool flag) |
static bool | get_diagnostic_flag () |
static void | set_diagnostic_flag (bool flag) |
static char * | get_logging_file_setting () |
static void | set_logging_file_setting (const char *file) |
static void | set_error_logging_file_setting (const char *file, CubitBoolean resume_flag=CUBIT_FALSE) |
static void | initialize_settings () |
static void | set_message_handler (CubitMessageHandler *handler) |
static CubitMessageHandler * | get_message_handler () |
static void | set_error_handler (CubitMessageErrorHandler *handler) |
static CubitMessageErrorHandler * | get_error_handler () |
Protected Member Functions | |
void | add_to_error_count () |
void | add_to_warning_count () |
void | set_debug_stream (const int index, std::ofstream *output_stream) |
void | remove_debug_stream (const int index) |
int | find_file_use (const CubitString &filename) |
int | count_stream_users (const std::ofstream *stream) |
CubitMessage () | |
Protected Attributes | |
MessageFlag * | debugFlag |
int | currentDebugFlag |
Static Protected Attributes | |
static CubitMessage * | instance_ = NULL |
static CubitMessageHandler * | mHandler = &mDefaultHandler |
static CubitMessageErrorHandler * | mErrorHandler = NULL |
static MessageFlag | staticDebugFlag [] |
static int | infoFlag = CUBIT_TRUE |
static int | warningFlag = CUBIT_TRUE |
static int | errorFlag = CUBIT_TRUE |
static int | diagnosticFlag = CUBIT_FALSE |
static int | errorCount = 0 |
static int | expectedStartErrorCount = -1 |
static int | expectedEndErrorCount = -1 |
static bool | expectedLessErrorCountAccepted = false |
static int | warningCount = 0 |
static std::ofstream * | loggingStream = NULL |
static CubitString * | loggingFile = NULL |
static std::ofstream * | loggingErrorStream = NULL |
static CubitString * | loggingErrorFile = NULL |
Definition at line 294 of file CubitMessage.hpp.
CubitMessage::CubitMessage | ( | ) | [protected] |
Definition at line 99 of file CubitMessage.cpp.
{ infoFlag = CUBIT_TRUE; warningFlag = CUBIT_TRUE; errorFlag = CUBIT_TRUE; diagnosticFlag= CUBIT_FALSE; loggingStream = NULL; loggingFile = NULL; loggingErrorStream = NULL; loggingErrorFile = NULL; currentDebugFlag = CUBIT_DEBUG_1; // Initialize the debugFlag array static MessageFlag staticDebugFlag[] = { MessageFlag( 0, "UNUSED"), MessageFlag( 1, "Previously used; available for reuse."), MessageFlag( 2, "Whisker weaving information"), MessageFlag( 3, "Timing information for 3D Meshing routines."), MessageFlag( 4, "Graphics Debugging (DrawingTool)"), MessageFlag( 5, "FastQ debugging"), MessageFlag( 6, "Submapping graphics debugging"), MessageFlag( 7, "Knife progress whisker weaving information"), MessageFlag( 8, "Mapping Face debug / Linear Programing debug "), MessageFlag( 9, "Paver Debugging"), MessageFlag( 10, "WW: removed hex seam flag"), MessageFlag( 11, "Nodeset Associativity debugging"), MessageFlag( 12, "Fastq activity"), MessageFlag( 13, "Mesh entities"), MessageFlag( 14, "Previously used; available for reuse."), MessageFlag( 15, "Previously used; available for reuse."), MessageFlag( 16, "Previously used; available for reuse."), MessageFlag( 17, "Use Count debugging"), MessageFlag( 18, "Webcut debugging"), MessageFlag( 19, "Feature Merge / Unmerge debugging"), MessageFlag( 20, "Parallel meshing activity"), MessageFlag( 21, "Boundary Layer Tool Debugging"), MessageFlag( 22, "ExodusMesh sizing function debugging"), MessageFlag( 23, "Draw after joining chords in WW"), MessageFlag( 24, "SelfCrossingLoop (and derivatives) debug info"), MessageFlag( 25, "Extra invalidity checking in WW"), MessageFlag( 26, "Surface Smoothing"), MessageFlag( 27, "Primal Construction debugging, see also flag 70"), MessageFlag( 28, "Plastering debugging"), MessageFlag( 29, "Volume SubMapping"), MessageFlag( 30, "Previously used; available for reuse."), MessageFlag( 31, "CleanUp debugging"), MessageFlag( 32, "Previously used; available for reuse."), MessageFlag( 33, "Whisker Weaving inside chord list face drawing"), MessageFlag( 34, "If on Whisker Weaving doesn't merge sheets"), MessageFlag( 35, "If on WW query displays sheets before joining chords"), MessageFlag( 36, "Enable/Disable idr_keyword_debugger function"), MessageFlag( 37, "Previously used; available for reuse."), MessageFlag( 38, "WW hex formation messages"), MessageFlag( 39, "Doublet Pillower graphics output"), MessageFlag( 40, "Previously used; available for reuse."), MessageFlag( 41, "Previously used; available for reuse."), MessageFlag( 42, "Auto vertex type and sweep verification"), MessageFlag( 43, "Programmer Errors for SubMapping"), MessageFlag( 44, "Submapping Graphics Debugging"), MessageFlag( 45, "Pillow Sheet debugging"), MessageFlag( 46, "Paver breakout detection (expensive)"), MessageFlag( 47, "Extra LP debugging (see flag 8 also)"), MessageFlag( 48, "Previously used; available for reuse."), MessageFlag( 49, "Draws Face by Face Creation in Paving"), MessageFlag( 50, "Debugging for AutoSchemeSelect"), MessageFlag( 51, "Previously used; available for reuse."), MessageFlag( 52, "User Interface: If flag is enabled, filenames being\n" "\t\t\t\tused for input will be echoed and each input\n" "\t\t\t\tline will be echoed prior to being parsed."), MessageFlag( 53, "Surface Morpher debugging"), MessageFlag( 54, "Parser debugging"), MessageFlag( 55, "Previously used; available for reuse."), MessageFlag( 56, "Previously used; available for reuse."), MessageFlag( 57, "Relative Interval/Length setting"), MessageFlag( 58, "StcVertex debugging of Whisker Weaving"), MessageFlag( 59, "Previously used; available for reuse."), MessageFlag( 60, "StcVertex debugging of Looping"), MessageFlag( 61, "List number of points used in curve faceting"), MessageFlag( 62, "Print verbose information on group operations"), MessageFlag( 63, "Label Whisker Weaving diagrams tersely"), MessageFlag( 64, "No label on Whisker Weaving diagrams"), MessageFlag( 65, "Volume Morpher debugging"), MessageFlag( 66, "Print debug information on importing Pro/E geometry"), MessageFlag( 67, "List number of triangles used in surface faceting"), MessageFlag( 68, "Previously used; available for reuse."), MessageFlag( 69, "Previously used; available for reuse."), MessageFlag( 70, "STC Pillowing, see also flag 27"), MessageFlag( 71, "Previously used; available for reuse."), MessageFlag( 72, "DoubletPillower text messages"), MessageFlag( 73, "Auto Surface debugging (use new auto surf select)"), MessageFlag( 74, "Feature-based decomposition info"), MessageFlag( 75, "Many-to-many sweep imprint debugging"), MessageFlag( 76, "Virtual point and partition curve"), MessageFlag( 77, "Volume interval matching"), MessageFlag( 78, "Tipton Smoother jacobian modification enabler"), MessageFlag( 79, "Previously used; available for reuse."), MessageFlag( 80, "Previously used; available for reuse."), MessageFlag( 81, "Curve Morpher Debugging"), MessageFlag( 82, "Previously used; available for reuse."), MessageFlag( 83, "Previously used; available for reuse."), MessageFlag( 84, "Surface auto decomposition"), MessageFlag( 85, "U-SubMapping debugging"), MessageFlag( 86, "Virtual curve and partition surface"), MessageFlag( 87, "Composite curve and composite surface"), MessageFlag( 88, "Volume partitioning"), MessageFlag( 89, "Previously used; available for reuse."), MessageFlag( 90, "Geometry attributes"), MessageFlag( 91, "Smoothing Debug Output"), MessageFlag( 92, "Print name changed warnings"), MessageFlag( 93, "Hex Fix Up"), MessageFlag( 94, "Entity name attribute"), MessageFlag( 95, "Group imprint errors"), MessageFlag( 96, "GraftTool debugging"), MessageFlag( 97, "Previously used; available for reuse."), MessageFlag( 98, "Color code imported THEX meshes"), MessageFlag( 99, "Geometry creation"), MessageFlag(100, "Skew Control debugging"), MessageFlag(101, "Previously used; available for reuse."), MessageFlag(102, "CAEntityId debugging"), MessageFlag(103, "Print compact interval assignment constraints"), MessageFlag(104, "Report interval matching progress"), MessageFlag(105, "Previously used; available for reuse."), MessageFlag(106, "Mesh Cleaver debugging"), MessageFlag(107, "Midpoint_subdivision debugging"), MessageFlag(108, "Simulog tetmesher debugging"), MessageFlag(109, "Transition schemes debugging"), MessageFlag(110, "Mesh Defined Geometry"), MessageFlag(111, "TriAdvance mesher debugging"), MessageFlag(112, "Auto Detail Suppression"), MessageFlag(113, "Previously used; available for reuse."), MessageFlag(114, "Blend Finder Debugging"), MessageFlag(115, "Exporting Feature Debugging Files"), MessageFlag(116, "Sizing function tool data information"), MessageFlag(117, "Extra Information on Autoscheme Decision Making"), MessageFlag(118, "Blend finding optimization file"), MessageFlag(119, "Laminate Tool debugging"), MessageFlag(120, "Print unassociated node locations on import mesh"), MessageFlag(121, "Print verbose infeasible match interval messages"), MessageFlag(122, "Mesh-Based Geometry Debug Information"), MessageFlag(123, "Collect memory statistics from Tetmesher"), MessageFlag(124, "Print verbose Tetmesher debugging information"), MessageFlag(125, "Mesh refinement debugging"), MessageFlag(126, "Previously used; available for reuse."), MessageFlag(127, "SculptingTool debug flag"), MessageFlag(128, "Previously used; available for reuse."), MessageFlag(129, "Virtual Imprint Debugging"), MessageFlag(130, "Hexsheet Insertion Debugging"), MessageFlag(131, "Mesh Cutting Debugging"), MessageFlag(132, "Global Collection Smoothing"), MessageFlag(133, "Print verbose import mesh progress"), MessageFlag(134, "Previously used; available for reuse."), MessageFlag(135, "Keep WhiskerWeave data after meshing"), MessageFlag(136, "Previously used; available for reuse."), MessageFlag(137, "GJoin"), MessageFlag(138, "Parallel CGM timing"), MessageFlag(139, "RTree Debugging"), MessageFlag(140, "Previously used; available for reuse."), MessageFlag(141, "Settings save/restore"), MessageFlag(142, "Decompose Sweep Debugging"), MessageFlag(143, "Decomp Sweep Imprint Debugging"), MessageFlag(144, "Medial Axis/Chordal Axis Debugging"), MessageFlag(145, "Virtual Geometry Facet Operations"), MessageFlag(146, "Sector Tool Meshing Scheme"), MessageFlag(147, "Previously used; available for reuse."), MessageFlag(148, "Meshing Benchmarks"), MessageFlag(149, "MeshCutting Graphical debugging"), MessageFlag(150, "MBG to Acis conversion debugging"), MessageFlag(151, "Previously used; available for reuse."), MessageFlag(152, "Boundary Conditions Debugging"), MessageFlag(153, "Print Body information in Geometry operations"), MessageFlag(154, "Split Surface Debugging"), MessageFlag(155, "Meshing Benchmarks Summary"), MessageFlag(156, "CAMAL Paver CleanUp debuging"), MessageFlag(157, "Skeleton Sizing Function timing and counts"), MessageFlag(158, "Previously used; available for reuse."), MessageFlag(159, "Previously used; available for reuse."), MessageFlag(160, "Previously used; available for reuse."), MessageFlag(161, "Previously used; available for reuse."), MessageFlag(162, "Previously used; available for reuse."), MessageFlag(163, "Previously used; available for reuse."), MessageFlag(164, "Previously used; available for reuse."), MessageFlag(165, "Previously used; available for reuse."), MessageFlag(166, "Unconstrained Paving debugging"), MessageFlag(167, "Skeleton Sizing Function Debugging (messages)"), MessageFlag(168, "Tweak Target Multiple Debugging "), MessageFlag(169, "Enable Knupp affine transformation instead of Roca"), MessageFlag(170, "Previously used; available for reuse."), MessageFlag(171, "Previously used; available for reuse."), MessageFlag(172, "Previously used; available for reuse."), MessageFlag(173, "Previously used; available for reuse."), MessageFlag(174, "Previously used; available for reuse."), MessageFlag(175, "Previously used; available for reuse."), MessageFlag(176, "Enable UCP database checking"), MessageFlag(177, "Enable Unconstrained Plastering Debug Drawing"), MessageFlag(178, "Enable Harris instead of Parrish hex refinement"), MessageFlag(179, "Enable Camal Sweeper for UCP Front Advancements.\n" "\t\t\t\tIgnored if debug 189 is on"), MessageFlag(180, "DecompAide (decomposition helper) debugging"), MessageFlag(181, "MBG. Draw curve paths."), MessageFlag(182, "UCP Detailed Debug Printing."), MessageFlag(183, "Previously used; available for reuse."), MessageFlag(184, "Enable old sheet refinement command."), MessageFlag(185, "Enable straddle elements on hardlines."), MessageFlag(186, "Disable parametric coordinates in TriAdvMesher"), MessageFlag(187, "Previously used; available for reuse."), MessageFlag(188, "Tolerant Triangle Meshing"), MessageFlag(189, "Previously used; available for reuse."), MessageFlag(190, "Count CAMAL calls to move_to and normal_at"), MessageFlag(191, "Auto clean messages"), MessageFlag(192, "Previously used; available for reuse."), MessageFlag(193, "Tetmesh with stand-alone INRIA execuable thru files"), MessageFlag(194, "Hex Mesh Matching Debug drawing"), MessageFlag(195, "Previously used; available for reuse."), MessageFlag(196, "Previously used; available for reuse."), MessageFlag(197, "CAMAL Paver debugging (no Cubit smoothing, etc.)"), MessageFlag(198, "Auto Midsurface debugging"), MessageFlag(199, "Angle smoothing debugging"), MessageFlag(200, "Paver quality data output"), MessageFlag(201, "Paver cleanup edge metrics"), MessageFlag(202, "Disable Paver cleanup 3-3 replace"), MessageFlag(203, "Disable Paver cleanup 3-offset-3/5 replace"), MessageFlag(204, "Enable Paver cleanup 3-valent quad cluster"), MessageFlag(205, "Enable Paver cleanup partial chord collapse"), MessageFlag(206, "Hex Mesh Matching, match chords one at a time."), MessageFlag(207, "Defeature and Geometry tolerant meshing"), MessageFlag(208, "Previously used; available for reuse."), MessageFlag(209, "Change sense of partial/full tet remesh (v = !v)"), MessageFlag(210, "Use tetgen tetmesher via files"), MessageFlag(211, "Use tetgen tetmesher via direct interface"), MessageFlag(212, "Create debugging groups when doing geometry/meshing association for parallel refinement"), MessageFlag(213, "Previously used; available for reuse."), MessageFlag(214, "Boundary Layers"), MessageFlag(215, "Command Parser"), MessageFlag(216, "Command Parser Detailed"), MessageFlag(217, "Graphics debugging for unite dissimilar mesh command"), MessageFlag(218, "Previously used; available for reuse."), MessageFlag(219, "Materials Interface"), MessageFlag(220, "Previously used; available for reuse."), MessageFlag(221, "Turn ON Boundary Layer Correction in New Sweeper; ignored if target evaluator is NULL."), MessageFlag(222, "Turn ON Scale Mesh option to maximize percentage of model which gets scaled."), MessageFlag(223, "Turn ON Scale Mesh Debug Drawing."), MessageFlag(224, "Turn ON Scale Mesh Extended Debug Drawing."), MessageFlag(225, "unassigned") // IMPORTANT!!! // If you add a new debug flag, make sure that you change // the result of CubitMessage::number_of_debug_flags(). // In order to use this type of static initialization, // we can't use the sizeof operator, so change it manually. }; debugFlag = staticDebugFlag; // Check initialization of debugFlag array. for (int i=number_of_debug_flags(); i > 0; i--) { debugFlag[i].setting = CUBIT_FALSE; assert(i == debugFlag[i].flagNumber); assert(debugFlag[i].description != NULL); } }
CubitMessage::~CubitMessage | ( | ) | [virtual] |
Definition at line 361 of file CubitMessage.cpp.
{ // Close all streams associated with debug flags. // If the same stream is being used for debug and logging, it // will get closed below. for (int i=number_of_debug_flags(); i > 0; i--) remove_debug_stream(i); // At this time, the only open streams possible are loggingStream and loggingErrorStream. if (loggingStream != NULL) { loggingStream->close(); delete loggingStream; delete loggingFile; } if (loggingErrorStream != NULL) { loggingErrorStream->close(); delete loggingErrorStream; delete loggingErrorFile; } // Set static instance_ to zero to indicated that we are dead. instance_ = 0; }
void CubitMessage::add_to_error_count | ( | ) | [protected] |
Definition at line 577 of file CubitMessage.cpp.
{ errorCount++; }
void CubitMessage::add_to_warning_count | ( | ) | [protected] |
Definition at line 598 of file CubitMessage.cpp.
{ warningCount++; }
int CubitMessage::count_stream_users | ( | const std::ofstream * | stream | ) | [protected] |
Definition at line 686 of file CubitMessage.cpp.
{ int match = 0; if (stream != NULL) { for (int i=number_of_debug_flags(); i > 0; i--) { if (debugFlag[i].outputStream == stream) { match++; } } if (loggingStream == stream) match++; if (loggingErrorStream == stream) match++; } return match; }
int CubitMessage::debug_flag | ( | const int | index | ) | [inline] |
Definition at line 493 of file CubitMessage.hpp.
void CubitMessage::debug_flag | ( | const int | index, |
const int | flag | ||
) | [inline] |
Definition at line 497 of file CubitMessage.hpp.
void CubitMessage::delete_instance | ( | ) | [static] |
Definition at line 387 of file CubitMessage.cpp.
int CubitMessage::error_count | ( | ) |
Definition at line 572 of file CubitMessage.cpp.
{ return errorCount; }
int CubitMessage::find_file_use | ( | const CubitString & | filename | ) | [protected] |
Definition at line 664 of file CubitMessage.cpp.
{ if (filename == "terminal") { // remove_debug_stream has set the outputStream and filename to NULL. return -1; } // See if any of the other debug flags have this file open for (int i=number_of_debug_flags(); i > 0; i--) { if (debugFlag[i].filename && *(debugFlag[i].filename) == filename) { return i; } } if (loggingFile && *(loggingFile) == filename) return -2; if (loggingErrorFile && *(loggingErrorFile) == filename) return -3; return 0; }
void CubitMessage::free_instance | ( | ) | [static] |
Definition at line 92 of file CubitMessage.cpp.
bool CubitMessage::get_diagnostic_flag | ( | ) | [inline, static] |
Definition at line 525 of file CubitMessage.hpp.
{return !!diagnosticFlag;}
bool CubitMessage::get_error_flag | ( | ) | [inline, static] |
Definition at line 517 of file CubitMessage.hpp.
{return !!errorFlag;}
CubitMessageErrorHandler * CubitMessage::get_error_handler | ( | ) | [static] |
Definition at line 812 of file CubitMessage.cpp.
{ return CubitMessage::mErrorHandler; }
bool CubitMessage::get_info_flag | ( | ) | [inline, static] |
Definition at line 501 of file CubitMessage.hpp.
{return !!infoFlag;}
static char* CubitMessage::get_logging_file_setting | ( | ) | [static] |
CubitMessageHandler * CubitMessage::get_message_handler | ( | ) | [static] |
Definition at line 802 of file CubitMessage.cpp.
{ return CubitMessage::mHandler; }
bool CubitMessage::get_warning_flag | ( | ) | [inline, static] |
Definition at line 509 of file CubitMessage.hpp.
{return !!warningFlag;}
void CubitMessage::initialize_settings | ( | ) | [static] |
Definition at line 885 of file CubitMessage.cpp.
{ SettingHandler::instance()->add_setting("Info", CubitMessage::set_info_flag, CubitMessage::get_info_flag); /*SettingHandler::instance()->add_setting("Logging", CubitMessage::set_logging_file_setting, CubitMessage::get_logging_file_setting);*/ SettingHandler::instance()->add_setting("Diagnostic", CubitMessage::set_diagnostic_flag, CubitMessage::get_diagnostic_flag); SettingHandler::instance()->add_setting("Warning", CubitMessage::set_warning_flag, CubitMessage::get_warning_flag); }
CubitMessage * CubitMessage::instance | ( | void | ) | [static] |
Definition at line 78 of file CubitMessage.cpp.
{ if (!instance_) { instance_ = new CubitMessage; if (!instance_) { std::cerr << " *** Unable to instantiate message object ***" << std::endl; exit(1); } } return instance_; }
void CubitMessage::internal_error | ( | const int | message_type, |
std::ofstream * | output_stream, | ||
const CubitString & | str | ||
) | [virtual] |
Definition at line 399 of file CubitMessage.cpp.
{ int print_it = CUBIT_FALSE; CubitString prefix; switch (message_type) { case CUBIT_ERROR: if (errorFlag) { print_it = CUBIT_TRUE; prefix = "ERROR: "; } break; case CUBIT_ERROR_EXPECTED: if (errorFlag) { print_it = CUBIT_TRUE; prefix = "ERROR_EXPECTED: "; } break; case CUBIT_WARNING: if (warningFlag) { print_it = CUBIT_TRUE; prefix = "WARNING: "; } break; case CUBIT_INFO: if (infoFlag) print_it = CUBIT_TRUE; break; case CUBIT_DIAGNOSTIC: if (diagnosticFlag) { print_it = CUBIT_TRUE; prefix = "DIAGNOSTIC: "; } break; default: if (message_type >= CUBIT_DEBUG_1 && message_type <= number_of_debug_flags()+10) { if (debugFlag[message_type-10].setting) print_it = CUBIT_TRUE; break; } } if (print_it) { // loggingStream is used to journal error, warning, and info messages. // debug messages can also be journalled there by setting the // output stream for the debug flag to the same file. if (loggingStream != NULL && (message_type == CUBIT_ERROR || message_type == CUBIT_WARNING || message_type == CUBIT_INFO)) { *loggingStream << prefix.c_str() << msgbuf.c_str(); loggingStream->flush(); } //loggingErrorStream is used to (if the user has requested it) // log only ERROR: messages if (loggingErrorStream != NULL && message_type == CUBIT_ERROR) { *loggingErrorStream << prefix.c_str() << msgbuf.c_str(); loggingErrorStream->flush(); } if (output_stream == NULL) { if(message_type == CUBIT_ERROR) { CubitString ctx; if(CubitMessage::mErrorHandler) { ctx = CubitMessage::mErrorHandler->error_context().c_str(); } CubitString msg = prefix + ctx + msgbuf; CubitMessage::mHandler->print_error(msg.c_str()); } else { CubitString msg = prefix + msgbuf; CubitMessage::mHandler->print_message(msg.c_str()); } } else { *output_stream << prefix.c_str() << msgbuf.c_str(); output_stream->flush(); } } }
virtual int CubitMessage::is_debug_flag_gui_set | ( | ) | [inline, virtual] |
Definition at line 400 of file CubitMessage.hpp.
{return 0;};
int CubitMessage::is_debug_flag_set | ( | int | flag | ) |
Definition at line 538 of file CubitMessage.cpp.
{ if( DEBUG_FLAG( flag )) { currentDebugFlag = flag; return CUBIT_TRUE; } return CUBIT_FALSE; }
Definition at line 914 of file CubitMessage.cpp.
{ CubitString temp_string; if(loggingErrorStream != NULL) temp_string = loggingErrorFile->c_str(); return temp_string; }
CubitString CubitMessage::logging_filename | ( | ) | const |
Definition at line 905 of file CubitMessage.cpp.
{ CubitString temp_string; if(loggingStream != NULL) temp_string = loggingFile->c_str(); return temp_string; }
Definition at line 393 of file CubitMessage.cpp.
{ return NUM_DEBUG_FLAGS; // return sizeof(debugFlag)/sizeof(debugFlag[0])-1; }
void CubitMessage::output_debug_information | ( | int | from = 1 , |
int | to = -1 , |
||
int | step = 1 |
||
) |
Definition at line 603 of file CubitMessage.cpp.
{ if (to == -1) to = number_of_debug_flags(); PRINT_INFO("Debug Flag Settings " "(flag number, setting, output to, description):\n"); for (int i=from; i <= to; i+=step) { debugFlag[i].output(); } PRINT_INFO("\n"); }
void CubitMessage::output_debug_information | ( | CubitString & | match | ) |
Definition at line 616 of file CubitMessage.cpp.
{ int count = 0; for (int i=1; i <= number_of_debug_flags(); i++) { char *tmp = CubitUtil::util_strdup((char*)(debugFlag[i].description)); if (tmp && strlen(tmp) > 0) { CubitString debug_description(tmp); debug_description.to_lower(); if (debug_description.find(match, 0) < debug_description.length()) { if (count == 0) { PRINT_INFO("Debug Flag Settings " "(flag number, setting, output to, description):\n"); } debugFlag[i].output(); count++; } } CubitUtil::util_strdup_free(tmp); } if (count == 0) { PRINT_WARNING("No debug descriptions contain the " "substring '%s'\n", match.c_str()); } PRINT_INFO("\n"); }
Definition at line 642 of file CubitMessage.cpp.
{ if (loggingStream != NULL) PRINT_INFO("logging = On, log file = '%s'\n", loggingFile->c_str()); else PRINT_INFO("logging = Off\n"); if (loggingErrorStream != NULL) PRINT_INFO("logging Errors = On, log file = '%s'\n",loggingErrorFile->c_str()); }
int CubitMessage::print_debug | ( | const CubitString & | str | ) |
Definition at line 548 of file CubitMessage.cpp.
{ internal_error(currentDebugFlag+10, debugFlag[currentDebugFlag].outputStream, str); return CUBIT_FAILURE; }
virtual int CubitMessage::print_debug_gui | ( | const char * | , |
... | |||
) | [inline, virtual] |
Definition at line 401 of file CubitMessage.hpp.
{return 0;};
void CubitMessage::print_diagnostic | ( | const CubitString & | str | ) |
Definition at line 556 of file CubitMessage.cpp.
{ internal_error(CUBIT_DIAGNOSTIC, NULL, str); }
int CubitMessage::print_error | ( | const CubitString & | str | ) |
Definition at line 495 of file CubitMessage.cpp.
{ int error_type = CUBIT_ERROR; if(expectedStartErrorCount != -1 && expectedEndErrorCount > expectedStartErrorCount) { error_type = CUBIT_ERROR_EXPECTED; } else { add_to_error_count(); } if(expectedStartErrorCount != -1) { expectedStartErrorCount++; } static char* cubit_ctest = getenv("CUBIT_CTEST"); if(cubit_ctest && error_type == CUBIT_ERROR) { internal_error(CUBIT_INFO, NULL, "<DartMeasurement name=\"Error\" type=\"text/plain\">\n"); internal_error(error_type, NULL, str); internal_error(CUBIT_INFO, NULL, "</DartMeasurement>\n"); } internal_error(error_type, NULL, str); return CUBIT_FAILURE; }
int CubitMessage::print_info | ( | const CubitString & | str | ) |
Definition at line 532 of file CubitMessage.cpp.
{ internal_error(CUBIT_INFO, NULL, str); return CUBIT_FAILURE; }
int CubitMessage::print_warning | ( | const CubitString & | str | ) |
Definition at line 525 of file CubitMessage.cpp.
{ internal_error(CUBIT_WARNING, NULL, str); add_to_warning_count(); return CUBIT_FAILURE; }
void CubitMessage::remove_debug_stream | ( | const int | index | ) | [protected] |
Definition at line 774 of file CubitMessage.cpp.
{ // NOTE: DO NOT USE PRINT_* CALLS, THIS IS CALLED FROM DESTRUCTOR. // Multiple debug flags may be using the same output stream, // Go through the list and count who is using this stream, // If only one use, close and delete the stream. if (debugFlag[index].outputStream == NULL) return; int match = count_stream_users(debugFlag[index].outputStream); if (match == 1) { debugFlag[index].outputStream->close(); delete debugFlag[index].outputStream; delete debugFlag[index].filename; } debugFlag[index].filename = NULL; debugFlag[index].outputStream = NULL; }
int CubitMessage::reset_error_count | ( | int | value = 0 | ) |
Definition at line 561 of file CubitMessage.cpp.
{ int current_value = errorCount; if (errorCount != value) { errorCount = value; PRINT_WARNING("Error count manually changed from %d to %d\n\n", current_value, value); } return current_value; }
int CubitMessage::reset_warning_count | ( | int | value = 0 | ) |
Definition at line 582 of file CubitMessage.cpp.
{ int current_value = warningCount; if (warningCount != value) { warningCount = value; PRINT_INFO("Warning count manually changed from %d to %d\n\n", current_value, value); } return current_value; }
void CubitMessage::set_debug_file_setting | ( | const int | index, |
const CubitString & | filename | ||
) |
Definition at line 748 of file CubitMessage.cpp.
{ // If this flag is currently outputting to a file, close it if // this is the only flag using that file. remove_debug_stream(index); int match = find_file_use(filename); if (match == -1) // Filename is 'terminal' return; if (match == -2 || match == -3) {// Filename is same as loggingFile or loggingErrorFile; debugFlag[index].filename = loggingFile; debugFlag[index].outputStream = loggingStream; } else if (match == index) return; else if (match != 0) { debugFlag[index].filename = debugFlag[match].filename; debugFlag[index].outputStream = debugFlag[match].outputStream; } else { debugFlag[index].filename = new CubitString(filename); debugFlag[index].outputStream = new std::ofstream(CubitString::toNative(filename).c_str()); } }
virtual void CubitMessage::set_debug_flag_gui | ( | bool | ) | [inline, virtual] |
Definition at line 399 of file CubitMessage.hpp.
{};
void CubitMessage::set_debug_stream | ( | const int | index, |
std::ofstream * | output_stream | ||
) | [protected] |
void CubitMessage::set_diagnostic_flag | ( | bool | flag | ) | [inline, static] |
Definition at line 529 of file CubitMessage.hpp.
{diagnosticFlag = flag;}
void CubitMessage::set_error_flag | ( | bool | flag | ) | [inline, static] |
Definition at line 521 of file CubitMessage.hpp.
{errorFlag = flag;}
void CubitMessage::set_error_handler | ( | CubitMessageErrorHandler * | handler | ) | [static] |
Definition at line 807 of file CubitMessage.cpp.
{ CubitMessage::mErrorHandler = handler; }
void CubitMessage::set_error_logging_file_setting | ( | const char * | file, |
CubitBoolean | resume_flag = CUBIT_FALSE |
||
) | [static] |
Definition at line 854 of file CubitMessage.cpp.
{ if (loggingErrorFile && *loggingErrorFile == filename) return; if(loggingFile && *loggingFile == filename) { PRINT_ERROR("Can't explicitly set the Error logging file to be the same as the logging file.\n"); return; } if (CubitUtil::compare(filename,"terminal")) { // Filename is 'terminal' if (loggingErrorStream != NULL) { loggingErrorStream->close(); delete loggingErrorStream; loggingErrorStream = NULL; delete loggingErrorFile; loggingErrorFile = NULL; } return; } else { loggingErrorFile = new CubitString(filename); if(resume_flag) loggingErrorStream = new std::ofstream(CubitString::toNative(filename).c_str(), std::ios::out | std::ios::app ); else loggingErrorStream = new std::ofstream(CubitString::toNative(filename).c_str()); } }
void CubitMessage::set_info_flag | ( | bool | flag | ) | [inline, static] |
Definition at line 505 of file CubitMessage.hpp.
{infoFlag = flag;}
void CubitMessage::set_logging_file_setting | ( | const CubitString & | filename, |
CubitBoolean | resume_flag = CUBIT_FALSE |
||
) |
Definition at line 707 of file CubitMessage.cpp.
{ // If logging is currently outputting to a file, close it if // it is the only thing using that file. (and the filenames don't match) if (loggingFile && *loggingFile == filename) return; if (loggingErrorFile && *loggingErrorFile == filename) { PRINT_ERROR("Can't set the logging file to be the same as the Error logging file.\n"); return; } int users = count_stream_users(loggingStream); if (users == 1) { // Just us... loggingStream->close(); delete loggingStream; loggingStream = NULL; delete loggingFile; loggingFile = NULL; } int match = find_file_use(filename); if (match == -1) // Filename is 'terminal' return; else if (match != 0) { loggingFile = debugFlag[match].filename; loggingStream = debugFlag[match].outputStream; } else { loggingFile = new CubitString(filename); if(resume_flag) loggingStream = new std::ofstream(CubitString::toNative(filename).c_str(), std::ios::out | std::ios::app); else loggingStream = new std::ofstream(CubitString::toNative(filename).c_str()); } }
void CubitMessage::set_logging_file_setting | ( | const char * | file | ) | [static] |
Definition at line 833 of file CubitMessage.cpp.
{ if (loggingFile && *loggingFile == filename) return; if (CubitUtil::compare(filename,"terminal")) { // Filename is 'terminal' if (loggingStream != NULL) { loggingStream->close(); delete loggingStream; loggingStream = NULL; delete loggingFile; loggingFile = NULL; } return; } else { loggingFile = new CubitString(filename); loggingStream = new std::ofstream(CubitString::toNative(filename).c_str(), std::ios::out | std::ios::app ); } }
void CubitMessage::set_message_handler | ( | CubitMessageHandler * | handler | ) | [static] |
Definition at line 795 of file CubitMessage.cpp.
{ CubitMessage::mHandler = handler; if(CubitMessage::mHandler == NULL) CubitMessage::mHandler = &mDefaultHandler; }
void CubitMessage::set_warning_flag | ( | bool | flag | ) | [inline, static] |
Definition at line 513 of file CubitMessage.hpp.
{warningFlag = flag;}
void CubitMessage::start_expected_error_count | ( | int | error_count, |
bool | less_than_accepted | ||
) |
start an expected error count also set whether an error count less than that is acceptable at stop time X number of errors will be suppressed, and will print out with a prefix of EXPECTED_ERROR:
Definition at line 923 of file CubitMessage.cpp.
{ this->expectedStartErrorCount = errorCount; this->expectedEndErrorCount = errorCount + error_count; this->expectedLessErrorCountAccepted = less_than_accepted; }
void CubitMessage::stop_expected_error_count | ( | const CubitString & | message | ) |
stop an expected error count if the remaining number of expected errors is zero, we simply clean up. otherwise, an ERROR is reported if the CUBIT_CTEST environment variable is set, a cdash formatted message will be printed out
Definition at line 930 of file CubitMessage.cpp.
{ bool has_error = false; if((expectedEndErrorCount != expectedStartErrorCount && expectedLessErrorCountAccepted == false) || (expectedEndErrorCount < expectedStartErrorCount && expectedLessErrorCountAccepted == true)) { has_error = true; } this->expectedStartErrorCount = -1; this->expectedEndErrorCount = -1; if(has_error) { CubitString msg = message; if(message.length() == 0) { msg = "unexpected errors"; } print_error(msg + "\n"); } }
int CubitMessage::warning_count | ( | ) |
Definition at line 593 of file CubitMessage.cpp.
{ return warningCount; }
int CubitMessage::currentDebugFlag [protected] |
Definition at line 324 of file CubitMessage.hpp.
MessageFlag* CubitMessage::debugFlag [protected] |
Definition at line 309 of file CubitMessage.hpp.
int CubitMessage::diagnosticFlag = CUBIT_FALSE [static, protected] |
Definition at line 321 of file CubitMessage.hpp.
int CubitMessage::errorCount = 0 [static, protected] |
Definition at line 326 of file CubitMessage.hpp.
int CubitMessage::errorFlag = CUBIT_TRUE [static, protected] |
Definition at line 318 of file CubitMessage.hpp.
int CubitMessage::expectedEndErrorCount = -1 [static, protected] |
Definition at line 331 of file CubitMessage.hpp.
bool CubitMessage::expectedLessErrorCountAccepted = false [static, protected] |
Definition at line 332 of file CubitMessage.hpp.
int CubitMessage::expectedStartErrorCount = -1 [static, protected] |
Definition at line 330 of file CubitMessage.hpp.
int CubitMessage::infoFlag = CUBIT_TRUE [static, protected] |
Definition at line 312 of file CubitMessage.hpp.
CubitMessage * CubitMessage::instance_ = NULL [static, protected] |
Definition at line 298 of file CubitMessage.hpp.
CubitString * CubitMessage::loggingErrorFile = NULL [static, protected] |
Definition at line 345 of file CubitMessage.hpp.
std::ofstream * CubitMessage::loggingErrorStream = NULL [static, protected] |
Definition at line 344 of file CubitMessage.hpp.
CubitString * CubitMessage::loggingFile = NULL [static, protected] |
Definition at line 339 of file CubitMessage.hpp.
std::ofstream * CubitMessage::loggingStream = NULL [static, protected] |
Definition at line 338 of file CubitMessage.hpp.
CubitMessageErrorHandler * CubitMessage::mErrorHandler = NULL [static, protected] |
Definition at line 304 of file CubitMessage.hpp.
CubitMessageHandler * CubitMessage::mHandler = &mDefaultHandler [static, protected] |
Definition at line 301 of file CubitMessage.hpp.
MessageFlag CubitMessage::staticDebugFlag[] [static, protected] |
Definition at line 307 of file CubitMessage.hpp.
int CubitMessage::warningCount = 0 [static, protected] |
Definition at line 334 of file CubitMessage.hpp.
int CubitMessage::warningFlag = CUBIT_TRUE [static, protected] |
Definition at line 315 of file CubitMessage.hpp.