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

Member Functions Inherited From AssignableConcept

Member Functions Inherited From ComparableConcept

Member Functions Inherited From EqualityComparableConcept

Member Functions Inherited From LessThanComparableConcept

Member Functions Inherited From OrderedAlphabetConcept

Interface Function Overview

Interface Functions Inherited From AssignableConcept

Interface Functions Inherited From ComparableConcept

Interface Functions Inherited From FiniteOrderedAlphabetConcept

Interface Functions Inherited From OrderedAlphabetConcept

Interface Metafunction Overview

Interface Metafunctions Inherited From AlphabetConcept

Interface Metafunctions Inherited From FiniteOrderedAlphabetConcept

Interface Metafunctions Inherited From OrderedAlphabetConcept

Member Variable Overview

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

Member Functions Detail

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

Constructor of SimpleType type.


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.


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

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

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

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.