# Class SimpleType
Implementation for "simple" types.

Implements | FiniteOrderedAlphabetConcept
All Subcl's | AminoAcid, Dna, Dna5, Dna5Q, DnaQ, Finite, Iupac, ReducedAminoAcid, Rna, Rna5
All Impl'd | AlphabetConcept, AssignableConcept, ComparableConcept, CopyConstructibleConcept, DefaultConstructibleConcept, EqualityComparableConcept, FiniteOrderedAlphabetConcept, LessThanComparableConcept, OrderedAlphabetConcept
Defined in | <seqan/basic.h>
Signature | `template <typename TValue, typename TSpec> class SimpleType;`

## Template Parameters

`TSpec` | Specialization tag.
`TValue` | Type that stores the values of an instance. TValue must be a simple type.

## Member Function Overview

- `SimpleType::SimpleType();, SimpleType::SimpleType(other);, template <typename TParam> SimpleType::SimpleType(param);`
  Constructor of SimpleType type.

### 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

### Interface Functions Inherited From AssignableConcept

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

### Interface Functions Inherited From ComparableConcept

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

### Interface Functions Inherited From FiniteOrderedAlphabetConcept

- `ordValue`
- `valueSize`

### Interface Functions Inherited From OrderedAlphabetConcept

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

## Interface Metafunction Overview

### Interface Metafunctions Inherited From AlphabetConcept

- `BitsPerValue`

### Interface Metafunctions Inherited From FiniteOrderedAlphabetConcept

- `ValueSize`

### Interface Metafunctions Inherited From OrderedAlphabetConcept

- `MaxValue`
- `MinValue`

## Member Variable Overview

- `TValue SimpleType::value`
  The internal value storage of the SimpleType object.

## Detailed Description

A "simple type" is a C++ type that can be constructed without constructor, destructed without destructor and copied without copy constructor or assignment operator. All basic types (like `char`, `int` or `float`) are simple. Pointers, references and arrays of simple types are simple. POD types ("plain old data types"), that are - simplified spoken - C++-types that already existed in C, are simple too.

Arrays of simple types can be copied very fast by memory manipulation routines, but the default implementation of functions like arrayCopyForward and arrayCopy are not optimized for simple types this way. But for classes derived from `SimpleType`, optimized variants of array manipulation functions are applied.

Note that simple types need not to be derived or specialized from `SimpleType`, but it could be convenient to do so.

## See Also

- IsSimple

## Member Functions Detail

### `SimpleType::SimpleType(); SimpleType::SimpleType(other); template <typename TParam> SimpleType::SimpleType(param);`

Constructor of SimpleType type.

#### Parameters

`other` | Other SimpleType to copy construct with.
`param` | Any value of type `TParam` that can be assigned to the SimpleType object.

The default constructor initializes the SimpleType object with the value `0` and the copy constructor copies over the value of the SimpleType.

When constructing with a `param` that is not a SimpleType then `param` is assigned to the SimpleType object, using assign. This function can be overloaded differently for each type. You can expect the following behaviour for all SimpleType objects, however:

- If `param` is a builtin integer then this value is directly assigned to the value member of the SimpleType object. Note that this can allow an invalid assignment, e.g., when assigning `42` to a Dna object.
- If `param` is a `char` then this character value is converted to the appropriate value and written to the value member. For example, assigning `'A'` or `'a'` to a SimpleType object assigns `0` to the value member.

#### Example

The following example shows construction of a Dna (specialization of SimpleType) object with from `char` and integer values.

        Dna a('C');  // => a.value == 1
        Dna b(3);    // => b.value == 3
        Dna c('T');  // => c.value == 3
        Dna d('t');  // => d.value == 3

        Dna e;  // => e.value == 0
        e = 'N';       // => e.value == 0
        e = 'c';       // => e.value == c

Snippet from: demos/dox/basic/simple_type_construction.cpp

#### Data Races

Thread safety unknown!

## Member Variables Detail

### `TValue SimpleType::value`

The internal value storage of the SimpleType object.

@important Do not modify this value directly. SimpleType implements conversion operators for all numeric types, so you can simply assign and cast the SimpleType to all built-in numeric types.

Stores the value of the SimpleType, is of type `TValue`. Valid values are from `0` to ValueSize minus one.

#### Dox Sources

    /*!
     * @class SimpleType
     *
     * @implements FiniteOrderedAlphabetConcept
     *
     * @headerfile <seqan/basic.h>
     *
     * @brief Implementation for "simple" types.
     *
     * @signature template <typename TValue, typename TSpec> class SimpleType;
     *
     * @tparam TSpec Specialization tag.
     * @tparam TValue Type that stores the values of an instance. TValue must be a
     *                simple type.
     *
     * A "simple type" is a C++ type that can be constructed without constructor,
     * destructed without destructor and copied without copy constructor or
     * assignment operator. All basic types (like <tt>char</tt>, <tt>int</tt> or
     * <tt>float</tt>) are simple. Pointers, references and arrays of simple types
     * are simple. POD types ("plain old data types"), that are - simplified spoken
     * - C++-types that already existed in C, are simple too.
     *
     * Arrays of simple types can be copied very fast by memory manipulation
     * routines, but the default implementation of functions like arrayCopyForward
     * and arrayCopy are not optimized for simple types this way. But for classes
     * derived from <tt>SimpleType</tt>, optimized variants of array manipulation
     * functions are applied.
     *
     * Note that simple types need not to be derived or specialized from
     * <tt>SimpleType</tt>, but it could be convenient to do so.
     *
     * @see IsSimple
     *
     * @fn SimpleType::SimpleType
     *
     * @brief Constructor of SimpleType type.
     *
     * @signature SimpleType::SimpleType();
     * @signature SimpleType::SimpleType(other);
     * @signature template <typename TParam> SimpleType::SimpleType(param);
     *
     * @param[in] other Other SimpleType to copy construct with.
     * @param[in] param Any value of type <tt>TParam</tt> that can be assigned to
     *                  the SimpleType object.
     *
     * The default constructor initializes the SimpleType object with the value
     * <tt>0</tt> and the copy constructor copies over the value of the SimpleType.
     *
     * When constructing with a <tt>param</tt> that is not a SimpleType then
     * <tt>param</tt> is assigned to the SimpleType object, using @link
     * AssignableConcept#assign assign @endlink. This function can be overloaded
     * differently for each type. You can expect the following behaviour for all
     * SimpleType objects, however:
     *
     * <ul> <li>If <tt>param</tt> is a builtin integer then this value is directly
     * assigned to the @link SimpleType::value value @endlink member of the
     * SimpleType object. Note that this can allow an invalid assignment, e.g., when
     * assigning <tt>42</tt> to a @link Dna @endlink object.</li> <li>If
     * <tt>param</tt> is a <tt>char</tt> then this character value is converted to
     * the appropriate value and written to the @link SimpleType::value value
     * @endlink member. For example, assigning <tt>'A'</tt> or <tt>'a'</tt> to a
     * SimpleType object assigns <tt>0</tt> to the @link SimpleType::value value
     * @endlink member.</li> </ul>
     *
     * @section Example
     *
     * The following example shows construction of a @link Dna @endlink
     * (specialization of SimpleType) object with from <tt>char</tt> and integer
     * values.
     *
     * @snippet demos/dox/basic/simple_type_construction.cpp simple type construction and assignment
     *
     *
     *
     * @var TValue SimpleType::value;
     *
     * @brief The internal value storage of the SimpleType object.
     *
     * @important Do not modify this value directly. SimpleType implements
     * conversion operators for all numeric types, so you can simply assign and cast
     * the SimpleType to all built-in numeric types.
     *
     * Stores the value of the SimpleType, is of type <tt>TValue</tt>. Valid values
     * are from <tt>0</tt> to @link FiniteOrderedAlphabetConcept#ValueSize @endlink
     * minus one.
     */