FiniteOrderedAlphabetConcept - SeqAn API Documentation

# Concept FiniteOrderedAlphabetConcept
An type that is of finite domain and totally ordered and thus has a minimum and maximum value.

Extends | OrderedAlphabetConcept
All Extended | AlphabetConcept, AssignableConcept, ComparableConcept, CopyConstructibleConcept, DefaultConstructibleConcept, EqualityComparableConcept, LessThanComparableConcept, OrderedAlphabetConcept
Defined in | <seqan/basic.h>
Signature | ``

## Member Function Overview

### Member Functions Inherited From AssignableConcept

- `operator=`

### Member Functions Inherited From ComparableConcept

- `operator>`

### Member Functions Inherited From EqualityComparableConcept

- `operator!=`
- `operator==`

### Member Functions Inherited From LessThanComparableConcept

- `operator<`

### Member Functions Inherited From OrderedAlphabetConcept

- `operator<`

## Interface Function Overview

- `T ordValue(value);`
  Maps an alphabet 1-to-1 to the interval [0..ValueSize).
- `T1 valueSize<T2>();`
  Returns size of an alphabet.

### Interface Functions Inherited From AssignableConcept

- `assign`
- `move`
- `set`

### Interface Functions Inherited From ComparableConcept

- `operator<=`
- `operator>=`

### Interface Functions Inherited From OrderedAlphabetConcept

- `infimumValueImpl`
- `maxValue`
- `minValue`
- `supremumValueImpl`

## Interface Metafunction Overview

- `ValueSize<T>::Type;, ValueSize<T>::VALUE;`
  Number of different values a value type object can have.

### Interface Metafunctions Inherited From AlphabetConcept

- `BitsPerValue`

### Interface Metafunctions Inherited From OrderedAlphabetConcept

- `MaxValue`
- `MinValue`

## Interface Functions Detail

### `T ordValue(value);`

Maps an alphabet 1-to-1 to the interval [0..ValueSize).

#### Parameters

`value` | Arbitrary character value. Types: SimpleType

#### Returns

`T` | An unsigned value (result of Size`<typeof(value)>` between 0 and ValueSize of the type of value.

This function first converts value to its unsigned value type and after that to an `unsigned int`. You can't use `(unsigned int)c` for a character `c` as on some systems `char` is signed and a `-1` would be mapped to `0xffffffff` instead of `0x000000ff`.

#### Data Races

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

### `T1 valueSize<T2>();`

Returns size of an alphabet.

#### Template Parameters

`T2` | Type to query for value size.

#### Returns

`T1` | Number of values in type `T2`.

#### Data Races

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

#### See Also

- ValueSize

## Interface Metafunctions Detail

### `ValueSize<T>::Type; ValueSize<T>::VALUE;`

Number of different values a value type object can have.

#### Template Parameters

`T` | A type to query for its value size.

#### Returns

`VALUE` | The number of different values a value of type T can have. The type is `Type`.
`Type` | The type of the result `VALUE`.

This function is only defined for integral types like `unsigned`, `int`, or Dna. For floating point numbers and the 64 bit types `int64_t` and `uint64_t`, it returns 0 since there is no standard compliant way to return the number of values for these types.

Note that you cannot get pointers or references to `ValueSize<T>::VALUE` in your program. You can use valueSize in your programs without problems, though. When you get problems in your tests, use the "unary plus" workaround from the examples section.

#### Examples

The temporary assignment workaround.

    SEQAN_ASSERT_EQ(ValueSize<bool>::VALUE, 2u);    // Linker error.
    SEQAN_ASSERT_EQ(+ValueSize<bool>::VALUE, 2u);   // OK
    SEQAN_ASSERT_EQ(valueSize<bool>(), 2u);         // OK

#### Dox Sources

    /*!
     * @concept FiniteOrderedAlphabetConcept
     *
     * @headerfile <seqan/basic.h>
     *
     * @extends OrderedAlphabetConcept
     *
     * @brief An type that is of finite domain and totally ordered and thus has a
     *        minimum and maximum value.
     *
     * @mfn FiniteOrderedAlphabetConcept#ValueSize
     *
     * @brief Number of different values a value type object can have.
     *
     * @signature ValueSize<T>::Type;
     * @signature ValueSize<T>::VALUE;
     *
     * @tparam T A type to query for its value size.
     *
     * @return VALUE The number of different values a value of type T can have. The
     *               type is <tt>Type</tt>.
     * @return Type The type of the result <tt>VALUE</tt>.
     *
     * This function is only defined for integral types like <tt>unsigned</tt>,
     * <tt>int</tt>, or Dna. For floating point numbers and the 64 bit types
     * <tt>int64_t</tt> and <tt>uint64_t</tt>, it returns 0 since there is no
     * standard compliant way to return the number of values for these types.
     *
     * Note that you cannot get pointers or references to
     * <tt>ValueSize&lt;T&gt;::VALUE</tt> in your program. You can use @link
     * FiniteOrderedAlphabetConcept#valueSize @endlink in your programs without
     * problems, though. When you get problems in your tests, use the "unary plus"
     * workaround from the examples section.
     *
     * @section Examples
     *
     * The temporary assignment workaround.
     *
     * @code{.cpp}
     * SEQAN_ASSERT_EQ(ValueSize<bool>::VALUE, 2u);    // Linker error.
     * SEQAN_ASSERT_EQ(+ValueSize<bool>::VALUE, 2u);   // OK
     * SEQAN_ASSERT_EQ(valueSize<bool>(), 2u);         // OK
     * @endcode
     *
     *
     * @fn FiniteOrderedAlphabetConcept#ordValue
     *
     * @headerfile <seqan/sequence.h>
     *
     * @brief Maps an alphabet 1-to-1 to the interval [0..ValueSize).
     *
     * @signature T ordValue(value);
     *
     * @param[in] value Arbitrary character value. Types: SimpleType
     *
     * @return T An unsigned value (result of Size<tt>&lt;typeof(value)&gt;</tt>
     *           between 0 and ValueSize of the type of value.
     *
     * This function first converts value to its unsigned value type and after that
     * to an <tt>unsigned int</tt>. You can't use <tt>(unsigned int)c</tt> for a
     * character <tt>c</tt> as on some systems <tt>char</tt> is signed and a
     * <tt>-1</tt> would be mapped to <tt>0xffffffff</tt> instead of
     * <tt>0x000000ff</tt>.
     *
     * @fn FiniteOrderedAlphabetConcept#valueSize
     *
     * @brief Returns size of an alphabet.
     *
     * @signature T1 valueSize<T2>();
     *
     * @tparam T2 Type to query for value size.
     *
     * @return T1 Number of values in type <tt>T2</tt>.
     *
     * @see FiniteOrderedAlphabetConcept#ValueSize
     */