libsequence  1.9.5
PolyTable.hpp
Go to the documentation of this file.
1 /*
2 
3 Copyright (C) 2003-2009 Kevin Thornton, krthornt[]@[]uci.edu
4 
5 Remove the brackets to email me.
6 
7 This file is part of libsequence.
8 
9 libsequence is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 libsequence is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 long with libsequence. If not, see <http://www.gnu.org/licenses/>.
21 
22 */
23 
24 #ifndef POLYTABLE_H
25 #define POLYTABLE_H
26 
48 #include <string>
49 #include <vector>
50 #include <cassert>
51 #include <iosfwd>
52 #include <exception>
53 #include <type_traits>
54 #include <functional>
55 #include <memory>
58 namespace Sequence
59 {
60  class __attribute__((deprecated)) PolyTable
61  {
62  private:
63  struct PolyTableImpl;
64  std::unique_ptr<PolyTableImpl> impl;
65 
66  public:
68  using pos_container_t = std::vector<double>;
70  using geno_container_t = std::vector<std::string>;
71 
72  //typedefs for container types
74  using reference = geno_container_t::reference;
76  using const_reference = geno_container_t::const_reference;
78  using size_type = geno_container_t::size_type;
82  using data_iterator = geno_container_t::iterator;
86  using const_data_iterator = geno_container_t::const_iterator;
90  using pos_iterator = std::vector<double>::iterator;
94  using const_pos_iterator = std::vector<double>::const_iterator;
103  using const_site_iterator = Sequence::polySiteVector::const_iterator;
104  using row_t = geno_container_t::value_type;
105  using column_t = const_site_iterator::value_type;
106  //functions to return iterators
108  data_iterator begin();
110  data_iterator end();
112  const_data_iterator begin() const;
114  const_data_iterator end() const;
116  const_data_iterator cbegin() const;
118  const_data_iterator cend() const;
120  pos_iterator pbegin();
122  pos_iterator pend();
124  const_pos_iterator pbegin() const;
126  const_pos_iterator pend() const;
128  const_pos_iterator pcbegin() const;
130  const_pos_iterator pcend() const;
132  const_site_iterator sbegin() const;
134  const_site_iterator send() const;
136  const_site_iterator scbegin() const;
138  const_site_iterator scend() const;
139 
140  //constructor types
141  explicit PolyTable();
142  explicit PolyTable(PolyTable::const_site_iterator beg,
143  PolyTable::const_site_iterator end);
144  explicit PolyTable(std::vector<double> __positions,
145  std::vector<std::string> __data);
146  PolyTable(PolyTable &&);
147  PolyTable(const PolyTable &);
148  virtual ~PolyTable(void);
149 
151  std::vector<double> GetPositions(void) const;
153  std::vector<std::string> GetData(void) const;
154 
155  //operators and implicit typecasts
156 
158  virtual bool operator==(const PolyTable &rhs) const;
160  virtual bool operator!=(const PolyTable &rhs) const;
162  PolyTable &operator=(PolyTable &&);
164  PolyTable &operator=(const PolyTable &);
169  const_reference operator[](const size_type &i) const;
174  reference operator[](const size_type &i);
175 
177  bool empty() const;
178 
189  bool assign(PolyTable::const_site_iterator beg,
190  PolyTable::const_site_iterator end);
191 
192  //Swap data with another PolyTable
193  void swap(PolyTable &);
198  bool assign(const std::vector<double> &__positions,
199  const std::vector<std::string> &__data);
204  bool assign(std::vector<double> &&__positions,
205  std::vector<std::string> &&__data);
206 
208  size_type size(void) const;
209 
211  double position(const std::vector<double>::size_type &i) const;
212 
214  unsigned numsites(void) const;
215 
222  virtual std::istream &read(std::istream &h) = 0;
223 
230  virtual std::ostream &print(std::ostream &h) const = 0;
231  };
232 
238  std::istream &operator>>(std::istream &s, PolyTable &c);
239 
245  std::ostream &operator<<(std::ostream &o, const PolyTable &c);
246 }
247 #endif
The namespace in which this library resides.
class __attribute__((deprecated)) FST
Functor to count the number of states, excluding gaps and missing data, in a range of characters...
Definition: FST.hpp:41
std::ostream & operator<<(std::ostream &s, const AlignStream< T > &c)
Site-major variation tables in ASCII format.
std::istream & operator>>(std::istream &s, AlignStream< T > &c)