Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:15:33

0001 // -*- C++ -*-
0002 ///////////////////////////////////////////////////////////////////////////////
0003 // File: siscone_error.h                                                     //
0004 // Description: header file for SISCone error messages (Csiscone_error)      //
0005 // This file is part of the SISCone project.                                 //
0006 // For more details, see http://projects.hepforge.org/siscone                //
0007 //                                                                           //
0008 // Copyright (c) 2006 Gavin Salam and Gregory Soyez                          //
0009 //                                                                           //
0010 // This program is free software; you can redistribute it and/or modify      //
0011 // it under the terms of the GNU General Public License as published by      //
0012 // the Free Software Foundation; either version 2 of the License, or         //
0013 // (at your option) any later version.                                       //
0014 //                                                                           //
0015 // This program is distributed in the hope that it will be useful,           //
0016 // but WITHOUT ANY WARRANTY; without even the implied warranty of            //
0017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             //
0018 // GNU General Public License for more details.                              //
0019 //                                                                           //
0020 // You should have received a copy of the GNU General Public License         //
0021 // along with this program; if not, write to the Free Software               //
0022 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA //
0023 //                                                                           //
0024 // $Revision::                                                              $//
0025 // $Date::                                                                  $//
0026 ///////////////////////////////////////////////////////////////////////////////
0027 
0028 #ifndef __SISCONE_ERROR_H__
0029 #define __SISCONE_ERROR_H__
0030 
0031 #include<iostream>
0032 #include<string>
0033 
0034 namespace siscone{
0035 
0036 /// \class Csiscone_error
0037 /// class corresponding to errors that will be thrown by siscone
0038 class Csiscone_error {
0039 public:
0040   /// default ctor
0041   Csiscone_error() {;};
0042 
0043   /// ctor with a given error message
0044   ///  \param message_in   the error message to be printed
0045   Csiscone_error(const std::string & message_in) {
0046     m_message = message_in; 
0047     if (m_print_errors) std::cerr << "siscone::Csiscone_error: "<< message_in << std::endl;
0048   };
0049 
0050   /// access to the error message
0051   std::string message() const {return m_message;};
0052 
0053   /// switch on/off the error message printing
0054   ///  \param print_errors   errors will be printed when true
0055   static void setm_print_errors(bool print_errors) {
0056     m_print_errors = print_errors;};
0057 
0058 private:
0059   std::string m_message;       ///< the error message
0060   static bool m_print_errors;  ///< do we print error messages?
0061 };
0062 
0063 }
0064 #endif