BlastProgramSelector - SeqAn API Documentation

# Class BlastProgramSelector
A datatype that can act as either a BlastProgram or as an constexpr integral constant thereof.

Defined in | <seqan/blast.h>
Signature | `template <BlastProgram p> struct BlastProgramSelector { ... };`

## Interface Function Overview

- `constexpr bool qHasRevComp(BlastProgram const p);`
  Whether the reverse complement of the query sequence(s) is searched with the given BlastProgram
- `constexpr bool qIsTranslated(BlastProgram const p);`
  Whether the query sequence is translated in the given BlastProgram
- `constexpr uint8_t qNumFrames(BlastProgram const p);`
  The number of frames per query sequence implied by the given BlastProgram
- `constexpr bool sHasRevComp(BlastProgram const p);`
  Whether the reverse complement of the subject sequence(s) is searched with the given BlastProgram
- `constexpr bool sIsTranslated(BlastProgram const p);`
  Whether the subject sequence is translated in the given BlastProgram
- `constexpr uint8_t sNumFrames(BlastProgram const p);`
  The number of frames per query sequence implied by the given BlastProgram

## Detailed Description

This is a proxy datatype that enables compile-time optimizations through constexpressions iff the value is known at compile time. You will rarely need to instantiate objects of this type yourself, but they are used in the BlastIOContext.

The interface functions work on regular enum values of BlastProgram, as well, but are gathered here for convenience.

Please note that the default value for `BlastProgramSelector<BlastProgram::DYNAMIC>` is `BlastProgram::UNKNOWN`, not `BlastProgram::DYNAMIC`.

#### Example

mutable variable:

    BlastProgramSelector<BlastProgram::DYNAMIC> myProgram = BlastProgram::BLASTN;
    // same as:
    // BlastProgram myProgram = BlastProgram::BLASTN;

    SEQAN_ASSERT(myProgram == BlastProgram::BLASTN); // assertion is checked at run-time
    myProgram = BlastProgram::BLASTP; // works without problems

compile time integral constant:

    BlastProgramSelector<BlastProgram::BLASTN> myProgram;
    static_assert(myProgram == BlastProgram::BLASTN, ""); // assertion is checked at compile time
    myProgram = BlastProgram::BLASTP; // would fail, because value is fixed (and different)

## Interface Functions Detail

### `constexpr bool qHasRevComp(BlastProgram const p);`

Whether the reverse complement of the query sequence(s) is searched with the given BlastProgram

#### Returns

`false` | for BLASTP and TBLASTN
`true` | otherwise

#### Data Races

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

### `constexpr bool qIsTranslated(BlastProgram const p);`

Whether the query sequence is translated in the given BlastProgram

#### Returns

`true` | for BLASTX and TBLASTX
`false` | otherwise

#### Data Races

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

### `constexpr uint8_t qNumFrames(BlastProgram const p);`

The number of frames per query sequence implied by the given BlastProgram

#### Returns

`6` | for BLASTX and TBLASTX
`2` | for BLASTN
`1` | for BLASTP and TBLASTN

#### Data Races

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

### `constexpr bool sHasRevComp(BlastProgram const p);`

Whether the reverse complement of the subject sequence(s) is searched with the given BlastProgram

#### Returns

`true` | for TBLASTX and TBLASTN
`false` | otherwise

#### Data Races

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

### `constexpr bool sIsTranslated(BlastProgram const p);`

Whether the subject sequence is translated in the given BlastProgram

#### Returns

`true` | for TBLASTX and TBLASTN
`false` | otherwise

#### Data Races

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

### `constexpr uint8_t sNumFrames(BlastProgram const p);`

The number of frames per query sequence implied by the given BlastProgram

#### Returns

`6` | for TBLASTX and TBLASTN
`1` | otherwise

#### Data Races

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

#### Dox Sources

    /*!
     * @class BlastProgramSelector
     *
     * @headerfile <seqan/blast.h>
     *
     * @brief A datatype that can act as either a @link BlastProgram @endlink or as
     *        an constexpr integral constant thereof.
     *
     * @signature template <BlastProgram p> struct BlastProgramSelector { ... };
     *
     * This is a proxy datatype that enables compile-time optimizations through
     * constexpressions iff the value is known at compile time. You will rarely need
     * to instantiate objects of this type yourself, but they are used in the @link
     * BlastIOContext @endlink.
     *
     * The interface functions work on regular enum values of @link BlastProgram
     * @endlink, as well, but are gathered here for convenience.
     *
     * Please note that the default value for
     * <tt>BlastProgramSelector<BlastProgram::DYNAMIC></tt> is
     * <tt>BlastProgram::UNKNOWN</tt>, not <tt>BlastProgram::DYNAMIC</tt>.
     *
     * @subsection Example
     *
     * mutable variable:
     *
     * @code{.cpp}
     * BlastProgramSelector<BlastProgram::DYNAMIC> myProgram = BlastProgram::BLASTN;
     * // same as:
     * // BlastProgram myProgram = BlastProgram::BLASTN;
     *
     * SEQAN_ASSERT(myProgram == BlastProgram::BLASTN); // assertion is checked at run-time
     * myProgram = BlastProgram::BLASTP; // works without problems
     * @endcode
     *
     *
     * compile time integral constant:
     *
     * @code{.cpp}
     * BlastProgramSelector<BlastProgram::BLASTN> myProgram;
     * static_assert(myProgram == BlastProgram::BLASTN, ""); // assertion is checked at compile time
     * myProgram = BlastProgram::BLASTP; // would fail, because value is fixed (and different)
     * @endcode
     *
     *
     * @fn BlastProgramSelector#qHasRevComp
     *
     * @headerfile <seqan/blast.h>
     *
     * @brief Whether the reverse complement of the <b>query</b> sequence(s) is
     *        searched with the given BlastProgram
     *
     * @signature constexpr bool qHasRevComp(BlastProgram const p);
     *
     * @return false for @link BlastProgram::BLASTP @endlink and @link
     *               BlastProgram::TBLASTN @endlink
     * @return true otherwise
     *
     * @fn BlastProgramSelector#qIsTranslated
     *
     * @headerfile <seqan/blast.h>
     *
     * @brief Whether the <b>query</b> sequence is translated in the given
     *        BlastProgram
     *
     * @signature constexpr bool qIsTranslated(BlastProgram const p);
     *
     * @return true for @link BlastProgram::BLASTX @endlink and @link
     *              BlastProgram::TBLASTX @endlink
     * @return false otherwise
     *
     * @fn BlastProgramSelector#qNumFrames
     *
     * @headerfile <seqan/blast.h>
     *
     * @brief The number of frames per <b>query</b> sequence implied by the given
     *        BlastProgram
     *
     * @signature constexpr uint8_t qNumFrames(BlastProgram const p);
     *
     * @return 6 for @link BlastProgram::BLASTX @endlink and @link
     *           BlastProgram::TBLASTX @endlink
     * @return 2 for @link BlastProgram::BLASTN @endlink
     * @return 1 for @link BlastProgram::BLASTP @endlink and @link
     *           BlastProgram::TBLASTN @endlink
     *
     * @fn BlastProgramSelector#sHasRevComp
     *
     * @headerfile <seqan/blast.h>
     *
     * @brief Whether the reverse complement of the <b>subject</b> sequence(s) is
     *        searched with the given BlastProgram
     *
     * @signature constexpr bool sHasRevComp(BlastProgram const p);
     *
     * @return true for @link BlastProgram::TBLASTX @endlink and @link
     *              BlastProgram::TBLASTN @endlink
     * @return false otherwise
     *
     * @fn BlastProgramSelector#sIsTranslated
     *
     * @headerfile <seqan/blast.h>
     *
     * @brief Whether the <b>subject</b> sequence is translated in the given
     *        BlastProgram
     *
     * @signature constexpr bool sIsTranslated(BlastProgram const p);
     *
     * @return true for @link BlastProgram::TBLASTX @endlink and @link
     *              BlastProgram::TBLASTN @endlink
     * @return false otherwise
     *
     * @fn BlastProgramSelector#sNumFrames
     *
     * @headerfile <seqan/blast.h>
     *
     * @brief The number of frames per <b>query</b> sequence implied by the given
     *        BlastProgram
     *
     * @signature constexpr uint8_t sNumFrames(BlastProgram const p);
     *
     * @return 6 for @link BlastProgram::TBLASTX @endlink and @link
     *           BlastProgram::TBLASTN @endlink
     * @return 1 otherwise
     */