bpp-seq  2.1.0
Bpp/Seq/Alphabet/AlphabetExceptions.h
Go to the documentation of this file.
00001 //
00002 // File: AlphabetExceptions.h
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 #ifndef _ALPHABETEXCEPTIONS_H_
00041 #define _ALPHABETEXCEPTIONS_H_
00042 
00043 #include <Bpp/Exceptions.h>
00044 
00045 // From the STL:
00046 #include <vector>
00047 
00048 namespace bpp
00049 {
00050 
00051 class Alphabet;
00052 
00058 class AlphabetException:
00059   public Exception
00060 {
00061   private:
00062     const Alphabet* alphabet_;
00063       
00064   public:
00071     AlphabetException(const std::string& text, const Alphabet* alpha = 0);
00072     
00073     AlphabetException(const AlphabetException& ae): Exception(ae), alphabet_(ae.alphabet_) {}
00074     AlphabetException& operator=(const AlphabetException& ae)
00075     {
00076       Exception::operator=(ae);
00077       alphabet_ = ae.alphabet_;
00078       return *this;
00079     }
00080   
00081     virtual ~AlphabetException() throw () {}
00082         
00083   public:
00089     virtual const Alphabet* getAlphabet() const { return alphabet_; }
00090 };
00091 
00095 class BadCharException:
00096   public AlphabetException
00097 {
00098   protected:
00099     std::string c_;
00100   
00101   public:
00109     BadCharException(const std::string & badChar, const std::string & text = "", const Alphabet * alpha = 0);
00110   
00111     virtual ~BadCharException() throw() {};
00112   
00113   public:
00119     virtual std::string getBadChar() const;
00120 };
00121 
00125 class BadIntException:
00126   public AlphabetException
00127 {
00128   protected:
00129     int i_;
00130   
00131   public:
00138     BadIntException(int badInt, const std::string& text = "", const Alphabet* alpha = 0);
00139   
00140     virtual ~BadIntException() throw() {}
00141 
00142   public:
00148     virtual int getBadInt() const;
00149 };
00150 
00157 class AlphabetMismatchException : public Exception
00158 {
00159   private:
00160     const Alphabet* alphabet1_, * alphabet2_;
00161   
00162   public:
00163            
00171     AlphabetMismatchException(const std::string& text = "", const Alphabet* alpha1 = 0, const Alphabet* alpha2 = 0);
00172   
00173     AlphabetMismatchException(const AlphabetMismatchException& ame): Exception(ame), alphabet1_(ame.alphabet1_), alphabet2_(ame.alphabet2_) {}
00174     AlphabetMismatchException& operator=(const AlphabetMismatchException& ame)
00175     {
00176       Exception::operator=(ame);
00177       alphabet1_ = ame.alphabet1_;
00178       alphabet2_ = ame.alphabet2_;
00179       return *this;
00180     }
00181 
00182     virtual ~AlphabetMismatchException() throw() {}
00183 
00184   public:
00190     std::vector<const Alphabet *> getAlphabets() const;
00191 };
00192 
00196 class CharStateNotSupportedException : public AlphabetException
00197 {
00198   public:
00205     CharStateNotSupportedException(const std::string & text = "", const Alphabet * alpha = 0);
00206 
00207     virtual ~CharStateNotSupportedException() throw() {};
00208 };
00209 
00210 } //end of namespace bpp.
00211 
00212 #endif  //_ALPHABETEXCEPTIONS_H_
00213 
 All Classes Namespaces Files Functions Variables Typedefs Friends