VirtualStream - SeqAn API Documentation

# Class VirtualStream
Provides seamless (de)compression for another stream.

Implements | StreamConcept
All Impl'd | StreamConcept
Defined in | <seqan/stream.h>
Signature | `template <typename TValue, typename TDirection, typename TTraits> class VirtualStream;`

## Template Parameters

`TValue` | The stream value type, e.g. `char`.
`TDirection` | The stream direction, one of DirectionTags.
`TTraits` | The stream traits, defaults to `std::char_traits<TValue>`.

## Member Function Overview

- `TExtensionVector getFileExtensions()`
  Static function that returns a list of allowed file format extension.
- `VirtualStream::VirtualStream();, VirtualStream::VirtualStream(stream);, VirtualStream::VirtualStream(streamBuf);, VirtualStream::VirtualStream(fileName, openMode);`
  Default constructor and construction from stream, stream buffer, or filename.

## Interface Function Overview

- `bool close(stream);`
  Close a VirtualStream.
- `TFormat format(stream);`
  Return the format of a VirtualStream.
- `bool open(stream, fileStream);, bool open(stream, fileName, openMode);`
  Open a VirtualStream.

### Interface Functions Inherited From StreamConcept

- `position`
- `setPosition`
- `atEnd`
- `directionIterator`

## Interface Metafunction Overview

- `StreamFormat<TStream>::Type;`
  Metafunction for retrieving the format type of a VirtualStream.

### Interface Metafunctions Inherited From StreamConcept

- `DirectionIterator`
- `Position`
- `Size`
- `Value`

## Member Functions Detail

### `TExtensionVector getFileExtensions()`

Static function that returns a list of allowed file format extension.

#### Returns

`TExtensionVector` | A `std::vector<std::string>` with the allowed file extensions.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `VirtualStream::VirtualStream(); VirtualStream::VirtualStream(stream); VirtualStream::VirtualStream(streamBuf); VirtualStream::VirtualStream(fileName, openMode);`

Default constructor and construction from stream, stream buffer, or filename.

#### Parameters

`stream` | The stream to attach to.
`streamBuf` | The stream buffer to attach to.
`fileName` | Path to the file to open. Type: `char const *`.
`openMode` | The open mode. Type: `int`.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

## Interface Functions Detail

### `bool close(stream);`

Close a VirtualStream.

#### Parameters

`stream` | The VirtualStream to close.

#### Returns

`bool` | `true` in the case of success, `false` otherwise.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `TFormat format(stream);`

Return the format of a VirtualStream.

#### Parameters

`stream` | The VirtualStream to check.

#### Returns

`TFormat` | The type as returned from StreamFormat.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `bool open(stream, fileStream); bool open(stream, fileName, openMode);`

Open a VirtualStream.

#### Parameters

`stream` | The VirtualStream to open.
`[` | in,out fileStream File stream to attach to. Type: `std::fstream`.
`fileName` | Path to the file to open. Type: `char const *`.
`openMode` | The open mode. Type: `int`.

#### Returns

`bool` | `true` in the case of success, `false` otherwise.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

## Interface Metafunctions Detail

### `StreamFormat<TStream>::Type;`

Metafunction for retrieving the format type of a VirtualStream.

#### Template Parameters

`TStream` | The stream file type to query for its file format type.

#### Returns

`Type` | The resulting VirtualStream file formats type.

#### Dox Sources

    /*!
     * @class VirtualStream
     *
     * @implements StreamConcept
     *
     * @headerfile <seqan/stream.h>
     *
     * @brief Provides seamless (de)compression for another @link StreamConcept
     *        stream @endlink.
     *
     * @signature template <typename TValue, typename TDirection, typename TTraits>
     *            class VirtualStream;
     *
     * @tparam TValue The stream value type, e.g. <tt>char</tt>.
     * @tparam TDirection The stream direction, one of @link DirectionTags @endlink.
     * @tparam TTraits The stream traits, defaults to
     *                 <tt>std::char_traits&lt;TValue&gt;</tt>.
     *
     * @fn VirtualStream::VirtualStream
     *
     * @brief Default constructor and construction from stream, stream buffer, or
     *        filename.
     *
     * @signature VirtualStream::VirtualStream();
     * @signature VirtualStream::VirtualStream(stream);
     * @signature VirtualStream::VirtualStream(streamBuf);
     * @signature VirtualStream::VirtualStream(fileName, openMode);
     *
     * @param[in] stream The @link StreamConcept stream @endlink to attach to.
     * @param[in] streamBuf The @link StreamBuffer stream buffer @endlink to attach
     *                      to.
     * @param[in] fileName Path to the file to open. Type: <tt>char const *</tt>.
     * @param[in] openMode The open mode. Type: <tt>int</tt>.
     *
     * @fn VirtualStream::getFileExtensions
     *
     * @brief Static function that returns a list of allowed file format extension.
     *
     * @signature TExtensionVector getFileExtensions()
     *
     * @return TExtensionVector A <tt>std::vector&lt;std::string&gt;</tt> with the
     *                          allowed file extensions.
     *
     * @mfn VirtualStream#StreamFormat
     *
     * @brief Metafunction for retrieving the format type of a @link VirtualStream
     *        @endlink.
     *
     * @signature StreamFormat<TStream>::Type;
     *
     * @tparam TStream The stream file type to query for its file format type.
     *
     * @return Type The resulting @link VirtualStream @endlink file formats type.
     *
     * @fn VirtualStream#open
     *
     * @brief Open a VirtualStream.
     *
     * @signature bool open(stream, fileStream);
     * @signature bool open(stream, fileName, openMode);
     *
     * @param[in,out] stream The VirtualStream to open.
     * @param [ in,out fileStream File stream to attach to. Type:
     *          <tt>std::fstream</tt>.
     * @param[in] fileName Path to the file to open. Type: <tt>char const *</tt>.
     * @param[in] openMode The open mode. Type: <tt>int</tt>.
     *
     * @return bool <tt>true</tt> in the case of success, <tt>false</tt> otherwise.
     *
     * @fn VirtualStream#close
     *
     * @brief Close a VirtualStream.
     *
     * @signature bool close(stream);
     *
     * @param[in,out] stream The VirtualStream to close.
     *
     * @return bool <tt>true</tt> in the case of success, <tt>false</tt> otherwise.
     *
     * @fn VirtualStream#format
     *
     * @brief Return the format of a VirtualStream.
     *
     * @signature TFormat format(stream);
     *
     * @param[in] stream The VirtualStream to check.
     *
     * @return TFormat The type as returned from @link VirtualStream#StreamFormat
     *                 @endlink.
     */