cgma
CubitMessage.hpp
Go to the documentation of this file.
00001 //- Class: CubitMessage
00002 //- Description: CubitMessage class - used for reporting messages to
00003 //-              the user
00004 //- Owner: Tim Tautges
00005 //- Checked By:
00006 //- Version:
00007 
00008 #ifndef CUBITMESSAGE_HPP
00009 #define CUBITMESSAGE_HPP
00010 
00011 // *****************
00012 // Class Declaration
00013 // *****************
00014 
00015 #include <fstream>
00016 
00017 #include <cstdarg>
00018 #include "CubitDefines.h"
00019 #include "CGMUtilConfigure.h"
00020 #include "CubitString.hpp"
00021 #include "CubitMessageHandler.hpp"
00022 
00023 // CUBIT debug flags; see CubitMessage.cc for a definition of each flag
00024 
00025 #define CUBIT_ERROR                        0
00026 #define CUBIT_WARNING                      1
00027 #define CUBIT_INFO                         2
00028 #define CUBIT_DIAGNOSTIC                   3
00029 #define CUBIT_ERROR_EXPECTED               4
00030 #define CUBIT_DEBUG_1                     11
00031 
00032 #define PRINT_DEBUG_1(...) PRINT_DEBUG(1, __VA_ARGS__)
00033 #define PRINT_DEBUG_2(...) PRINT_DEBUG(2, __VA_ARGS__)
00034 #define PRINT_DEBUG_3(...) PRINT_DEBUG(3, __VA_ARGS__)
00035 #define PRINT_DEBUG_4(...) PRINT_DEBUG(4, __VA_ARGS__)
00036 #define PRINT_DEBUG_5(...) PRINT_DEBUG(5, __VA_ARGS__)
00037 #define PRINT_DEBUG_6(...) PRINT_DEBUG(6, __VA_ARGS__)
00038 #define PRINT_DEBUG_7(...) PRINT_DEBUG(7, __VA_ARGS__)
00039 #define PRINT_DEBUG_8(...) PRINT_DEBUG(8, __VA_ARGS__)
00040 #define PRINT_DEBUG_9(...) PRINT_DEBUG(9, __VA_ARGS__)
00041 #define PRINT_DEBUG_10(...) PRINT_DEBUG(10, __VA_ARGS__)
00042 #define PRINT_DEBUG_11(...) PRINT_DEBUG(11, __VA_ARGS__)
00043 #define PRINT_DEBUG_12(...) PRINT_DEBUG(12, __VA_ARGS__)
00044 #define PRINT_DEBUG_13(...) PRINT_DEBUG(13, __VA_ARGS__)
00045 #define PRINT_DEBUG_14(...) PRINT_DEBUG(14, __VA_ARGS__)
00046 #define PRINT_DEBUG_15(...) PRINT_DEBUG(15, __VA_ARGS__)
00047 #define PRINT_DEBUG_16(...) PRINT_DEBUG(16, __VA_ARGS__)
00048 #define PRINT_DEBUG_17(...) PRINT_DEBUG(17, __VA_ARGS__)
00049 #define PRINT_DEBUG_18(...) PRINT_DEBUG(18, __VA_ARGS__)
00050 #define PRINT_DEBUG_19(...) PRINT_DEBUG(19, __VA_ARGS__)
00051 #define PRINT_DEBUG_20(...) PRINT_DEBUG(20, __VA_ARGS__)
00052 #define PRINT_DEBUG_21(...) PRINT_DEBUG(21, __VA_ARGS__)
00053 #define PRINT_DEBUG_22(...) PRINT_DEBUG(22, __VA_ARGS__)
00054 #define PRINT_DEBUG_23(...) PRINT_DEBUG(23, __VA_ARGS__)
00055 #define PRINT_DEBUG_24(...) PRINT_DEBUG(24, __VA_ARGS__)
00056 #define PRINT_DEBUG_25(...) PRINT_DEBUG(25, __VA_ARGS__)
00057 #define PRINT_DEBUG_26(...) PRINT_DEBUG(26, __VA_ARGS__)
00058 #define PRINT_DEBUG_27(...) PRINT_DEBUG(27, __VA_ARGS__)
00059 #define PRINT_DEBUG_28(...) PRINT_DEBUG(28, __VA_ARGS__)
00060 #define PRINT_DEBUG_29(...) PRINT_DEBUG(29, __VA_ARGS__)
00061 #define PRINT_DEBUG_30(...) PRINT_DEBUG(30, __VA_ARGS__)
00062 #define PRINT_DEBUG_31(...) PRINT_DEBUG(31, __VA_ARGS__)
00063 #define PRINT_DEBUG_32(...) PRINT_DEBUG(32, __VA_ARGS__)
00064 #define PRINT_DEBUG_33(...) PRINT_DEBUG(33, __VA_ARGS__)
00065 #define PRINT_DEBUG_34(...) PRINT_DEBUG(34, __VA_ARGS__)
00066 #define PRINT_DEBUG_35(...) PRINT_DEBUG(35, __VA_ARGS__)
00067 #define PRINT_DEBUG_36(...) PRINT_DEBUG(36, __VA_ARGS__)
00068 #define PRINT_DEBUG_37(...) PRINT_DEBUG(37, __VA_ARGS__)
00069 #define PRINT_DEBUG_38(...) PRINT_DEBUG(38, __VA_ARGS__)
00070 #define PRINT_DEBUG_39(...) PRINT_DEBUG(39, __VA_ARGS__)
00071 #define PRINT_DEBUG_40(...) PRINT_DEBUG(40, __VA_ARGS__)
00072 #define PRINT_DEBUG_41(...) PRINT_DEBUG(41, __VA_ARGS__)
00073 #define PRINT_DEBUG_42(...) PRINT_DEBUG(42, __VA_ARGS__)
00074 #define PRINT_DEBUG_43(...) PRINT_DEBUG(43, __VA_ARGS__)
00075 #define PRINT_DEBUG_44(...) PRINT_DEBUG(44, __VA_ARGS__)
00076 #define PRINT_DEBUG_45(...) PRINT_DEBUG(45, __VA_ARGS__)
00077 #define PRINT_DEBUG_46(...) PRINT_DEBUG(46, __VA_ARGS__)
00078 #define PRINT_DEBUG_47(...) PRINT_DEBUG(47, __VA_ARGS__)
00079 #define PRINT_DEBUG_48(...) PRINT_DEBUG(48, __VA_ARGS__)
00080 #define PRINT_DEBUG_49(...) PRINT_DEBUG(49, __VA_ARGS__)
00081 #define PRINT_DEBUG_50(...) PRINT_DEBUG(50, __VA_ARGS__)
00082 #define PRINT_DEBUG_51(...) PRINT_DEBUG(51, __VA_ARGS__)
00083 #define PRINT_DEBUG_52(...) PRINT_DEBUG(52, __VA_ARGS__)
00084 #define PRINT_DEBUG_53(...) PRINT_DEBUG(53, __VA_ARGS__)
00085 #define PRINT_DEBUG_54(...) PRINT_DEBUG(54, __VA_ARGS__)
00086 #define PRINT_DEBUG_55(...) PRINT_DEBUG(55, __VA_ARGS__)
00087 #define PRINT_DEBUG_56(...) PRINT_DEBUG(56, __VA_ARGS__)
00088 #define PRINT_DEBUG_57(...) PRINT_DEBUG(57, __VA_ARGS__)
00089 #define PRINT_DEBUG_58(...) PRINT_DEBUG(58, __VA_ARGS__)
00090 #define PRINT_DEBUG_59(...) PRINT_DEBUG(59, __VA_ARGS__)
00091 #define PRINT_DEBUG_60(...) PRINT_DEBUG(60, __VA_ARGS__)
00092 #define PRINT_DEBUG_61(...) PRINT_DEBUG(61, __VA_ARGS__)
00093 #define PRINT_DEBUG_62(...) PRINT_DEBUG(62, __VA_ARGS__)
00094 #define PRINT_DEBUG_63(...) PRINT_DEBUG(63, __VA_ARGS__)
00095 #define PRINT_DEBUG_64(...) PRINT_DEBUG(64, __VA_ARGS__)
00096 #define PRINT_DEBUG_65(...) PRINT_DEBUG(65, __VA_ARGS__)
00097 #define PRINT_DEBUG_66(...) PRINT_DEBUG(66, __VA_ARGS__)
00098 #define PRINT_DEBUG_67(...) PRINT_DEBUG(67, __VA_ARGS__)
00099 #define PRINT_DEBUG_68(...) PRINT_DEBUG(68, __VA_ARGS__)
00100 #define PRINT_DEBUG_69(...) PRINT_DEBUG(69, __VA_ARGS__)
00101 #define PRINT_DEBUG_70(...) PRINT_DEBUG(70, __VA_ARGS__)
00102 #define PRINT_DEBUG_71(...) PRINT_DEBUG(71, __VA_ARGS__)
00103 #define PRINT_DEBUG_72(...) PRINT_DEBUG(72, __VA_ARGS__)
00104 #define PRINT_DEBUG_73(...) PRINT_DEBUG(73, __VA_ARGS__)
00105 #define PRINT_DEBUG_74(...) PRINT_DEBUG(74, __VA_ARGS__)
00106 #define PRINT_DEBUG_75(...) PRINT_DEBUG(75, __VA_ARGS__)
00107 #define PRINT_DEBUG_76(...) PRINT_DEBUG(76, __VA_ARGS__)
00108 #define PRINT_DEBUG_77(...) PRINT_DEBUG(77, __VA_ARGS__)
00109 #define PRINT_DEBUG_78(...) PRINT_DEBUG(78, __VA_ARGS__)
00110 #define PRINT_DEBUG_79(...) PRINT_DEBUG(79, __VA_ARGS__)
00111 #define PRINT_DEBUG_80(...) PRINT_DEBUG(80, __VA_ARGS__)
00112 #define PRINT_DEBUG_81(...) PRINT_DEBUG(81, __VA_ARGS__)
00113 #define PRINT_DEBUG_82(...) PRINT_DEBUG(82, __VA_ARGS__)
00114 #define PRINT_DEBUG_83(...) PRINT_DEBUG(83, __VA_ARGS__)
00115 #define PRINT_DEBUG_84(...) PRINT_DEBUG(84, __VA_ARGS__)
00116 #define PRINT_DEBUG_85(...) PRINT_DEBUG(85, __VA_ARGS__)
00117 #define PRINT_DEBUG_86(...) PRINT_DEBUG(86, __VA_ARGS__)
00118 #define PRINT_DEBUG_87(...) PRINT_DEBUG(87, __VA_ARGS__)
00119 #define PRINT_DEBUG_88(...) PRINT_DEBUG(88, __VA_ARGS__)
00120 #define PRINT_DEBUG_89(...) PRINT_DEBUG(89, __VA_ARGS__)
00121 #define PRINT_DEBUG_90(...) PRINT_DEBUG(90, __VA_ARGS__)
00122 #define PRINT_DEBUG_91(...) PRINT_DEBUG(91, __VA_ARGS__)
00123 #define PRINT_DEBUG_92(...) PRINT_DEBUG(92, __VA_ARGS__)
00124 #define PRINT_DEBUG_93(...) PRINT_DEBUG(93, __VA_ARGS__)
00125 #define PRINT_DEBUG_94(...) PRINT_DEBUG(94, __VA_ARGS__)
00126 #define PRINT_DEBUG_95(...) PRINT_DEBUG(95, __VA_ARGS__)
00127 #define PRINT_DEBUG_96(...) PRINT_DEBUG(96, __VA_ARGS__)
00128 #define PRINT_DEBUG_97(...) PRINT_DEBUG(97, __VA_ARGS__)
00129 #define PRINT_DEBUG_98(...) PRINT_DEBUG(98, __VA_ARGS__)
00130 #define PRINT_DEBUG_99(...) PRINT_DEBUG(99, __VA_ARGS__)
00131 #define PRINT_DEBUG_100(...) PRINT_DEBUG(100, __VA_ARGS__)
00132 #define PRINT_DEBUG_101(...) PRINT_DEBUG(101, __VA_ARGS__)
00133 #define PRINT_DEBUG_102(...) PRINT_DEBUG(102, __VA_ARGS__)
00134 #define PRINT_DEBUG_103(...) PRINT_DEBUG(103, __VA_ARGS__)
00135 #define PRINT_DEBUG_104(...) PRINT_DEBUG(104, __VA_ARGS__)
00136 #define PRINT_DEBUG_105(...) PRINT_DEBUG(105, __VA_ARGS__)
00137 #define PRINT_DEBUG_106(...) PRINT_DEBUG(106, __VA_ARGS__)
00138 #define PRINT_DEBUG_107(...) PRINT_DEBUG(107, __VA_ARGS__)
00139 #define PRINT_DEBUG_108(...) PRINT_DEBUG(108, __VA_ARGS__)
00140 #define PRINT_DEBUG_109(...) PRINT_DEBUG(109, __VA_ARGS__)
00141 #define PRINT_DEBUG_110(...) PRINT_DEBUG(110, __VA_ARGS__)
00142 #define PRINT_DEBUG_111(...) PRINT_DEBUG(111, __VA_ARGS__)
00143 #define PRINT_DEBUG_112(...) PRINT_DEBUG(112, __VA_ARGS__)
00144 #define PRINT_DEBUG_113(...) PRINT_DEBUG(113, __VA_ARGS__)
00145 #define PRINT_DEBUG_114(...) PRINT_DEBUG(114, __VA_ARGS__)
00146 #define PRINT_DEBUG_115(...) PRINT_DEBUG(115, __VA_ARGS__)
00147 #define PRINT_DEBUG_116(...) PRINT_DEBUG(116, __VA_ARGS__)
00148 #define PRINT_DEBUG_117(...) PRINT_DEBUG(117, __VA_ARGS__)
00149 #define PRINT_DEBUG_118(...) PRINT_DEBUG(118, __VA_ARGS__)
00150 #define PRINT_DEBUG_119(...) PRINT_DEBUG(119, __VA_ARGS__)
00151 #define PRINT_DEBUG_120(...) PRINT_DEBUG(120, __VA_ARGS__)
00152 #define PRINT_DEBUG_121(...) PRINT_DEBUG(121, __VA_ARGS__)
00153 #define PRINT_DEBUG_122(...) PRINT_DEBUG(122, __VA_ARGS__)
00154 #define PRINT_DEBUG_123(...) PRINT_DEBUG(123, __VA_ARGS__)
00155 #define PRINT_DEBUG_124(...) PRINT_DEBUG(124, __VA_ARGS__)
00156 #define PRINT_DEBUG_125(...) PRINT_DEBUG(125, __VA_ARGS__)
00157 #define PRINT_DEBUG_126(...) PRINT_DEBUG(126, __VA_ARGS__)
00158 #define PRINT_DEBUG_127(...) PRINT_DEBUG(127, __VA_ARGS__)
00159 #define PRINT_DEBUG_128(...) PRINT_DEBUG(128, __VA_ARGS__)
00160 #define PRINT_DEBUG_129(...) PRINT_DEBUG(129, __VA_ARGS__)
00161 #define PRINT_DEBUG_130(...) PRINT_DEBUG(130, __VA_ARGS__)
00162 #define PRINT_DEBUG_131(...) PRINT_DEBUG(131, __VA_ARGS__)
00163 #define PRINT_DEBUG_132(...) PRINT_DEBUG(132, __VA_ARGS__)
00164 #define PRINT_DEBUG_133(...) PRINT_DEBUG(133, __VA_ARGS__)
00165 #define PRINT_DEBUG_134(...) PRINT_DEBUG(134, __VA_ARGS__)
00166 #define PRINT_DEBUG_135(...) PRINT_DEBUG(135, __VA_ARGS__)
00167 #define PRINT_DEBUG_136(...) PRINT_DEBUG(136, __VA_ARGS__)
00168 #define PRINT_DEBUG_137(...) PRINT_DEBUG(137, __VA_ARGS__)
00169 #define PRINT_DEBUG_138(...) PRINT_DEBUG(138, __VA_ARGS__)
00170 #define PRINT_DEBUG_139(...) PRINT_DEBUG(139, __VA_ARGS__)
00171 #define PRINT_DEBUG_140(...) PRINT_DEBUG(140, __VA_ARGS__)
00172 #define PRINT_DEBUG_141(...) PRINT_DEBUG(141, __VA_ARGS__)
00173 #define PRINT_DEBUG_142(...) PRINT_DEBUG(142, __VA_ARGS__)
00174 #define PRINT_DEBUG_143(...) PRINT_DEBUG(143, __VA_ARGS__)
00175 #define PRINT_DEBUG_144(...) PRINT_DEBUG(144, __VA_ARGS__)
00176 #define PRINT_DEBUG_145(...) PRINT_DEBUG(145, __VA_ARGS__)
00177 #define PRINT_DEBUG_146(...) PRINT_DEBUG(146, __VA_ARGS__)
00178 #define PRINT_DEBUG_147(...) PRINT_DEBUG(147, __VA_ARGS__)
00179 #define PRINT_DEBUG_148(...) PRINT_DEBUG(148, __VA_ARGS__)
00180 #define PRINT_DEBUG_149(...) PRINT_DEBUG(149, __VA_ARGS__)
00181 #define PRINT_DEBUG_150(...) PRINT_DEBUG(150, __VA_ARGS__)
00182 #define PRINT_DEBUG_151(...) PRINT_DEBUG(151, __VA_ARGS__)
00183 #define PRINT_DEBUG_152(...) PRINT_DEBUG(152, __VA_ARGS__)
00184 #define PRINT_DEBUG_153(...) PRINT_DEBUG(153, __VA_ARGS__)
00185 #define PRINT_DEBUG_154(...) PRINT_DEBUG(154, __VA_ARGS__)
00186 #define PRINT_DEBUG_155(...) PRINT_DEBUG(155, __VA_ARGS__)
00187 #define PRINT_DEBUG_156(...) PRINT_DEBUG(156, __VA_ARGS__)
00188 #define PRINT_DEBUG_157(...) PRINT_DEBUG(157, __VA_ARGS__)
00189 #define PRINT_DEBUG_158(...) PRINT_DEBUG(158, __VA_ARGS__)
00190 #define PRINT_DEBUG_159(...) PRINT_DEBUG(159, __VA_ARGS__)
00191 #define PRINT_DEBUG_160(...) PRINT_DEBUG(160, __VA_ARGS__)
00192 #define PRINT_DEBUG_161(...) PRINT_DEBUG(161, __VA_ARGS__)
00193 #define PRINT_DEBUG_162(...) PRINT_DEBUG(162, __VA_ARGS__)
00194 #define PRINT_DEBUG_163(...) PRINT_DEBUG(163, __VA_ARGS__)
00195 #define PRINT_DEBUG_164(...) PRINT_DEBUG(164, __VA_ARGS__)
00196 #define PRINT_DEBUG_165(...) PRINT_DEBUG(165, __VA_ARGS__)
00197 #define PRINT_DEBUG_166(...) PRINT_DEBUG(166, __VA_ARGS__)
00198 #define PRINT_DEBUG_167(...) PRINT_DEBUG(167, __VA_ARGS__)
00199 #define PRINT_DEBUG_168(...) PRINT_DEBUG(168, __VA_ARGS__)
00200 #define PRINT_DEBUG_169(...) PRINT_DEBUG(169, __VA_ARGS__)
00201 #define PRINT_DEBUG_170(...) PRINT_DEBUG(170, __VA_ARGS__)
00202 #define PRINT_DEBUG_171(...) PRINT_DEBUG(171, __VA_ARGS__)
00203 #define PRINT_DEBUG_172(...) PRINT_DEBUG(172, __VA_ARGS__)
00204 #define PRINT_DEBUG_173(...) PRINT_DEBUG(173, __VA_ARGS__)
00205 #define PRINT_DEBUG_174(...) PRINT_DEBUG(174, __VA_ARGS__)
00206 #define PRINT_DEBUG_175(...) PRINT_DEBUG(175, __VA_ARGS__)
00207 #define PRINT_DEBUG_176(...) PRINT_DEBUG(176, __VA_ARGS__)
00208 #define PRINT_DEBUG_177(...) PRINT_DEBUG(177, __VA_ARGS__)
00209 #define PRINT_DEBUG_178(...) PRINT_DEBUG(178, __VA_ARGS__)
00210 #define PRINT_DEBUG_179(...) PRINT_DEBUG(179, __VA_ARGS__)
00211 #define PRINT_DEBUG_180(...) PRINT_DEBUG(180, __VA_ARGS__)
00212 #define PRINT_DEBUG_181(...) PRINT_DEBUG(181, __VA_ARGS__)
00213 #define PRINT_DEBUG_182(...) PRINT_DEBUG(182, __VA_ARGS__)
00214 #define PRINT_DEBUG_183(...) PRINT_DEBUG(183, __VA_ARGS__)
00215 #define PRINT_DEBUG_184(...) PRINT_DEBUG(184, __VA_ARGS__)
00216 #define PRINT_DEBUG_185(...) PRINT_DEBUG(185, __VA_ARGS__)
00217 #define PRINT_DEBUG_186(...) PRINT_DEBUG(186, __VA_ARGS__)
00218 #define PRINT_DEBUG_187(...) PRINT_DEBUG(187, __VA_ARGS__)
00219 #define PRINT_DEBUG_188(...) PRINT_DEBUG(188, __VA_ARGS__)
00220 #define PRINT_DEBUG_189(...) PRINT_DEBUG(189, __VA_ARGS__)
00221 #define PRINT_DEBUG_190(...) PRINT_DEBUG(190, __VA_ARGS__)
00222 #define PRINT_DEBUG_191(...) PRINT_DEBUG(191, __VA_ARGS__)
00223 #define PRINT_DEBUG_192(...) PRINT_DEBUG(192, __VA_ARGS__)
00224 #define PRINT_DEBUG_193(...) PRINT_DEBUG(193, __VA_ARGS__)
00225 #define PRINT_DEBUG_194(...) PRINT_DEBUG(194, __VA_ARGS__)
00226 #define PRINT_DEBUG_195(...) PRINT_DEBUG(195, __VA_ARGS__)
00227 #define PRINT_DEBUG_196(...) PRINT_DEBUG(196, __VA_ARGS__)
00228 #define PRINT_DEBUG_197(...) PRINT_DEBUG(197, __VA_ARGS__)
00229 #define PRINT_DEBUG_198(...) PRINT_DEBUG(198, __VA_ARGS__)
00230 #define PRINT_DEBUG_199(...) PRINT_DEBUG(199, __VA_ARGS__)
00231 #define PRINT_DEBUG_200(...) PRINT_DEBUG(200, __VA_ARGS__)
00232 #define PRINT_DEBUG_201(...) PRINT_DEBUG(201, __VA_ARGS__)
00233 #define PRINT_DEBUG_202(...) PRINT_DEBUG(202, __VA_ARGS__)
00234 #define PRINT_DEBUG_203(...) PRINT_DEBUG(203, __VA_ARGS__)
00235 #define PRINT_DEBUG_204(...) PRINT_DEBUG(204, __VA_ARGS__)
00236 #define PRINT_DEBUG_205(...) PRINT_DEBUG(205, __VA_ARGS__)
00237 #define PRINT_DEBUG_206(...) PRINT_DEBUG(206, __VA_ARGS__)
00238 #define PRINT_DEBUG_207(...) PRINT_DEBUG(207, __VA_ARGS__)
00239 #define PRINT_DEBUG_208(...) PRINT_DEBUG(208, __VA_ARGS__)
00240 #define PRINT_DEBUG_209(...) PRINT_DEBUG(209, __VA_ARGS__)
00241 #define PRINT_DEBUG_210(...) PRINT_DEBUG(210, __VA_ARGS__)
00242 #define PRINT_DEBUG_211(...) PRINT_DEBUG(211, __VA_ARGS__)
00243 #define PRINT_DEBUG_212(...) PRINT_DEBUG(212, __VA_ARGS__)
00244 #define PRINT_DEBUG_213(...) PRINT_DEBUG(213, __VA_ARGS__)
00245 #define PRINT_DEBUG_214(...) PRINT_DEBUG(214, __VA_ARGS__)
00246 #define PRINT_DEBUG_215(...) PRINT_DEBUG(215, __VA_ARGS__)
00247 #define PRINT_DEBUG_216(...) PRINT_DEBUG(216, __VA_ARGS__)
00248 #define PRINT_DEBUG_217(...) PRINT_DEBUG(217, __VA_ARGS__)
00249 #define PRINT_DEBUG_218(...) PRINT_DEBUG(218, __VA_ARGS__)
00250 #define PRINT_DEBUG_219(...) PRINT_DEBUG(219, __VA_ARGS__)
00251 #define PRINT_DEBUG_220(...) PRINT_DEBUG(220, __VA_ARGS__)
00252 #define PRINT_DEBUG_221(...) PRINT_DEBUG(221, __VA_ARGS__)
00253 #define PRINT_DEBUG_222(...) PRINT_DEBUG(222, __VA_ARGS__)
00254 #define NUM_DEBUG_FLAGS 224
00255 
00256 #define PRINT_ERROR(...) CubitMessage::instance()->print_error(CubitString::format(__VA_ARGS__))
00257 #define PRINT_WARNING(...) CubitMessage::instance()->print_warning(CubitString::format(__VA_ARGS__))
00258 #define PRINT_INFO(...) CubitMessage::instance()->print_info(CubitString::format(__VA_ARGS__))
00259 #define DIAGNOSTIC(...) CubitMessage::instance()->print_diagnostic(CubitString::format(__VA_ARGS__))
00260 #define DIAGNOSTIC_FLAG CubitMessage::instance()->get_diagnostic_flag
00261 #define DEBUG_FLAG CubitMessage::instance()->debug_flag
00262 #define GET_INFO_FLAG CubitMessage::instance()->get_info_flag
00263 #define SET_INFO_FLAG CubitMessage::instance()->set_info_flag
00264 #define SET_WARNING_FLAG CubitMessage::instance()->set_warning_flag
00265 #define GET_WARNING_FLAG CubitMessage::instance()->get_warning_flag
00266 #define SET_ERROR_FLAG CubitMessage::instance()->set_error_flag
00267 #define GET_ERROR_FLAG CubitMessage::instance()->get_error_flag
00268 #define DEBUG_FLAG_SET CubitMessage::instance()->is_debug_flag_set
00269 #define PRINT_DEBUG(x, ...) if(DEBUG_FLAG_SET(x)) CubitMessage::instance()->print_debug(CubitString::format(__VA_ARGS__))
00270 #define PRINT_FREE CubitMessage::free_instance()
00271 
00272 class CubitString;
00273 class CubitMessage;
00274 
00275 class CUBIT_UTIL_EXPORT MessageFlag
00276 {
00277   friend class CubitMessage;
00278 public:
00279   ~MessageFlag();
00280 private:
00281   MessageFlag();
00282   MessageFlag(int flag_number, const char *desc);
00283 
00284   void output();
00285 
00286     // Member variables
00287   int flagNumber;
00288   int setting;
00289   const char *description;
00290   CubitString *filename;
00291   std::ofstream *outputStream;
00292 };
00293 
00294 class CUBIT_UTIL_EXPORT CubitMessage
00295 {
00296 protected:
00297 
00298   static CubitMessage* instance_;
00299   //- static pointer to unique instance of this class
00300 
00301   static CubitMessageHandler* mHandler;
00302   //- static pointer to the message output handler
00303   
00304   static CubitMessageErrorHandler* mErrorHandler;
00305   //- static pointer to the message context handler
00306 
00307   static MessageFlag staticDebugFlag[];
00308 
00309   MessageFlag *debugFlag;
00310   //- debug flag, used with internal_error
00311 
00312   static int infoFlag;
00313   //- info flag, used with internal_error
00314 
00315   static int warningFlag;
00316   //- warning flag, used with internal_error
00317 
00318   static int errorFlag;
00319   //- error flag, used with internal_error
00320 
00321   static int diagnosticFlag;
00322   //- diagnostic flag, used with internal_error
00323 
00324   int currentDebugFlag;
00325 
00326   static int errorCount;
00327   //- static variable to track the errors that occured in the
00328   //- a session.  Only gets set when PRINT_ERROR is called.
00329 
00330   static int expectedStartErrorCount;
00331   static int expectedEndErrorCount;
00332   static bool expectedLessErrorCountAccepted;
00333 
00334   static int warningCount;
00335   //- static variable to track the warnings that occured in the
00336   //- a session.  Only gets set when PRINT_WARNING is called.
00337 
00338   static std::ofstream *loggingStream;
00339   static CubitString *loggingFile;
00340   //- Stream pointer for logging of internal_error messages.
00341   //- If NULL, output goes to terminal only (except for debug)
00342   //- If Non-NULL, output goes to both terminal and stream.
00343 
00344   static std::ofstream *loggingErrorStream;
00345   static CubitString *loggingErrorFile;
00346   //- Stream pointer for logging of only ERROR messages.
00347   //- If NULL, ERROR output goes to normal places only
00348   //- If Non-NULL, output goes to both this stream, and all other places.
00349 
00350   void add_to_error_count();
00351   //- Increments the errorCount variable. Keep private (GDS).
00352 
00353   void add_to_warning_count();
00354   //- Increments the errorCount variable. Keep private (GDS).
00355   void set_debug_stream(const int index, std::ofstream *output_stream);
00356   //- Set the output stream for this debug flag to output_stream.
00357 
00358   void remove_debug_stream(const int index);
00359   //- Close and delete the stream if only one use.
00360 
00361   int find_file_use(const CubitString &filename);
00362   int count_stream_users(const std::ofstream *stream);
00363 
00364   CubitMessage ();
00365     //- Class Constructor. (Not callable by user code. Class is constructed
00366     //- by the {instance()} member function.
00367 
00368 public:
00369 
00370   static CubitMessage* instance();
00371   static void free_instance();
00372   //- Controlled access and creation of the sole instance of this class.
00373 
00374   virtual ~CubitMessage();
00375   //- Class Destructor.
00376 
00377   static void delete_instance();
00378 
00379   void set_logging_file_setting(const CubitString &filename, CubitBoolean resume_flag = CUBIT_FALSE);
00380   void set_debug_file_setting(const int index, const CubitString &filename);
00381 
00382   CubitString logging_filename() const;
00383   CubitString logging_errors_filename() const;
00384 
00385   int is_debug_flag_set( int flag );
00386   //- for use with the PRINT_DEBUG macro only
00387 
00388   //static int get_debug_for_setting_handler(const int index)
00389   //{return staticDebugFlag[index].setting;};
00390   // static void set_debug_for_setting_handler(const int index, const int value)
00391   //{staticDebugFlag[index].setting = value;};
00392   //- for use with SettingHandler.cpp code only
00393 
00394   int  debug_flag(const int index);
00395   void debug_flag(const int index, const int flag);
00396   int  number_of_debug_flags();
00397   //- debug flag, used with internal_error
00398 
00399   virtual void set_debug_flag_gui(bool /*flag*/){};
00400   virtual int is_debug_flag_gui_set(){return 0;};
00401   virtual int print_debug_gui( const char* /* format*/ , ... ){return 0;};
00402   //- write out a debug message (from GUI only)
00403   //- used for GUI Debugging (CAT-only)
00404 
00405   static bool get_info_flag();
00406   static void set_info_flag(bool flag);
00407   //- info flag, used with internal_error
00408 
00409   static bool get_warning_flag();
00410   static void set_warning_flag(bool flag);
00411   //- warning flag, used with internal_error
00412 
00413   static bool get_error_flag();
00414   static void set_error_flag(bool flag);
00415   //- error flag, used with internal_error
00416 
00417   static bool get_diagnostic_flag();
00418   static void set_diagnostic_flag(bool flag);
00419   //- diagnostic flag, used with internal_error
00420 
00421   virtual void internal_error(const int message_type, std::ofstream *output_stream,
00422                               const CubitString& str);
00423   //- write out a debug/info/error/warning message
00424 
00425   int print_error(const CubitString& str);
00426   //- write out an error message
00427 
00428   int print_warning(const CubitString& str);
00429   //- write out a warning message
00430 
00431   int print_info(const CubitString& str);
00432   //- write out an info message
00433 
00434   int print_debug(const CubitString& str);
00435   //- write out a debug message
00436 
00437   void print_diagnostic(const CubitString& str);
00438   //- write out a diagnostic message
00439 
00440   int reset_error_count(int value = 0);
00441   //- Sets the errorCount variable to 0;
00442   //- Returns current value of variable.
00443 
00444   int error_count();
00445   //- Returns the value of the errorCount variable;
00446   //- This errorCount variable is incremented only if print_error is called;
00447   //- there is not a public  interface to only set the flag.
00448   //- My reasoning for that is that there should be
00449   //- some notification of an error so that the
00450   //- user can figure out why this function returns TRUE.
00451 
00452   int reset_warning_count(int value = 0);
00453   //- Sets the warningCount variable to 0;
00454   //- Returns current value of variable.
00455 
00456   int warning_count();
00457   //- Returns the value of the warningCount variable;
00458   //- This warningCount variable is incremented only if print_warning is called;
00459   //- there is not a public  interface to only set the flag.
00460   //- My reasoning for that is that there should be
00461   //- some notification of an error so that the
00462   //- user can figure out why this function returns TRUE.
00463 
00464   void output_debug_information(int from=1, int to=-1, int step=1);
00465   void output_debug_information(CubitString &match);
00466   void output_logging_information();
00467 
00468   static char* get_logging_file_setting();
00469   static void set_logging_file_setting(const char* file);
00470   static void set_error_logging_file_setting(const char* file, CubitBoolean resume_flag = CUBIT_FALSE);
00471 
00472   static void initialize_settings();
00473 
00474   static void set_message_handler(CubitMessageHandler *handler);
00475   static CubitMessageHandler* get_message_handler();
00476   
00477   static void set_error_handler(CubitMessageErrorHandler *handler);
00478   static CubitMessageErrorHandler* get_error_handler();
00479 
00483   void start_expected_error_count(int error_count, bool less_than_accepted);
00488   void stop_expected_error_count(const CubitString& message);
00489 
00490 }; // End of Class CubitMessage
00491 
00492 inline int
00493 CubitMessage::debug_flag(const int index)
00494 {return debugFlag[index].setting;}
00495 
00496 inline void
00497 CubitMessage::debug_flag(const int index, const int flag)
00498 {debugFlag[index].setting = flag;}
00499 
00500 inline bool
00501 CubitMessage::get_info_flag()
00502 {return !!infoFlag;}
00503 
00504 inline void
00505 CubitMessage::set_info_flag(bool flag)
00506 {infoFlag = flag;}
00507 
00508 inline bool
00509 CubitMessage::get_warning_flag()
00510 {return !!warningFlag;}
00511 
00512 inline void
00513 CubitMessage::set_warning_flag(bool flag)
00514 {warningFlag = flag;}
00515 
00516 inline bool
00517 CubitMessage::get_error_flag()
00518 {return !!errorFlag;}
00519 
00520 inline void
00521 CubitMessage::set_error_flag(bool flag)
00522 {errorFlag = flag;}
00523 
00524 inline bool
00525 CubitMessage::get_diagnostic_flag()
00526 {return !!diagnosticFlag;}
00527 
00528 inline void
00529 CubitMessage::set_diagnostic_flag(bool flag)
00530 {diagnosticFlag = flag;}
00531 
00532 #endif
00533 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines