Gamgee
You miserable little maggot. I'll stove your head in!
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sam_iterator.h
Go to the documentation of this file.
1 #ifndef gamgee__sam_iterator__guard
2 #define gamgee__sam_iterator__guard
3 
4 #include "sam.h"
5 
6 #include "htslib/sam.h"
7 
8 #include <memory>
9 
10 namespace gamgee {
11 
15 class SamIterator {
16  public:
17 
21  SamIterator();
22 
29  SamIterator(const std::shared_ptr<htsFile>& sam_file_ptr, const std::shared_ptr<bam_hdr_t>& sam_header_ptr);
30 
34  SamIterator(const SamIterator&) = delete;
35  SamIterator& operator=(const SamIterator&) = delete;
36 
40  SamIterator(SamIterator&&) = default;
41  SamIterator& operator=(SamIterator&&) = default;
42 
51  bool operator!=(const SamIterator& rhs);
52 
58  Sam& operator*();
59 
66  Sam& operator++();
67 
68  private:
69  std::shared_ptr<htsFile> m_sam_file_ptr;
70  std::shared_ptr<bam_hdr_t> m_sam_header_ptr;
71  std::shared_ptr<bam1_t> m_sam_record_ptr;
72  Sam m_sam_record;
73 
74  void fetch_next_record();
75 };
76 
77 } // end namespace gamgee
78 
79 #endif // gamgee__sam_iterator__guard
SamIterator & operator=(const SamIterator &)=delete
SamIterator()
creates an empty iterator (used for the end() method)
Definition: sam_iterator.cpp:10
Utility class to enable for-each style iteration in the SamReader class.
Definition: sam_iterator.h:15
Sam & operator*()
dereference operator (needed by for-each loop)
Definition: sam_iterator.cpp:25
Definition: exceptions.h:9
Utility class to manipulate a Sam record.
Definition: sam.h:20
Sam & operator++()
pre-fetches the next record and tests for end of file
Definition: sam_iterator.cpp:29
bool operator!=(const SamIterator &rhs)
inequality operator (needed by for-each loop)
Definition: sam_iterator.cpp:34