$treeview $search $mathjax
Palabos  Version 1.1
$projectbrief
$projectbrief
$searchbox

plbLogFiles.h

Go to the documentation of this file.
00001 /* This file is part of the Palabos library.
00002  *
00003  * Copyright (C) 2011 FlowKit Sarl
00004  * Avenue de Chailly 23
00005  * 1012 Lausanne, Switzerland
00006  * E-mail contact: contact@flowkit.com
00007  *
00008  * The most recent release of Palabos can be downloaded at 
00009  * <http://www.palabos.org/>
00010  *
00011  * The library Palabos is free software: you can redistribute it and/or
00012  * modify it under the terms of the GNU Affero General Public License as
00013  * published by the Free Software Foundation, either version 3 of the
00014  * License, or (at your option) any later version.
00015  *
00016  * The library is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU Affero General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU Affero General Public License
00022  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00023 */
00024 
00028 #ifndef PLB_LOGFILES_H
00029 #define PLB_LOGFILES_H
00030 
00031 #include <string>
00032 #include <map>
00033 
00034 namespace plb {
00035 
00036 namespace global {
00037 
00039 class PlbLogFile {
00040 public:
00041     PlbLogFile(std::string fName, bool parallel_);
00042     ~PlbLogFile();
00044     void push(std::string sectionName);
00046     void pop();
00048     void entry(std::string entryText);
00050     void flushEntry(std::string entryText);
00051 private:
00052     PlbLogFile(PlbLogFile const& rhs);
00053     PlbLogFile& operator=(PlbLogFile const& rhs);
00054 private:
00055     bool parallel;
00056     std::ofstream* ofile;
00057     int indentation;
00058     std::string indentSpaces;
00059 private:
00060 friend PlbLogFile& logfile(std::string nameOfLogFile);
00061 friend PlbLogFile& logfile_nonparallel(std::string nameOfLogFile);
00062 };
00063 
00064 class LogFileCollection {
00065 public:
00066     LogFileCollection(bool parallel_);
00067     ~LogFileCollection();
00068     PlbLogFile& get(std::string nameOfLogFile);
00069 private:
00070     LogFileCollection(LogFileCollection const& rhs);
00071     LogFileCollection& operator=(LogFileCollection const& rhs);
00072 private:
00073     std::map<std::string, PlbLogFile*> collection;
00074     bool parallel;
00075 };
00076 
00077 PlbLogFile& logfile(std::string nameOfLogFile);
00078 PlbLogFile& logfile_nonparallel(std::string nameOfLogFile);
00079 
00080 }  // namespace global
00081 
00082 }  // namespace plb
00083 
00084 #endif  // PLB_LOGFILES_H