bpp-seq  2.1.0
 All Classes Namespaces Files Functions Variables Friends Pages
AlphabetExceptions.h
Go to the documentation of this file.
1 //
2 // File: AlphabetExceptions.h
3 // Created by: Julien Dutheil
4 // Created on: Mon Nov 3 16:41:53 2003
5 //
6 
7 /*
8 Copyright or © or Copr. CNRS, (November 17, 2004)
9 
10 This software is a computer program whose purpose is to provide classes
11 for sequences analysis.
12 
13 This software is governed by the CeCILL license under French law and
14 abiding by the rules of distribution of free software. You can use,
15 modify and/ or redistribute the software under the terms of the CeCILL
16 license as circulated by CEA, CNRS and INRIA at the following URL
17 "http://www.cecill.info".
18 
19 As a counterpart to the access to the source code and rights to copy,
20 modify and redistribute granted by the license, users are provided only
21 with a limited warranty and the software's author, the holder of the
22 economic rights, and the successive licensors have only limited
23 liability.
24 
25 In this respect, the user's attention is drawn to the risks associated
26 with loading, using, modifying and/or developing or reproducing the
27 software by the user in light of its specific status of free software,
28 that may mean that it is complicated to manipulate, and that also
29 therefore means that it is reserved for developers and experienced
30 professionals having in-depth computer knowledge. Users are therefore
31 encouraged to load and test the software's suitability as regards their
32 requirements in conditions enabling the security of their systems and/or
33 data to be ensured and, more generally, to use and operate it in the
34 same conditions as regards security.
35 
36 The fact that you are presently reading this means that you have had
37 knowledge of the CeCILL license and that you accept its terms.
38 */
39 
40 #ifndef _ALPHABETEXCEPTIONS_H_
41 #define _ALPHABETEXCEPTIONS_H_
42 
43 #include <Bpp/Exceptions.h>
44 
45 // From the STL:
46 #include <vector>
47 
48 namespace bpp
49 {
50 
51 class Alphabet;
52 
59  public Exception
60 {
61  private:
63 
64  public:
71  AlphabetException(const std::string& text, const Alphabet* alpha = 0);
72 
75  {
76  Exception::operator=(ae);
77  alphabet_ = ae.alphabet_;
78  return *this;
79  }
80 
81  virtual ~AlphabetException() throw () {}
82 
83  public:
89  virtual const Alphabet* getAlphabet() const { return alphabet_; }
90 };
91 
96  public AlphabetException
97 {
98  protected:
99  std::string c_;
100 
101  public:
109  BadCharException(const std::string & badChar, const std::string & text = "", const Alphabet * alpha = 0);
110 
111  virtual ~BadCharException() throw() {};
112 
113  public:
119  virtual std::string getBadChar() const;
120 };
121 
126  public AlphabetException
127 {
128  protected:
129  int i_;
130 
131  public:
138  BadIntException(int badInt, const std::string& text = "", const Alphabet* alpha = 0);
139 
140  virtual ~BadIntException() throw() {}
141 
142  public:
148  virtual int getBadInt() const;
149 };
150 
158 {
159  private:
161 
162  public:
163 
171  AlphabetMismatchException(const std::string& text = "", const Alphabet* alpha1 = 0, const Alphabet* alpha2 = 0);
172 
175  {
176  Exception::operator=(ame);
177  alphabet1_ = ame.alphabet1_;
178  alphabet2_ = ame.alphabet2_;
179  return *this;
180  }
181 
182  virtual ~AlphabetMismatchException() throw() {}
183 
184  public:
190  std::vector<const Alphabet *> getAlphabets() const;
191 };
192 
197 {
198  public:
205  CharStateNotSupportedException(const std::string & text = "", const Alphabet * alpha = 0);
206 
207  virtual ~CharStateNotSupportedException() throw() {};
208 };
209 
210 } //end of namespace bpp.
211 
212 #endif //_ALPHABETEXCEPTIONS_H_
213