Back to index

salome-kernel  6.5.0
Utils_SALOME_Exception.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SALOME Utils : general SALOME's definitions and tools
00024 //  File   : Utils_SALOME_Exception.hxx
00025 //  Author : Antoine YESSAYAN, EDF
00026 //  Module : SALOME
00027 //  $Header: /home/server/cvs/KERNEL/KERNEL_SRC/src/Utils/Utils_SALOME_Exception.hxx,v 1.10.2.4.10.2.12.1 2012-04-12 14:05:32 vsr Exp $
00028 //
00029 #if !defined( __Utils_SALOME_Exception_hxx__ )
00030 #define __Utils_SALOME_Exception_hxx__
00031 
00032 //#include "SALOME_Utils.hxx"
00033 
00034 # include <exception>
00035 # include <iostream>
00036 
00037 #ifdef LOCALIZED
00038 #undef LOCALIZED
00039 #endif
00040 #if defined(_DEBUG_) || defined(_DEBUG)
00041 # define LOCALIZED(message) #message , __FILE__ , __LINE__
00042 #else
00043 # define LOCALIZED(message) #message
00044 #endif
00045 
00046 //swig tool on Linux doesn't pass defines from header SALOME_Utils.hxx
00047 //therefore (temporary solution) defines are placed below
00048 
00049 #ifdef WIN32
00050 # if defined UTILS_EXPORTS || defined OpUtil_EXPORTS
00051 #  define UTILS_EXPORT __declspec( dllexport )
00052 # else
00053 #  define UTILS_EXPORT __declspec( dllimport )
00054 #  undef LOCALIZED
00055 #  define LOCALIZED(message) #message
00056 # endif
00057 #else
00058 # define UTILS_EXPORT
00059 #endif
00060 
00061 class SALOME_Exception;
00062 
00063 UTILS_EXPORT std::ostream& operator<<( std::ostream&, const SALOME_Exception& );
00064 
00065 UTILS_EXPORT const char *makeText( const char *text, const char *fileName, const unsigned int lineNumber );
00066 
00067 class UTILS_EXPORT SALOME_Exception : public std::exception
00068 {
00069 
00070 private :
00071         SALOME_Exception( void );
00072 
00073 protected :
00074         const char* _text ;     // non constant pointer but read only char variable
00075 
00076 public :
00077         SALOME_Exception( const char *text, const char *fileName=0, const unsigned int lineNumber=0 );
00078         SALOME_Exception( const SALOME_Exception &ex );
00079         virtual ~SALOME_Exception() throw ();
00080         UTILS_EXPORT friend std::ostream & operator<<( std::ostream &os , const SALOME_Exception &ex );
00081         virtual const char *what( void ) const throw () ;
00082 } ;
00083 
00084 
00085 #endif          /* #if !defined( __Utils_SALOME_Exception_hxx__ ) */