# Class BamIOContext
The I/O context to use for BAM I/O.

Defined in | <seqan/bam_io.h>
Signature | `template <typename TNameStore[, typename TNameStoreCache]> class BamIOContext;`

## Template Parameters

`TNameStore` | The type used to represent the names.
`TNameStoreCache` | The type used to cache the names. Defaults to NameStoreCache <TNameStore>l;.

## Member Function Overview

- `BamIOContext::BamIOContext();, BamIOContext::BamIOContext(contigNameStore, contigNamesStoreCache);`
  Constructor.

## Interface Function Overview

- `TLengthStoreRef contigLengths(context);`
  Return reference to contig lengths from BamIOContext.
- `TNameStoreRef contigNames(context);`
  Return reference to contig names from BamIOContext.
- `TNameStoreCacheRef contigNamesCache(context);`
  Return reference to contig names cache from BamIOContext.

## Detailed Description

BamIOContext objects store the names of (and provide a cache for) reference contig names.

### Examples

Creating a BamIOContext for a raw StringSet of CharString.

    StringSet<CharString> contigNames;
    NameStoreCache<StringSet<CharString> > contigNamesCache(contigNames);
    BamIOContext<StringSet<CharString> > bamIOContext(contigNames, contigNamesCache);
    // ...

Using a BamIOContext with a FragmentStore.

    typedef FragmentStore<>::TContigNameStore         TNameStore;
    typedef NameStoreCache<TNameStore>                TNameStoreCache;
    FragmentStore<> store;
    // Optionally, do something with store.
    typedef BamIOContext<TNameStore, TNameStoreCache> TBamIOContext;
    TBamIOContext bamIOContext(store.contigNameStore, store.contigNameStoreCache);
    // ...

## Member Functions Detail

### `BamIOContext::BamIOContext(); BamIOContext::BamIOContext(contigNameStore, contigNamesStoreCache);`

Constructor.

Default constructor or construction with references to sequence and sample names.

#### Data Races

Thread safety unknown!

## Interface Functions Detail

### `TLengthStoreRef contigLengths(context);`

Return reference to contig lengths from BamIOContext.

#### Parameters

`context` | The BamIOContext to query.

#### Returns

`TLengthStoreRef` | A reference to the `TLengthStore` of the context.

#### Data Races

Thread safety unknown!

### `TNameStoreRef contigNames(context);`

Return reference to contig names from BamIOContext.

#### Parameters

`context` | The BamIOContext to query.

#### Returns

`TNameStoreRef` | A reference to the `TNameStore` of the context.

#### Data Races

Thread safety unknown!

### `TNameStoreCacheRef contigNamesCache(context);`

Return reference to contig names cache from BamIOContext.

#### Parameters

`context` | The BamIOContext to query.

#### Returns

`TNameStoreCacheRef` | A reference to the `TNameStoreCache` of the context.

#### Data Races

Thread safety unknown!

#### Dox Sources

    /*!
     * @class BamIOContext
     *
     * @headerfile <seqan/bam_io.h>
     *
     * @brief The I/O context to use for BAM I/O.
     *
     * @signature template <typename TNameStore[, typename TNameStoreCache]> class
     *            BamIOContext;
     *
     * @tparam TNameStore The type used to represent the names.
     * @tparam TNameStoreCache The type used to cache the names. Defaults to @link
     *                         NameStoreCache @endlink &lt;TNameStore&gtl;.
     *
     * BamIOContext objects store the names of (and provide a cache for) reference
     * contig names.
     *
     * @section Examples
     *
     * Creating a @link BamIOContext @endlink for a raw @link StringSet @endlink of
     * @link CharString @endlink.
     *
     * @code{.cpp}
     * StringSet<CharString> contigNames;
     * NameStoreCache<StringSet<CharString> > contigNamesCache(contigNames);
     * BamIOContext<StringSet<CharString> > bamIOContext(contigNames, contigNamesCache);
     * // ...
     * @endcode
     *
     *
     * Using a @link BamIOContext @endlink with a @link FragmentStore @endlink.
     *
     * @code{.cpp}
     * typedef FragmentStore<>::TContigNameStore         TNameStore;
     * typedef NameStoreCache<TNameStore>                TNameStoreCache;
     * FragmentStore<> store;
     * // Optionally, do something with store.
     * typedef BamIOContext<TNameStore, TNameStoreCache> TBamIOContext;
     * TBamIOContext bamIOContext(store.contigNameStore, store.contigNameStoreCache);
     * // ...
     * @endcode
     *
     *
     * @fn BamIOContext::BamIOContext
     *
     * @headerfile <seqan/bam_io.h>
     *
     * @brief Constructor.
     *
     * @signature BamIOContext::BamIOContext();
     * @signature BamIOContext::BamIOContext(contigNameStore,
     *            contigNamesStoreCache);
     *
     * Default constructor or construction with references to sequence and sample
     * names.
     *
     * @fn BamIOContext#contigNames
     *
     * @brief Return reference to contig names from @link BamIOContext @endlink.
     *
     * @signature TNameStoreRef contigNames(context);
     *
     * @param[in] context The @link BamIOContext @endlink to query.
     *
     * @return TNameStoreRef A reference to the <tt>TNameStore</tt> of the context.
     *
     * @fn BamIOContext#contigLengths
     *
     * @brief Return reference to contig lengths from @link BamIOContext @endlink.
     *
     * @signature TLengthStoreRef contigLengths(context);
     *
     * @param[in] context The @link BamIOContext @endlink to query.
     *
     * @return TLengthStoreRef A reference to the <tt>TLengthStore</tt> of the
     *                         context.
     *
     * @fn BamIOContext#contigNamesCache
     *
     * @brief Return reference to contig names cache from @link BamIOContext
     *        @endlink.
     *
     * @signature TNameStoreCacheRef contigNamesCache(context);
     *
     * @param[in] context The @link BamIOContext @endlink to query.
     *
     * @return TNameStoreCacheRef A reference to the <tt>TNameStoreCache</tt> of the
     *                            context.
     */