bpp-seq3  3.0.0
SiteExceptions.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_SITEEXCEPTIONS_H
6 #define BPP_SEQ_SITEEXCEPTIONS_H
7 
8 #include <Bpp/Exceptions.h>
9 #include "CoreSite.h"
10 
11 
12 namespace bpp
13 {
20  public Exception
21 {
22 private:
27 
28 public:
29  // Class constructor
30 
37  SiteException(const std::string& text, const CoreSiteInterface* s) :
38  Exception(text + (s != 0 ? "(" + TextTools::toString(s->getCoordinate()) + ")" : std::string(""))),
39  site_(s)
40  {}
41 
43  Exception(se),
44  site_(se.site_)
45  {}
46 
48  {
49  Exception::operator=(se);
50  site_ = se.site_;
51  return *this;
52  }
53 
54  // Class destructor
55  virtual ~SiteException() {}
56 
57 public:
63  virtual const CoreSiteInterface* getSite() const { return site_; }
64 };
65 
70  public SiteException
71 {
72 public:
73  EmptySiteException(const std::string& text, const CoreSiteInterface* s) :
74  SiteException(text, s) {}
75 
76  virtual ~EmptySiteException() {}
77 };
78 
83  public SiteException
84 {
85 public:
86  SiteWithGapException(const std::string& text, const CoreSiteInterface* s) :
87  SiteException(text, s) {}
88 
89  virtual ~SiteWithGapException() {}
90 };
91 } // end of namespace bpp.
92 #endif // BPP_SEQ_SITEEXCEPTIONS_H
The core site interface.
Definition: CoreSite.h:25
Exception sent when a empty site is found.
EmptySiteException(const std::string &text, const CoreSiteInterface *s)
The site exception base class.
virtual ~SiteException()
const CoreSiteInterface * site_
A reference toward a site object.
virtual const CoreSiteInterface * getSite() const
Get the site that threw the exception.
SiteException(const std::string &text, const CoreSiteInterface *s)
Build a new SiteException object.
SiteException & operator=(const SiteException &se)
SiteException(const SiteException &se)
Exception sent when a site containing gap is found.
SiteWithGapException(const std::string &text, const CoreSiteInterface *s)
std::string toString(T t)
This alphabet is used to deal NumericAlphabet.