bpp-seq3  3.0.0
SequenceContainerExceptions.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_CONTAINER_SEQUENCECONTAINEREXCEPTIONS_H
6 #define BPP_SEQ_CONTAINER_SEQUENCECONTAINEREXCEPTIONS_H
7 
8 #include <Bpp/Exceptions.h>
9 
10 
11 namespace bpp
12 {
13 class SequencedValuesContainer;
14 
19  public Exception
20 {
21 protected:
25  const std::string id;
26 
27 public:
34  SequenceNotFoundException(const char* text, const char* seqId = "") :
35  Exception("SequenceNotFoundException: " + std::string(text) + "(" + seqId + ")"),
36  id(seqId) {}
37 
44  SequenceNotFoundException(const std::string& text, const std::string& seqId = "") :
45  Exception("SequenceNotFoundException: " + text + "(" + seqId + ")"),
46  id(seqId) {}
47 
48  // Class destructor
50 
51 public:
57  virtual const std::string getSequenceId() const { return id; }
58 };
59 
64  public Exception
65 {
66 private:
71 
72 public:
79  EmptyContainerException(const std::string& text, const SequencedValuesContainer* container) :
80  Exception("EmptyContainerException: " + text),
81  container_(container) {}
82 
84  Exception(ece), container_(ece.container_) {}
85 
87  {
88  Exception::operator=(ece);
89  container_ = ece.container_;
90  return *this;
91  }
92 
93  // Class destructor
95 
96 public:
100  virtual const SequencedValuesContainer* getContainer() const { return container_; }
101 };
102 } // end of namespace bpp.
103 #endif // BPP_SEQ_CONTAINER_SEQUENCECONTAINEREXCEPTIONS_H
Exception thrown when an empty container is found.
const SequencedValuesContainer * container_
The empty container.
EmptyContainerException(const std::string &text, const SequencedValuesContainer *container)
Build a new EmptyContainerException object.
EmptyContainerException & operator=(const EmptyContainerException &ece)
EmptyContainerException(const EmptyContainerException &ece)
virtual const SequencedValuesContainer * getContainer() const
Exception thrown when a sequence is not found The sequence not found exception base class.
virtual const std::string getSequenceId() const
Get the id of the sequence that was to be found.
SequenceNotFoundException(const char *text, const char *seqId="")
Build a new SequenceNotFoundException object.
SequenceNotFoundException(const std::string &text, const std::string &seqId="")
Build a new SequenceNotFoundException object.
const std::string id
The id of the sequence that was to be found.
This alphabet is used to deal NumericAlphabet.