bbtkException.h

Go to the documentation of this file.
00001 /*=========================================================================                                                                               
00002   Program:   bbtk
00003   Module:    $RCSfile: bbtkException.h,v $
00004   Language:  C++
00005   Date:      $Date: 2008/10/17 08:18:13 $
00006   Version:   $Revision: 1.4 $
00007 =========================================================================*/
00008 
00009 /* ---------------------------------------------------------------------
00010 
00011 * Copyright (c) CREATIS-LRMN (Centre de Recherche en Imagerie Medicale)
00012 * Authors : Eduardo Davila, Laurent Guigues, Jean-Pierre Roux
00013 *
00014 *  This software is governed by the CeCILL-B license under French law and 
00015 *  abiding by the rules of distribution of free software. You can  use, 
00016 *  modify and/ or redistribute the software under the terms of the CeCILL-B 
00017 *  license as circulated by CEA, CNRS and INRIA at the following URL 
00018 *  http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html 
00019 *  or in the file LICENSE.txt.
00020 *
00021 *  As a counterpart to the access to the source code and  rights to copy,
00022 *  modify and redistribute granted by the license, users are provided only
00023 *  with a limited warranty  and the software's author,  the holder of the
00024 *  economic rights,  and the successive licensors  have only  limited
00025 *  liability. 
00026 *
00027 *  The fact that you are presently reading this means that you have had
00028 *  knowledge of the CeCILL-B license and that you accept its terms.
00029 * ------------------------------------------------------------------------ */                                                                         
00030 
00031 
00032 
00047 #ifndef __bbtkException_h__
00048 #define __bbtkException_h__
00049 
00050 #include "bbtkSystem.h"
00051 #include <exception>
00052 
00053 namespace bbtk
00054 {
00055 
00056   inline std::string bbGetObjectDescription() { return(""); }
00057 
00058   class BBTK_EXPORT Exception : public std::exception
00059   {
00060   public:
00061     Exception(const std::string& object,
00062               const std::string& source_file,
00063               const std::string& message) throw()
00064       : mObject(object),
00065         mSourceFile(source_file),
00066         mMessage(message)
00067     {}
00068     ~Exception() throw() {}
00069     void Print() throw()
00070     {
00071       std::cerr << "* ERROR  : " << mMessage <<std::endl; 
00072       int lev = bbtk::MessageManager::GetMessageLevel("Error");
00073       if (lev > 0) {
00074         std::cerr << "* OBJECT : " <<mObject<<std::endl;
00075         std::cerr << "* FILE   : " <<mSourceFile<<std::endl;
00076       }
00077     }
00078     //const std::string& GetMessage() const { return mMessage; }
00079     const std::string& GetObject() const { return mObject; }
00080     const std::string& GetSourceFile() const { return mSourceFile; }
00081     const std::string& GetErrorMessage() const { return mMessage; }
00082   private:
00083     std::string mObject;
00084     std::string mSourceFile;
00085     std::string mMessage;
00086   };
00087 
00088 }//namespace
00089 
00090 #endif

Generated on Wed Nov 12 11:37:08 2008 for BBTK by  doxygen 1.5.6