66
77namespace sshash {
88
9+ template <class kmer_t >
910struct buckets {
1011 std::pair<lookup_result, uint64_t > offset_to_id (uint64_t offset, uint64_t k) const {
1112 auto [pos, contig_begin, contig_end] = pieces.locate (offset);
@@ -52,13 +53,13 @@ struct buckets {
5253
5354 kmer_t contig_prefix (uint64_t contig_id, uint64_t k) const {
5455 uint64_t contig_begin = pieces.access (contig_id);
55- bit_vector_iterator bv_it (strings, 2 * contig_begin);
56+ bit_vector_iterator< kmer_t > bv_it (strings, 2 * contig_begin);
5657 return bv_it.read (2 * (k - 1 ));
5758 }
5859
5960 kmer_t contig_suffix (uint64_t contig_id, uint64_t k) const {
6061 uint64_t contig_end = pieces.access (contig_id + 1 );
61- bit_vector_iterator bv_it (strings, 2 * (contig_end - k + 1 ));
62+ bit_vector_iterator< kmer_t > bv_it (strings, 2 * (contig_end - k + 1 ));
6263 return bv_it.read (2 * (k - 1 ));
6364 }
6465
@@ -90,7 +91,7 @@ struct buckets {
9091 uint64_t m) const {
9192 uint64_t offset = offsets.access (super_kmer_id);
9293 auto [res, contig_end] = offset_to_id (offset, k);
93- bit_vector_iterator bv_it (strings, 2 * offset);
94+ bit_vector_iterator< kmer_t > bv_it (strings, 2 * offset);
9495 uint64_t window_size = std::min<uint64_t >(k - m + 1 , contig_end - offset - k + 1 );
9596 for (uint64_t w = 0 ; w != window_size; ++w) {
9697 kmer_t read_kmer = bv_it.read_and_advance_by_two (2 * k);
@@ -115,7 +116,7 @@ struct buckets {
115116 for (uint64_t super_kmer_id = begin; super_kmer_id != end; ++super_kmer_id) {
116117 uint64_t offset = offsets.access (super_kmer_id);
117118 auto [res, contig_end] = offset_to_id (offset, k);
118- bit_vector_iterator bv_it (strings, 2 * offset);
119+ bit_vector_iterator< kmer_t > bv_it (strings, 2 * offset);
119120 uint64_t window_size = std::min<uint64_t >(k - m + 1 , contig_end - offset - k + 1 );
120121 for (uint64_t w = 0 ; w != window_size; ++w) {
121122 kmer_t read_kmer = bv_it.read_and_advance_by_two (2 * k);
@@ -166,7 +167,7 @@ struct buckets {
166167
167168 void access (uint64_t kmer_id, char * string_kmer, uint64_t k) const {
168169 uint64_t offset = id_to_offset (kmer_id, k);
169- bit_vector_iterator bv_it (strings, 2 * offset);
170+ bit_vector_iterator< kmer_t > bv_it (strings, 2 * offset);
170171 kmer_t read_kmer = bv_it.read (2 * k);
171172 util::uint_kmer_to_string (read_kmer, string_kmer, k);
172173 }
@@ -176,7 +177,7 @@ struct buckets {
176177
177178 iterator (buckets const * ptr, uint64_t kmer_id, uint64_t k, uint64_t num_kmers)
178179 : m_buckets(ptr), m_kmer_id(kmer_id), m_k(k), m_num_kmers(num_kmers) {
179- bv_it = bit_vector_iterator (m_buckets->strings , -1 );
180+ bv_it = bit_vector_iterator< kmer_t > (m_buckets->strings , -1 );
180181 offset = m_buckets->id_to_offset (m_kmer_id, k);
181182 auto [pos, piece_end] = m_buckets->pieces .next_geq (offset);
182183 if (piece_end == offset) pos += 1 ;
@@ -219,7 +220,7 @@ struct buckets {
219220 uint64_t m_kmer_id, m_k, m_num_kmers;
220221 uint64_t offset;
221222 uint64_t next_offset;
222- bit_vector_iterator bv_it;
223+ bit_vector_iterator< kmer_t > bv_it;
223224 ef_sequence<true >::iterator pieces_it;
224225
225226 kmer_t read_kmer;
0 commit comments