A library for working with phylogenetic and population genetic data.
v0.32.0
GzipBlockOutputTarget Class Referencefinal

#include <genesis/utils/io/gzip_output_target.hpp>

Inherits BaseOutputTarget.

Detailed Description

Output target for writing byte data to a gzip-compressed target in blocks of gzip data.

This output target is a wrapper that takes some other output target (FileOutputTarget, StringOutputTarget, StreamOutputTarget, etc), and compresses using the gzip format on the fly while writing to that other target.

Using gzip blocks allows us to compress in parallel using multiple threads. By default, if no thread_pool is provided, we use the global pool of Options::get().global_thread_pool(). Furthermore, using gzip blocks should allow for downstream indexing and random access into the compressed file, similar to VCF tabix indexing, although we currently have not tested this. See the GzipBlockOStream class for details on gzip block compression.

The class can be moved, but not copied, because of the internal state that is kept for compression, and which would mess up the output if copied.

See also
GzipBlockOStream
to_gzip_block_file

Definition at line 175 of file gzip_output_target.hpp.

Public Member Functions

 GzipBlockOutputTarget (GzipBlockOutputTarget &&)=default
 
 GzipBlockOutputTarget (GzipBlockOutputTarget const &)=delete
 
 GzipBlockOutputTarget (std::shared_ptr< BaseOutputTarget > output_target, std::size_t block_size=GzipBlockOStream::GZIP_DEFAULT_BLOCK_SIZE, GzipCompressionLevel compression_level=GzipCompressionLevel::kDefaultCompression, std::shared_ptr< ThreadPool > thread_pool=nullptr)
 Construct the output target using another output target (FileOutputTarget, StringOutputTarget, StreamOutputTarget, etc), and add gzip/zlib compression on top, using the specified GzipCompressionLevel%. More...
 
 ~GzipBlockOutputTarget () override=default
 
GzipBlockOutputTargetoperator= (GzipBlockOutputTarget &&)=default
 
GzipBlockOutputTargetoperator= (GzipBlockOutputTarget const &)=delete
 
- Public Member Functions inherited from BaseOutputTarget
 BaseOutputTarget ()=default
 
 BaseOutputTarget (BaseOutputTarget &&)=default
 
 BaseOutputTarget (BaseOutputTarget const &)=default
 
virtual ~BaseOutputTarget ()
 
std::ostream & flush ()
 Flush output stream buffer. More...
 
template<typename T >
BaseOutputTargetoperator<< (T const &content)
 Output stream operator template that simply forwards to the underlying ostream() object. More...
 
BaseOutputTargetoperator= (BaseOutputTarget &&)=default
 
BaseOutputTargetoperator= (BaseOutputTarget const &)=default
 
std::ostream & ostream ()
 Get the underlying output stream that is used for writing. More...
 
std::string target_name () const
 Get a name of the output target. This is intended for user output. More...
 
std::string target_string () const
 Get a string representing the output target. More...
 

Constructor & Destructor Documentation

◆ GzipBlockOutputTarget() [1/3]

GzipBlockOutputTarget ( std::shared_ptr< BaseOutputTarget output_target,
std::size_t  block_size = GzipBlockOStream::GZIP_DEFAULT_BLOCK_SIZE,
GzipCompressionLevel  compression_level = GzipCompressionLevel::kDefaultCompression,
std::shared_ptr< ThreadPool thread_pool = nullptr 
)
inlineexplicit

Construct the output target using another output target (FileOutputTarget, StringOutputTarget, StreamOutputTarget, etc), and add gzip/zlib compression on top, using the specified GzipCompressionLevel%.

See GzipBlockOStream for details on the parameters.

Definition at line 190 of file gzip_output_target.hpp.

◆ GzipBlockOutputTarget() [2/3]

◆ GzipBlockOutputTarget() [3/3]

◆ ~GzipBlockOutputTarget()

~GzipBlockOutputTarget ( )
overridedefault

Member Function Documentation

◆ operator=() [1/2]

GzipBlockOutputTarget& operator= ( GzipBlockOutputTarget &&  )
default

◆ operator=() [2/2]

GzipBlockOutputTarget& operator= ( GzipBlockOutputTarget const &  )
delete

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