1 /*=========================================================================
4 Module: $RCSfile: creaException.h,v $
6 Date: $Date: 2009/06/04 14:24:07 $
7 Version: $Revision: 1.2 $
9 Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
10 l'Image). All rights reserved. See Doc/License.txt or
11 http://www.creatis.insa-lyon.fr/Public/crea/License.html for details.
13 This software is distributed WITHOUT ANY WARRANTY; without even
14 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 PURPOSE. See the above copyright notices for more information.
17 =========================================================================*/
22 * \brief class Exception:generic class for throwing any exception (header)
28 * \class crea::Exception
29 * \brief class Exception : generic class for throwing any exception
34 #ifndef __creaException_h__
35 #define __creaException_h__
37 #include "creaSystem.h"
38 #include "creaMessageManager.h"
43 inline std::string bbGetObjectDescription() { return(""); }
45 class CREA_EXPORT Exception : public std::exception
48 Exception(const std::string& object,
49 const std::string& source_file,
50 const std::string& message) throw()
52 mSourceFile(source_file),
55 mWhatMessage = " * ERROR : " + mMessage
56 + " * OBJECT : " + mObject
57 + " * FILE " + mSourceFile;
59 ~Exception() throw() {}
60 virtual const char* what() const throw()
62 return mWhatMessage.c_str();
67 std::cerr << "* ERROR : " << mMessage <<std::endl;
68 int lev = crea::MessageManager::GetMessageLevel("Error");
70 std::cerr << "* OBJECT : " <<mObject<<std::endl;
71 std::cerr << "* FILE : " <<mSourceFile<<std::endl;
74 const std::string& GetObject() const { return mObject; }
75 const std::string& GetSourceFile() const { return mSourceFile; }
76 const std::string& GetMessage() const { return mMessage; }
79 std::string mSourceFile;
81 std::string mWhatMessage;