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

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

#include <variant_iterator.h>

Public Member Functions

 VariantIterator ()
 creates an empty iterator (used for the end() method) More...
 
 VariantIterator (vcfFile *variant_file_ptr, const std::shared_ptr< bcf_hdr_t > &variant_header_ptr)
 initializes a new iterator based on an input stream (e.g. sam/a file, stdin, ...) More...
 
 VariantIterator (VariantIterator &&)
 a VariantIterator move constructor guarantees all objects will have the same state. More...
 
bool operator!= (const VariantIterator &rhs)
 inequality operator (needed by for-each loop) More...
 
Variantoperator* ()
 dereference operator (needed by for-each loop) More...
 
Variantoperator++ ()
 pre-fetches the next record and tests for end of file More...
 

Detailed Description

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

Constructor & Destructor Documentation

gamgee::VariantIterator::VariantIterator ( )

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

gamgee::VariantIterator::VariantIterator ( vcfFile *  variant_file_ptr,
const std::shared_ptr< bcf_hdr_t > &  variant_header_ptr 
)

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

Parameters
variant_file_ptrpointer to a vcf/bcf file opened via the bcf_open() macro from htslib
variant_header_ptrshared pointer to a vcf/bcf file header created with the bcf_hdr_read() macro from htslib
gamgee::VariantIterator::VariantIterator ( VariantIterator &&  original)

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

Member Function Documentation

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

inequality operator (needed by for-each loop)

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

dereference operator (needed by for-each loop)

Returns
a persistent Variant object independent from the iterator (a copy of the iterator's object)
Variant & gamgee::VariantIterator::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)

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