bpp-seq  2.1.0
Bpp/Seq/Alphabet/AlphabetExceptions.cpp
Go to the documentation of this file.
00001 //
00002 // File: AlphabetExceptions.cpp
00003 // Created by: Julien Dutheil
00004 // Created on: Mon Nov  3 16:41:53 2003
00005 //
00006 
00007 /*
00008 Copyright or © or Copr. CNRS, (November 17, 2004)
00009 
00010 This software is a computer program whose purpose is to provide classes
00011 for sequences analysis.
00012 
00013 This software is governed by the CeCILL  license under French law and
00014 abiding by the rules of distribution of free software.  You can  use, 
00015 modify and/ or redistribute the software under the terms of the CeCILL
00016 license as circulated by CEA, CNRS and INRIA at the following URL
00017 "http://www.cecill.info". 
00018 
00019 As a counterpart to the access to the source code and  rights to copy,
00020 modify and redistribute granted by the license, users are provided only
00021 with a limited warranty  and the software's author,  the holder of the
00022 economic rights,  and the successive licensors  have only  limited
00023 liability. 
00024 
00025 In this respect, the user's attention is drawn to the risks associated
00026 with loading,  using,  modifying and/or developing or reproducing the
00027 software by the user in light of its specific status of free software,
00028 that may mean  that it is complicated to manipulate,  and  that  also
00029 therefore means  that it is reserved for developers  and  experienced
00030 professionals having in-depth computer knowledge. Users are therefore
00031 encouraged to load and test the software's suitability as regards their
00032 requirements in conditions enabling the security of their systems and/or 
00033 data to be ensured and,  more generally, to use and operate it in the 
00034 same conditions as regards security. 
00035 
00036 The fact that you are presently reading this means that you have had
00037 knowledge of the CeCILL license and that you accept its terms.
00038 */
00039 
00040 #include "AlphabetExceptions.h"
00041 #include "Alphabet.h"
00042 #include <Bpp/Text/TextTools.h>
00043 
00044 using namespace bpp;
00045 
00046 using namespace std;
00047 
00048 /******************************************************************************
00049  *                         Alphabet exceptions:                               *
00050  ******************************************************************************/
00051 
00052 AlphabetException::AlphabetException(const std::string& text, const Alphabet* alpha) :
00053   Exception("AlphabetException: " + text + (alpha ? "(" + (alpha->getAlphabetType()) + ")" : string(""))),
00054   alphabet_(alpha) {}
00055     
00056 /******************************************************************************/
00057 
00058 BadCharException::BadCharException(const std::string& badChar, const std::string& text, const Alphabet* alpha) :
00059   AlphabetException("BadCharException: " + badChar + ". " + text, alpha),
00060   c_(badChar) {}
00061     
00062 string BadCharException::getBadChar() const { return c_; }
00063 
00064 /******************************************************************************/
00065 
00066 BadIntException::BadIntException(int badInt, const std::string& text, const Alphabet* alpha) :
00067   AlphabetException("BadIntException: " + TextTools::toString(badInt) + ". " + text, alpha),
00068   i_(badInt) {}
00069     
00070 int BadIntException::getBadInt() const { return i_; }
00071 
00072 /******************************************************************************/
00073     
00074 AlphabetMismatchException::AlphabetMismatchException(const std::string& text, const Alphabet* alpha1, const Alphabet* alpha2) :
00075   Exception("AlphabetMismatchException: " + text + (alpha1 != 0 && alpha2 != 0 ? "(" + alpha1->getAlphabetType() + ", " + alpha2->getAlphabetType() + ")" : string(""))),
00076   alphabet1_(alpha1),
00077   alphabet2_(alpha2) {}
00078     
00079 vector<const Alphabet*> AlphabetMismatchException::getAlphabets() const
00080 {
00081   vector<const Alphabet*> v(2);
00082   v[0] = alphabet1_;
00083   v[1] = alphabet2_;
00084   return v;
00085 }
00086 
00087 /******************************************************************************/
00088 
00089 CharStateNotSupportedException::CharStateNotSupportedException(const string & text, const Alphabet * alpha) :
00090   AlphabetException("CharStateNotSupportedException: " + text, alpha) {};
00091 
00092 /******************************************************************************/
 All Classes Namespaces Files Functions Variables Typedefs Friends