SAValue - SeqAn API Documentation

# Fn<> SAValue
The default alphabet type of a suffix array, i.e. the type to store a position of a string or string set.

Defined in | <seqan/index.h>
Signature | `SAValue<TObject>::Type;`

## Template Parameters

`TObject` | A string, string set, or index type. Types: String, StringSet, Index

## Return Values

`TReturn` | A type to store a position.If `TObject` is a String, it is a single integer value. By default this is the Size type of `TObject`.If `TObject` is a StringSet, it could be a single integer too (called global position, see ConcatDirectStringSet) or a Pair (called local position, see OwnerStringSet). Currently SeqAn defaults to a local position for StringSet classes (index_base.h).

## Detailed Description

Note:

If `TObject` is an Index, Position returns the same value as `SAValue`. You can change the position type of an index by overloading `SAValue`, not Position.

SAValue is the return type of various functions, e.g. position for the Index Finder class, getOccurrence, getOccurrences, getOccurrences etc. You should always use the type of this meta-function to store the return values. If you want to write algorithms for both variants (local and global positions) you should use the functions posLocalize, posGlobalize, getSeqNo and getSeqOffset.

### Examples

The following code snippet demonstrates the usage of SAValue.

    template < typename TString, typename TSpec >
    struct SAValue< StringSet<TString, TSpec> > {
        typedef Pair<
            typename Size< StringSet<TString, TSpec> >::Type,
            typename SAValue<TString>::Type,
            Pack
        > Type;
    };

## See Also

- orderOccurrences

#### Dox Sources

    /*!
     * @mfn SAValue
     *
     * @headerfile <seqan/index.h>
     *
     * @brief The default alphabet type of a suffix array, i.e. the type to store a
     *        position of a string or string set.
     *
     * @note If <tt>TObject</tt> is an @link Index @endlink, @link Position @endlink
     *       returns the same value as <tt>SAValue</tt>. You can change the position
     *       type of an index by overloading <tt>SAValue</tt>, not @link Position
     *       @endlink.
     *
     * @signature SAValue<TObject>::Type;
     *
     * @tparam TObject A string, string set, or index type. Types: @link String
     *                 @endlink, @link StringSet @endlink, @link Index @endlink
     *
     * @return TReturn A type to store a position.If <tt>TObject</tt> is a @link
     *                 String @endlink, it is a single integer value. By default
     *                 this is the @link Size @endlink type of <tt>TObject</tt>.If
     *                 <tt>TObject</tt> is a @link StringSet @endlink, it could be a
     *                 single integer too (called global position, see @link
     *                 ConcatDirectStringSet @endlink) or a @link Pair @endlink
     *                 (called local position, see @link OwnerStringSet @endlink).
     *                 Currently SeqAn defaults to a local position for @link
     *                 StringSet @endlink classes (index_base.h).
     *
     * SAValue is the return type of various functions, e.g. @link Finder#position
     * @endlink for the Index @link Finder @endlink class, @link
     * VSTreeIterator#getOccurrence @endlink, @link VSTreeIterator#getOccurrences
     * @endlink, @link IndexQGram#getOccurrences @endlink etc. You should always use
     * the type of this meta-function to store the return values. If you want to
     * write algorithms for both variants (local and global positions) you should
     * use the functions @link TextConcept#posLocalize @endlink, @link
     * TextConcept#posGlobalize @endlink, @link TextConcept#getSeqNo @endlink and
     * @link TextConcept#getSeqOffset @endlink.
     *
     * @section Examples
     *
     * The following code snippet demonstrates the usage of @link SAValue @endlink.
     *
     * @code{.cpp}
     * template < typename TString, typename TSpec >
     * struct SAValue< StringSet<TString, TSpec> > {
     *     typedef Pair<
     *         typename Size< StringSet<TString, TSpec> >::Type,
     *         typename SAValue<TString>::Type,
     *         Pack
     *     > Type;
     * };
     * @endcode
     *
     *
     * @see orderOccurrences
     */