faif
ExceptionsDna.h
1 // exceptions for dna module
2 // @author Robert Nowak
3 
4 
5 #ifndef EXCEPTIONS_DNA_H
6 #define EXCEPTIONS_DNA_H
7 
8 #include "../ExceptionsFaif.hpp"
9 
10 namespace faif {
11 
12  /** \brief primitives for bioinformatics
13  */
14  namespace dna {
15 
16  /** \brief the exception thrown when unknown nucleotide (bad letter) occures */
18  public:
19  NucleotideBadCharException(char c) : c_(c) {}
20  virtual ~NucleotideBadCharException() throw() {}
21  virtual const char *what() const throw() { return "NucleotideBadCharException"; }
22  /** prints detailed information into given output stream */
23  virtual std::ostream& print(std::ostream& os) const throw(){
24  os << "Char '" << c_ << "' is not nucleotide name.";
25  return os;
26  }
27  private:
28  char c_;
29  };
30 
31  /** \brief the exception when chain representing codon is shorted than 3 nucleotides */
33  public:
35  virtual ~CodonStringTooShortException() throw() {}
36  virtual const char *what() const throw() { return "CodonStringTooShortException"; }
37  /** prints detailed information into given output stream */
38  virtual std::ostream& print(std::ostream& os) const throw(){
39  os << "String for codon is too short";
40  return os;
41  }
42  };
43 
44 
45 
46  } //namespace dna
47 
48 
49 } //namespace faif
50 
51 #endif //EXCEPTIONS_DNA_H
Definition: Chain.h:17
the base exception class for faif library
Definition: ExceptionsFaif.hpp:18
virtual std::ostream & print(std::ostream &os) const
Definition: ExceptionsDna.h:38
the exception thrown when unknown nucleotide (bad letter) occures
Definition: ExceptionsDna.h:17
virtual std::ostream & print(std::ostream &os) const
Definition: ExceptionsDna.h:23
the exception when chain representing codon is shorted than 3 nucleotides
Definition: ExceptionsDna.h:32