00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __POLY_TABLE_SLICE_HPP__
00025 #define __POLY_TABLE_SLICE_HPP__
00026 #include <vector>
00027 #include <utility>
00028 #include <boost/static_assert.hpp>
00029 #include <boost/type_traits.hpp>
00030 #include <Sequence/SeqConstants.hpp>
00031 #include <Sequence/SeqExceptions.hpp>
00032
00113 namespace Sequence
00114 {
00115 template<typename T> class PolyTableSlice
00116 {
00117 private:
00118 BOOST_STATIC_ASSERT( (boost::is_base_and_derived<
00119 Sequence::PolyTable,T>::value) );
00120 mutable T currentSlice;
00121 typedef std::pair<PolyTable::const_site_iterator,
00122 PolyTable::const_site_iterator> range;
00123
00124
00125 std::vector< range > windows;
00126 std::vector< range >::const_iterator windows_begin,windows_end;
00127 void process_windows( const PolyTable::const_site_iterator beg,
00128 const PolyTable::const_site_iterator end,
00129 const unsigned & window_size,
00130 const unsigned & step_len,
00131 const double & alignment_length,
00132 const bool & is_physical,
00133 const double & physical_scale = 1.);
00134
00135 public:
00136 explicit PolyTableSlice( const PolyTable::const_site_iterator beg,
00137 const PolyTable::const_site_iterator end,
00138 const unsigned & window_size_S,
00139 const unsigned & window_step_len );
00140
00141 explicit PolyTableSlice( const PolyTable::const_site_iterator beg,
00142 const PolyTable::const_site_iterator end,
00143 const unsigned & window_size,
00144 const unsigned & step_len,
00145 const double & alignment_length,
00146 const double & physical_scale = 1.);
00150 typedef std::vector< std::pair<PolyTable::const_site_iterator,
00151 PolyTable::const_site_iterator> >::const_iterator const_iterator;
00152 const_iterator begin() const;
00153 const_iterator end() const;
00154 T get_slice(const const_iterator) const throw (Sequence::SeqException);
00155 unsigned size() const;
00156 T operator[](const unsigned &) const throw (Sequence::SeqException);
00157 };
00158 }
00159 #include <Sequence/bits/PolyTableSlice.tcc>
00160
00161 #endif