bpp-seq3  3.0.0
SequenceExceptions.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_SEQ_SEQUENCEEXCEPTIONS_H
6 #define BPP_SEQ_SEQUENCEEXCEPTIONS_H
7 
8 #include <Bpp/Exceptions.h>
9 
10 #include "Alphabet/Alphabet.h"
11 #include "CoreSequence.h"
12 
13 #include <string>
14 #include <memory>
15 
16 namespace bpp
17 {
24  public Exception
25 {
26 private:
31 
32 public:
39  SequenceException(const std::string& text, const CoreSequenceInterface* seq) :
40  Exception("SequenceException: " + text + (seq ? "(" + seq->getName() + ")" : std::string(""))),
41  sequence_(seq)
42  {}
43 
45  Exception(se),
47  {}
48 
50  {
51  Exception::operator=(se);
52  sequence_ = se.sequence_;
53  return *this;
54  }
55 
56  virtual ~SequenceException() {}
57 
58 public:
64  virtual const CoreSequenceInterface* getSequence() const { return sequence_; }
65 };
66 
71  public SequenceException
72 {
73 public:
80  EmptySequenceException(const std::string& text, const CoreSequenceInterface* seq) :
81  SequenceException("EmptySequenceException: " + text, seq)
82  {}
83 
85 };
86 
91  public SequenceException
92 {
93 public:
100  SequenceWithGapException(const std::string& text, const CoreSequenceInterface* seq) :
101  SequenceException("SequenceWithGapException: " + text, seq)
102  {}
103 
105 };
106 
113  public SequenceException
114 {
115 public:
122  SequenceNotAlignedException(const std::string& text, const CoreSequenceInterface* seq) :
123  SequenceException("SequenceNotAlignedException: " + text, seq)
124  {}
125 
127 };
128 } // end of namespace bpp.
129 #endif // BPP_SEQ_SEQUENCEEXCEPTIONS_H
The core sequence interface.
Definition: CoreSequence.h:28
Exception thrown when a sequence is found to be empty and it should not.
EmptySequenceException(const std::string &text, const CoreSequenceInterface *seq)
Build a new EmptySequenceException object.
The sequence exception base class.
SequenceException(const std::string &text, const CoreSequenceInterface *seq)
Build a new SequenceException object.
SequenceException(const SequenceException &se)
SequenceException & operator=(const SequenceException &se)
virtual const CoreSequenceInterface * getSequence() const
Get the sequence that threw the exception.
const CoreSequenceInterface * sequence_
A pointer toward a sequence object.
Exception thrown when a sequence is not align with others.
SequenceNotAlignedException(const std::string &text, const CoreSequenceInterface *seq)
Build a new SequenceNotAlignedException object.
Exception thrown when a sequence is found to have gap and it should not.
SequenceWithGapException(const std::string &text, const CoreSequenceInterface *seq)
Build a new SequenceWithGapException object.
This alphabet is used to deal NumericAlphabet.