tudocomp
– The TU Dortmund Compression Framework
tdc::io::Output Class Reference

An abstraction layer for algorithm output. More...

#include <Output.hpp>

Inheritance diagram for tdc::io::Output:
tdc::test::TestOutput

Public Member Functions

 Output ()
 Constructs an output to stdout. More...
 
 Output (Output &&other)
 Move constructor. More...
 
 Output (const Path &path, bool overwrite=false)
 Constructs an output that appends to the file at the given path. More...
 
 Output (std::vector< uint8_t > &buf)
 Constructs an output that appends to the byte vector. More...
 
 Output (std::ostream &stream)
 Constructs an output that appends to the output stream. More...
 
Outputoperator= (Output &&other)
 Move assignment operator. More...
 
OutputStream as_stream () const
 Creates a stream that allows for character-wise output. More...
 

Static Public Member Functions

static Output from_path (const Path &path, bool overwrite=false)
 Constructs a file output writing to the file at the given path. More...
 
static Output from_memory (std::vector< uint8_t > &buf)
 Constructs an output to a byte buffer. More...
 
static Output from_stream (std::ostream &stream)
 Constructs an output to a stream. More...
 

Friends

class OutputStream
 

Detailed Description

An abstraction layer for algorithm output.

This class serves as a generic abstraction over different output sinks: memory, files or streams. Output is generally done in a stream, ie it is written to the sink character by character.

Definition at line 23 of file Output.hpp.

Constructor & Destructor Documentation

tdc::io::Output::Output ( )
inline

Constructs an output to stdout.

Definition at line 99 of file Output.hpp.

tdc::io::Output::Output ( Output &&  other)
inline

Move constructor.

Definition at line 102 of file Output.hpp.

tdc::io::Output::Output ( const Path path,
bool  overwrite = false 
)
inline

Constructs an output that appends to the file at the given path.

Parameters
pathThe path to the output file.
overwriteIf true, the file will be overwritten in case it already exists, otherwise the output will be appended to it.

Definition at line 111 of file Output.hpp.

tdc::io::Output::Output ( std::vector< uint8_t > &  buf)
inline

Constructs an output that appends to the byte vector.

Parameters
bufThe byte buffer to write to.

Definition at line 117 of file Output.hpp.

tdc::io::Output::Output ( std::ostream &  stream)
inline

Constructs an output that appends to the output stream.

Parameters
streamThe stream to write to.

Definition at line 123 of file Output.hpp.

Member Function Documentation

OutputStream tdc::io::Output::as_stream ( ) const
inline

Creates a stream that allows for character-wise output.

Definition at line 223 of file OutputStream.hpp.

static Output tdc::io::Output::from_memory ( std::vector< uint8_t > &  buf)
inlinestatic

Constructs an output to a byte buffer.

Deprecated:
Use the respective constructor instead.
Parameters
bufThe byte buffer to write to.

Definition at line 147 of file Output.hpp.

static Output tdc::io::Output::from_path ( const Path path,
bool  overwrite = false 
)
inlinestatic

Constructs a file output writing to the file at the given path.

Deprecated:
Use the respective constructor instead.
Parameters
pathThe path to the input file.
overwriteIf true, the file will be overwritten in case it already exists, otherwise the output will be appended to it.

Definition at line 139 of file Output.hpp.

static Output tdc::io::Output::from_stream ( std::ostream &  stream)
inlinestatic

Constructs an output to a stream.

Deprecated:
Use the respective constructor instead.
Parameters
streamThe stream to write to.

Definition at line 155 of file Output.hpp.

Output& tdc::io::Output::operator= ( Output &&  other)
inline

Move assignment operator.

Definition at line 127 of file Output.hpp.

Friends And Related Function Documentation

friend class OutputStream
friend

Definition at line 96 of file Output.hpp.


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