Gamgee
You miserable little maggot. I'll stove your head in!
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
gamgee::IndexedSamIterator Class Reference

Utility class to enable for-each style iteration in the IndexedSamReader class. More...

#include <indexed_sam_iterator.h>

Public Member Functions

 IndexedSamIterator ()
 creates an empty iterator (used for the end() method) More...
 
 IndexedSamIterator (const std::shared_ptr< htsFile > &sam_file_ptr, const std::shared_ptr< hts_idx_t > &sam_index_ptr, const std::shared_ptr< bam_hdr_t > &sam_header_ptr, const std::vector< std::string > &interval_list)
 initializes a new iterator based on an input file stream More...
 
 IndexedSamIterator (IndexedSamIterator &&other)=default
 iterators and readers can be moved More...
 
IndexedSamIteratoroperator= (IndexedSamIterator &&other)=default
 
 IndexedSamIterator (const IndexedSamIterator &other)=delete
 no copy construction/assignment allowed for iterators and readers More...
 
IndexedSamIteratoroperator= (const IndexedSamIterator &other)=delete
 
bool operator!= (const IndexedSamIterator &rhs)
 inequality operator (needed by for-each loop) More...
 
Samoperator* ()
 dereference operator (needed by for-each loop) More...
 
Samoperator++ ()
 pre-fetches the next record and tests for end of file More...
 
const std::string & current_interval () const
 

Detailed Description

Utility class to enable for-each style iteration in the IndexedSamReader class.

Constructor & Destructor Documentation

gamgee::IndexedSamIterator::IndexedSamIterator ( )

creates an empty iterator (used for the end() method)

gamgee::IndexedSamIterator::IndexedSamIterator ( const std::shared_ptr< htsFile > &  sam_file_ptr,
const std::shared_ptr< hts_idx_t > &  sam_index_ptr,
const std::shared_ptr< bam_hdr_t > &  sam_header_ptr,
const std::vector< std::string > &  interval_list 
)

initializes a new iterator based on an input file stream

Parameters
sam_file_ptrpointer to a bam/cram file opened via the sam_open() macro from htslib
sam_index_ptrpointer to a bam/cram file opened via the sam_index_load() macro from htslib
sam_header_ptrpointer to a bam/cram file header created with the sam_hdr_read() macro from htslib
interval_listvector of intervals compatible with sam_itr_querys, hts_parse_reg, etc.
gamgee::IndexedSamIterator::IndexedSamIterator ( IndexedSamIterator &&  other)
default

iterators and readers can be moved

gamgee::IndexedSamIterator::IndexedSamIterator ( const IndexedSamIterator other)
delete

no copy construction/assignment allowed for iterators and readers

Member Function Documentation

const std::string & gamgee::IndexedSamIterator::current_interval ( ) const
bool gamgee::IndexedSamIterator::operator!= ( const IndexedSamIterator rhs)

inequality operator (needed by for-each loop)

Parameters
rhsthe other SamIterator to compare to
Returns
whether or not the two iterators are the same (e.g. have the same input stream on the same status)
Sam & gamgee::IndexedSamIterator::operator* ( )

dereference operator (needed by for-each loop)

Returns
a Sam object by reference, valid until the next record is fetched (the iterator re-uses memory at each iteration)
Sam & gamgee::IndexedSamIterator::operator++ ( )

pre-fetches the next record and tests for end of file

Returns
a reference to the object (it can be const& because this return value should only be used by the for-each loop to check for the eof)
IndexedSamIterator& gamgee::IndexedSamIterator::operator= ( IndexedSamIterator &&  other)
default
IndexedSamIterator& gamgee::IndexedSamIterator::operator= ( const IndexedSamIterator other)
delete

The documentation for this class was generated from the following files: