Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

messaging.cpp

Go to the documentation of this file.
00001 /*
00002  * ******** fete: From ENDF To ENDL *********
00003  * 
00004  * Copyright (c) 2006, The Regents of the University of California. 
00005  * All rights reserved.
00006  * 
00007  * Produced at the Lawrence Livermore National Laboratory. 
00008  * Written by David A. Brown, Gerry Hedstrom, Tony Hill
00009  * 
00010  * This file is part of fete v1.0  (UCRL-CODE-218718)
00011  * 
00012  * Please read the COPYING file for "Our Notice and GNU General 
00013  * Public License" in the root of this software distribution.  
00014  * 
00015  * This program is free software; you can redistribute it and/or modify 
00016  * it under the terms of the GNU General Public License (as published by 
00017  * the Free Software Foundation) version 2, dated June 1991. 
00018  * 
00019  * This program is distributed in the hope that it will be useful, 
00020  * but WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF 
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms 
00022  * and conditions of the GNU General Public License for more details. 
00023  * 
00024  * You should have received a copy of the GNU General Public License along 
00025  * with this program; if not, write to the Free Software Foundation, Inc., 
00026  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
00027  * 
00028  * $Revision: 1735 $
00029  * $Date: 2006-02-09 13:47:26 -0800 (Thu, 09 Feb 2006) $
00030  * $Author: dbrown $
00031  * $Id: messaging.cpp 1735 2006-02-09 21:47:26Z dbrown $
00032  * 
00033  * ******** fete: From ENDF To ENDL *********
00034  */
00035 
00036 #include <string>
00037 #include <iostream>
00038 #include <sstream>
00039 #include "global_params.hpp"
00040 #include "messaging.hpp"
00041 #include "endl_formats.hpp"
00042 #include "logger.hpp"
00043 
00044 extern GlobalParameterClass Global;
00045 extern ENDLClass ENDL;
00046 extern MessageLogger messageLog;
00047 
00048 using namespace std;
00049 
00050 //! Always write out a Fatal Error message, then exit badly
00051 void FatalError(string routine, string error, bool writeLog){
00052     string msg = "fete "+routine+": "+error;
00053     cerr << "Fatal Error "<<msg<<endl;
00054     messageLog.logMessage(ENDL.F, ENDL.T, ENDL.C, ENDL.I, ENDL.S, msg, 4);
00055     if (writeLog) messageLog.write();
00056     exit(-1);
00057 };
00058 
00059 //! Always write out a Severe Error message, then attempt to throw an exception
00060 void SevereError(string routine, string error){
00061     string msg = routine+": "+error;
00062     messageLog.logMessage(ENDL.F, ENDL.T, ENDL.C, ENDL.I, ENDL.S, msg, 3);
00063     throw(string("Severe Error "+msg));
00064 };
00065 
00066 //! Only show a warning if required
00067 void Warning(string routine, string warning){
00068     if (MESSAGELEVEL_WARN) {
00069         string msg = "fete "+routine+": "+warning;
00070         cerr << "Warning "<<msg<<endl;
00071         messageLog.logMessage(ENDL.F, ENDL.T, ENDL.C, ENDL.I, ENDL.S, msg, 2);
00072     }
00073 };
00074 
00075 //! Only show information if required
00076 void Info(string routine, string info){
00077     if (MESSAGELEVEL_INFO) {
00078         string msg = "fete "+routine+": "+info;
00079         cout << "Info "<<msg<<endl;
00080         //messageLog.logMessage(ENDL.F, ENDL.T, msg, 0); // never log Info statements
00081     }
00082 };
00083 
00084 //! Only show information if required
00085 void Unimplemented(string routine, string info){
00086     if (MESSAGELEVEL_INFO) {
00087         string msg = "fete "+routine+": "+info;
00088         cout << "Unimplemented "<<msg<<endl;
00089         messageLog.logMessage(ENDL.F, ENDL.T, ENDL.C, ENDL.I, ENDL.S, msg, 1);
00090     }
00091 };
00092 
00093 //! gizmo to paste doubles on the backs of strings
00094 string pastenum(string front, double back){
00095     ostringstream tmp; 
00096     tmp << front << back; 
00097     return tmp.str();
00098 };
00099 
00100 //! gizmo to paste ints on the backs of strings
00101 string pastenum(string front, int back){
00102     ostringstream tmp; 
00103     tmp << front << back; 
00104     return tmp.str();
00105 };

Generated on Thu Sep 7 10:30:07 2006 for fete -- From ENDFB6 To ENDL by doxygen 1.3.4