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

Utility class to read many Fastq records from a stream (e.g. Fastq file, stdin, ...) in a for-each loop in a for-each loop. More...

#include <fastq_reader.h>

Public Member Functions

 FastqReader (const std::string &filename)
 reads through all records in a file (fasta or fastq) parsing them into Fastq objects More...
 
 FastqReader (const std::vector< std::string > &filenames)
 reads through all records in a file (fasta or fastq) parsing them into Fastq objects More...
 
 FastqReader (std::istream *const input)
 reads through all records in a stream (e.g. stdin) parsing them into Fastq objects More...
 
 FastqReader (FastqReader &&)=default
 move constructor for the FastqReader class simply transfers all objects with the state maintained. More...
 
FastqReaderoperator= (FastqReader &&)=default
 
 FastqReader (const FastqReader &)=delete
 a FastqReader cannot be copied safely, as it is iterating over a stream. More...
 
FastqReaderoperator= (const FastqReader &)=delete
 
FastqIterator begin ()
 creates a FastqIterator pointing at the start of the input stream (needed by for-each loop) More...
 
FastqIterator end ()
 creates a FastqIterator with a nullified input stream (needed by for-each loop) More...
 

Detailed Description

Utility class to read many Fastq records from a stream (e.g. Fastq file, stdin, ...) in a for-each loop in a for-each loop.

This class is designed to parse fastq files in for-each loops with the following signature:

for (auto& record : FastqReader(filename))
do_something_with_fastq(record);

You can also use it with the stdin or any other stream by simply giving the reference to the stream in the constructor, like so:

for (auto& record : FastqReader(&std::cin))
do_something_with_fastq(record);

Although one could use it as an iterator, if your goal is to do so, you should use the FastqIterator class

Constructor & Destructor Documentation

gamgee::FastqReader::FastqReader ( const std::string &  filename)
explicit

reads through all records in a file (fasta or fastq) parsing them into Fastq objects

Parameters
filenamethe name of the fasta/fastq file
gamgee::FastqReader::FastqReader ( const std::vector< std::string > &  filenames)
explicit

reads through all records in a file (fasta or fastq) parsing them into Fastq objects

Parameters
filenamesa vector containing a single element: the name of the fasta/fastq file
gamgee::FastqReader::FastqReader ( std::istream *const  input)
explicit

reads through all records in a stream (e.g. stdin) parsing them into Fastq objects

Parameters
inputa reference to the input stream (e.g. &std::cin)
gamgee::FastqReader::FastqReader ( FastqReader &&  )
default

move constructor for the FastqReader class simply transfers all objects with the state maintained.

gamgee::FastqReader::FastqReader ( const FastqReader )
delete

a FastqReader cannot be copied safely, as it is iterating over a stream.

Member Function Documentation

FastqIterator gamgee::FastqReader::begin ( )

creates a FastqIterator pointing at the start of the input stream (needed by for-each loop)

Returns
a FastqIterator ready to start parsing the file
FastqIterator gamgee::FastqReader::end ( )

creates a FastqIterator with a nullified input stream (needed by for-each loop)

Returns
a FastqIterator that will match the end status of the iterator at the end of the stream
FastqReader& gamgee::FastqReader::operator= ( FastqReader &&  )
default
FastqReader& gamgee::FastqReader::operator= ( const FastqReader )
delete

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