Gamgee
You miserable little maggot. I'll stove your head in!
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
indexed_variant_iterator.h
Go to the documentation of this file.
1 #ifndef gamgee__indexed_variant_iterator__guard
2 #define gamgee__indexed_variant_iterator__guard
3 
4 #include "variant_iterator.h"
5 
6 #include "../utils/hts_memory.h"
7 
8 #include "htslib/vcf.h"
9 
10 #include <memory>
11 #include <string>
12 #include <vector>
13 
14 namespace gamgee {
15 
17  public:
18 
19  static const std::vector<std::string> all_intervals;
20 
25 
34  IndexedVariantIterator(const std::shared_ptr<htsFile>& file_ptr,
35  const std::shared_ptr<hts_idx_t>& index_ptr,
36  const std::shared_ptr<bcf_hdr_t>& header_ptr,
37  const std::vector<std::string>& interval_list = all_intervals);
38 
43  IndexedVariantIterator(const IndexedVariantIterator& other) = delete;
45 
52 
61  bool operator!=(const IndexedVariantIterator& rhs);
62 
63  protected:
64  void fetch_next_record() override;
65 
66  private:
67  std::shared_ptr<hts_idx_t> m_variant_index_ptr;
68  std::vector<std::string> m_interval_list;
69  std::vector<std::string>::const_iterator m_interval_iter;
70  std::unique_ptr<hts_itr_t, utils::HtsIteratorDeleter> m_index_iter_ptr;
71 };
72 
73 }
74 
75 #endif /* defined(gamgee__indexed_variant_iterator__guard) */
IndexedVariantIterator()
creates an empty iterator (used for the end() method)
Definition: indexed_variant_iterator.cpp:15
Definition: indexed_variant_iterator.h:16
bool operator!=(const IndexedVariantIterator &rhs)
inequality operator (needed by for-each loop)
Definition: indexed_variant_iterator.cpp:36
IndexedVariantIterator & operator=(const IndexedVariantIterator &other)=delete
Utility class to enable for-each style iteration in the VariantReader class.
Definition: variant_iterator.h:15
Definition: exceptions.h:9
static const std::vector< std::string > all_intervals
Definition: indexed_variant_iterator.h:19
void fetch_next_record() override
fetches next Variant record into existing htslib memory without making a copy
Definition: indexed_variant_iterator.cpp:45