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::SamPairIterator Class Reference

Utility class to enable for-each style iteration by pairs in the SamReader class. More...

#include <sam_pair_iterator.h>

Public Member Functions

 SamPairIterator ()
 creates an empty iterator (used for the end() method) More...
 
 SamPairIterator (const std::shared_ptr< htsFile > &sam_file_ptr, const std::shared_ptr< bam_hdr_t > &sam_header_ptr)
 initializes a new iterator based on an input stream (e.g. sam/a file, stdin, ...) More...
 
 SamPairIterator (const SamPairIterator &other)=delete
 no copy construction/assignment allowed in readers or iterators More...
 
SamPairIteratoroperator= (const SamPairIterator &other)=delete
 
 SamPairIterator (SamPairIterator &&other)=default
 a SamPairIterator move constructor guarantees all objects will have the same state. More...
 
SamPairIteratoroperator= (SamPairIterator &&other)=default
 
bool operator!= (const SamPairIterator &rhs)
 inequality operator (needed by for-each loop) More...
 
std::pair< Sam, Samoperator* ()
 dereference operator (needed by for-each loop) More...
 
std::pair< Sam, Samoperator++ ()
 pre-fetches the next record and tests for end of file More...
 

Detailed Description

Utility class to enable for-each style iteration by pairs in the SamReader class.

Constructor & Destructor Documentation

gamgee::SamPairIterator::SamPairIterator ( )

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

gamgee::SamPairIterator::SamPairIterator ( const std::shared_ptr< htsFile > &  sam_file_ptr,
const std::shared_ptr< bam_hdr_t > &  sam_header_ptr 
)

initializes a new iterator based on an input stream (e.g. sam/a file, stdin, ...)

Parameters
sam_file_ptrpointer to a sam file opened via the sam_open() macro from htslib
sam_header_ptrpointer to a sam file header created with the sam_hdr_read() macro from htslib
gamgee::SamPairIterator::SamPairIterator ( const SamPairIterator other)
delete

no copy construction/assignment allowed in readers or iterators

gamgee::SamPairIterator::SamPairIterator ( SamPairIterator &&  other)
default

a SamPairIterator move constructor guarantees all objects will have the same state.

Member Function Documentation

bool gamgee::SamPairIterator::operator!= ( const SamPairIterator rhs)

inequality operator (needed by for-each loop)

Parameters
rhsthe other SamPairIterator to compare to
Returns
whether or not the two iterators are the same (e.g. have the same input stream on the same status)
pair< Sam, Sam > gamgee::SamPairIterator::operator* ( )

dereference operator (needed by for-each loop)

Returns
a persistent Sam object independent from the iterator (a copy of the iterator's object)
pair< Sam, Sam > gamgee::SamPairIterator::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)
SamPairIterator& gamgee::SamPairIterator::operator= ( const SamPairIterator other)
delete
SamPairIterator& gamgee::SamPairIterator::operator= ( SamPairIterator &&  other)
default

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