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

MNlogger.h

Go to the documentation of this file.
00001 /* Copyright (C) 2000 KOM/Darmstadt University of Technology 00002 * 00003 * You are allowed to use all other parts of the code under the following terms: 00004 * 00005 * For non-commercial use, code may be used in unmodified form provided 00006 * that this copyright notice and this permission notice appear in 00007 * supporting documentation. 00008 * 00009 * This software is provided "as is" and without any express or implied 00010 * warranties, including, without limitation, the implied warranty of 00011 * fitness for a particular purpose. 00012 * 00013 * The code may be subjected to the GNU General Public License, Version 2, 00014 * and re-distributed under the terms of this license. 00015 * As a special exception, permission is granted to link this code 00016 * with the Qt library and distribute executables, as long as you 00017 * follow the requirements of the GNU GPL in regard to all of the 00018 * software in the executable aside from Qt. 00019 * 00020 * Commercial use other than under the terms of the GNU General Public 00021 * License is allowed only after express negotiation of conditions 00022 * with the authors. 00023 */ 00024 #ifndef MNLOGGER_H 00025 #define MNLOGGER_H 00026 00027 #include <config.h> 00028 00029 #include <unistd.h> 00030 #include <sys/types.h> 00031 #include <sys/stat.h> 00032 #include <fcntl.h> 00033 #include "mnstream.h" 00034 #include "MNMsg.h" 00035 #include "MNMutex.h" 00036 #include "MNProtectedVar.h" 00037 #include "dictionary.h" 00038 00039 #define DEBUGJ 00040 #ifndef DEBUGJ 00041 #undef MN_INFO 00042 #define MN_INFO(a) 00043 #endif 00044 00045 /************************************************************** 00046 * Klasse: MNlogger 00047 * Beschreibung: enthaelt die funktionalitaet von logger (make logfiles) 00048 * September 99 00049 * names of logfiles are log_#.txt 00050 **************************************************************/ 00051 class MNlogger 00052 { 00053 private: 00054 typedef dictionary<int, ofstream*> Map; /* only to lookup the fd int userfd, int file desc*/ 00055 00056 /* vars */ 00057 Map ostr_list; 00058 MNMutex ostr_mutex; 00059 ProtectedVar<int> min_log_number; 00060 00061 MNMutex initialized; 00062 00063 /* funcs */ 00064 bool file_exist(char* fname); 00065 ofstream* open_file(); 00066 00067 public: 00068 MNlogger(); 00069 ~MNlogger(); 00070 00071 ostream& log(int ufd); 00072 }; 00073 00074 #endif

Generated on Sun Mar 6 13:35:49 2005 for Komssys by doxygen 1.3.8