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: 1869 $ 00029 * $Date: 2006-05-15 12:56:46 -0700 (Mon, 15 May 2006) $ 00030 * $Author: dbrown $ 00031 * $Id: logger.hpp 1869 2006-05-15 19:56:46Z dbrown $ 00032 * 00033 * ******** fete: From ENDF To ENDL ********* 00034 */ 00035 00036 #ifndef __LOGGER_HPP 00037 #define __LOGGER_HPP 00038 00039 #include <map> 00040 #include <string> 00041 #include <iostream> 00042 #include "version.hpp" 00043 #include "global_params.hpp" 00044 00045 using namespace std; 00046 00047 //! MF & MT of of the file that caused the problem. Use this as a key in a map. 00048 class MFMT{ 00049 public: 00050 int MF,MT; 00051 int index; 00052 int C,I,S; // not really part of key, but useful to keep the C,I,S near the MF,MT, since no one remembers mapping 00053 MFMT(int mf, int mt, int ind=0, int c=-1, int i=-1, int s=-1): MF(mf), MT(mt), index(ind), C(c), I(i), S(s){} 00054 bool operator<(MFMT other) const{ 00055 if (other.MT!=MT) {return other.MT>MT;} 00056 else if (other.MF!=MF) {return other.MF>MF;} 00057 else {return other.index>index;} 00058 } 00059 friend ostream& operator<<(ostream& out, const MFMT& mfmt); 00060 }; 00061 00062 //! Severity of the problem and the message that goes with it. Use this as the value in the map. 00063 class logEntry{ 00064 public: 00065 string message; 00066 int severity; 00067 logEntry(string msg, int sev): message(msg), severity(sev){} 00068 friend ostream& operator<<(ostream& out, const logEntry& ent); 00069 }; 00070 00071 //! Map to hold the list of problems. We append this list to the documentation of the evaluation. 00072 class MessageLogger : public map< MFMT, logEntry > { 00073 public: 00074 string inLogFile; 00075 string outLogFile; 00076 MessageLogger(string infile="mf01mt451", string outfile="documentation.txt"): 00077 inLogFile(infile), outLogFile(outfile){} 00078 ~MessageLogger(void){} 00079 bool write(void); 00080 void logMessage(int MF, int MT, string msg, int severity); 00081 void logMessage(int MF, int MT, int C, int I, int S, string msg, int severity); 00082 }; 00083 00084 #endif