bpp-seq  2.2.0
Site.h
Go to the documentation of this file.
1 //
2 // File Site.h
3 // Created by: Guillaume Deuchst
4 // Julien Dutheil
5 //
6 
7 /*
8 Copyright or © or Copr. Bio++ Development Team, (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 _SITE_H_
41 #define _SITE_H_
42 
43 #include "SymbolList.h"
44 #include "SiteExceptions.h"
45 
46 namespace bpp
47 {
48 
61 class Site:
62  public BasicSymbolList
63 {
64  private:
68  int position_;
69 
70  public:
71 
77  Site(const Alphabet* alpha);
78 
85  Site(const Alphabet* alpha, int position);
86 
95  Site(const std::vector<std::string>& site, const Alphabet* alpha) throw (BadCharException);
96 
106  Site(const std::vector<std::string>& site, const Alphabet* alpha, int position) throw (BadCharException);
107 
116  Site(const std::vector<int>& site, const Alphabet* alpha) throw (BadIntException);
117 
127  Site(const std::vector<int>& site, const Alphabet* alpha, int position) throw (BadIntException);
128 
132  Site(const Site& site);
133 
137  Site& operator=(const Site& s);
138 
139  virtual ~Site() {}
140 
141  public:
142 
148  Site* clone() const { return new Site(*this); }
162  virtual int getPosition() const { return position_; }
163 
169  virtual void setPosition(int position) { position_ = position; }
170 };
171 
172 // Sites comparison operators overload
173 bool operator == (const Site& site1, const Site& site2);
174 bool operator < (const Site& site1, const Site& site2);
175 
176 } //end of namespace bpp.
177 
178 #endif //_SITE_H_
179 
virtual ~Site()
Definition: Site.h:139
virtual void setPosition(int position)
Set the position of this site.
Definition: Site.h:169
An alphabet exception thrown when trying to specify a bad char to the alphabet.
Site * clone() const
Definition: Site.h:148
bool operator==(const Site &site1, const Site &site2)
Definition: Site.cpp:80
virtual int getPosition() const
Get the position of this site.
Definition: Site.h:162
This alphabet is used to deal NumericAlphabet.
The Alphabet interface.
Definition: Alphabet.h:130
Site(const Alphabet *alpha)
Build a new void Site object with the specified alphabet.
Definition: Site.cpp:54
int position_
The position associated to this site.
Definition: Site.h:68
bool operator<(const Site &site1, const Site &site2)
Definition: Site.cpp:95
A basic SymbolList object.
Definition: SymbolList.h:264
Site & operator=(const Site &s)
The assignment operator.
Definition: Site.cpp:70
An alphabet exception thrown when trying to specify a bad int to the alphabet.
The Site class.
Definition: Site.h:61