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

runTimeDiagnostics.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 
00025 #ifndef RUN_TIME_DIAGNOSTICS_H
00026 #define RUN_TIME_DIAGNOSTICS_H
00027 
00028 #include "core/globalDefs.h"
00029 #include <string>
00030 #include <fstream>
00031 #include <exception>
00032 
00033 namespace plb {
00034 
00035 class DiagnosticFileSingleton {
00036 public:
00037     DiagnosticFileSingleton(std::string fName_);
00038     ~DiagnosticFileSingleton();
00039     void write(std::string message);
00040 private:
00041     DiagnosticFileSingleton();
00042     std::ofstream* ofile;
00043     std::string fName;
00044 };
00045 
00046 DiagnosticFileSingleton& warningFile();
00047 
00050 void plbWarning(bool issueWarning, std::string message);
00051 
00054 void plbWarning(std::string message);
00055 
00058 void plbMemoryError(bool issueError, std::string message);
00059 
00062 void plbMemoryError(std::string message);
00063 
00066 void plbMainProcMemoryError(bool issueError, std::string message);
00067 
00068 void plbIOError(bool issueError, std::string message);
00069 void plbIOError(std::string message);
00070 void plbMainProcIOError(bool issueError, std::string message);
00071 
00072 void plbNetworkError(bool issueError, std::string message);
00073 void plbNetworkError(std::string message);
00074 void plbMainProcNetworkError(bool issueError, std::string message);
00075 
00076 void plbLogicError(bool issueError, std::string message);
00077 void plbLogicError(std::string message);
00078 void plbMainProcLogicError(bool issueError, std::string message);
00079 
00080 class PlbException : public std::exception
00081 { };
00082 
00083 class PlbMemoryException : public PlbException {
00084 public:
00085     PlbMemoryException(std::string message_) throw();
00086     virtual ~PlbMemoryException() throw() { }
00087     virtual const char* what() const throw();
00088 private:
00089     std::string message;
00090 };
00091 
00092 class PlbIOException : public PlbException {
00093 public:
00094     PlbIOException(std::string message_) throw();
00095     virtual ~PlbIOException() throw() { }
00096     virtual const char* what() const throw();
00097 private:
00098     std::string message;
00099 };
00100 
00101 class PlbNetworkException : public PlbException {
00102 public:
00103     PlbNetworkException(std::string message_) throw();
00104     virtual ~PlbNetworkException() throw() { }
00105     virtual const char* what() const throw();
00106 private:
00107     std::string message;
00108 };
00109 
00110 class PlbLogicException : public PlbException {
00111 public:
00112     PlbLogicException(std::string message_) throw();
00113     virtual ~PlbLogicException() throw() { }
00114     virtual const char* what() const throw();
00115 private:
00116     std::string message;
00117 };
00118 
00119 class PlbOutOfRangeException : public PlbException {
00120 public:
00121     PlbOutOfRangeException(std::string message_) throw();
00122     virtual ~PlbOutOfRangeException() throw() { }
00123     virtual const char* what() const throw();
00124 private:
00125     std::string message;
00126 };
00127 
00128 }  // namespace plb
00129 
00130 #endif  // RUN_TIME_DIAGNOSTICS_H