ModCyclicShape ModifiedIterator - SeqAn API Documentation

# Spec ModCyclicShape ModifiedIterator
Iterates over a string leaving out don't-care-positions defined in CyclicShape.

Extends | ModifiedIterator
All Extended | ModifiedIterator
All Impl'd | BidirectionalIteratorConcept, CopyConstructibleConcept, DefaultConstructibleConcept, EqualityComparableConcept, ForwardIteratorConcept, InputIteratorConcept, IteratorAssociatedTypesConcept, LessThanComparableConcept, RandomAccessIteratorConcept
Defined in | <seqan/modifier.h>
Signature | `template <typename THost, typename TSpec> class ModifiedIterator<THost, ModCyclicShape<CyclicShape<TSpec> > >;`

## Template Parameters

`THost` | The host iterator.
`TSpec` | The specialization of CyclicShape.
`TCargo` | Cargo type of ModCyclicShape
`TSize` | Size type of ModCyclicShape

## Member Function Overview

- `ModifiedIterator::ModifiedIterator();, ModifiedIterator::ModifiedIterator(host);, ModifiedIterator::ModifiedIterator(otherModIter);`
  The constructor.

### Member Functions Inherited From EqualityComparableConcept

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

### Member Functions Inherited From LessThanComparableConcept

- `operator<`

### Member Functions Inherited From RandomAccessIteratorConcept

- `operator[]`

## Interface Function Overview

### Interface Functions Inherited From BidirectionalIteratorConcept

- `operator--(prefix)`
- `operator--(suffix)`
- `goPrevious`

### Interface Functions Inherited From InputIteratorConcept

- `operator++(suffix)`
- `operator++(prefix)`
- `operator->`
- `goNext`

### Interface Functions Inherited From IteratorAssociatedTypesConcept

- `operator*`
- `value`
- `getValue`

### Interface Functions Inherited From RandomAccessIteratorConcept

- `difference`
- `operator+=`
- `operator+`
- `operator-=`
- `goNil`
- `goFurther`
- `atNil`

## Interface Metafunction Overview

- `Cargo<ModifiedIterator<THost, ModCyclicShape<CyclicShape<TSpec> > > >::Type;`
  Cargo of ModCyclicShape ModCyclicShape Modified Iterator and ModCyclicShape Modified String.

### Interface Metafunctions Inherited From IteratorAssociatedTypesConcept

- `Difference`
- `GetValue`
- `Pointer`
- `Reference`
- `Value`

### Interface Metafunctions Inherited From RandomAccessIteratorConcept

- `Difference`

## Member Variable Overview

- `TCargo ModCyclicShapeModifiedIterator::_cargo`
  Copy of a Cargo object, which is a CyclicShape.
- `TSize ModCyclicShapeModifiedIterator::_idx`
  Internal position inside `diffs` of the CylicShape.

## Detailed Description

Note:

ModCyclicShape Modifier should only be used to view/read a sequence, never to change the underlying sequence. Some operations will work, e.g. you can use the `operator*()` of the ModifiedIterator to change a character, but other operations like `replace` or `append` are unsafe or even conceptionally wrong.

Using ModCyclicShape you can mask characters at certain positions of a text. A CylcicShape defines these positions (so called don't-care-positions) and the CyclicShape is repeated till the end of the string. The iterator behaves as if the don't-care-positions had been deleted without actually copying the string.

            typedef ModifiedString<CharString, ModCyclicShape<TShape> > TModString;
            typedef Iterator<TModString>::Type TModIter;
            TModIter it = begin(modStr);
            TModIter itBeg = it;
            TModIter itEnd = end(modStr);

            // output iter position and host iter position
            for (; it != itEnd; ++it)
                std::cout << (it - itBeg) << "/" << (host(it) - begin(str)) << ", ";

            //  0/2, 1/3, 2/4, 3/7, 4/9, 5/13, 6/14, 7/15, 8/18, 9/20, 10/24, 11/25, 12/26,

Snippet from: demos/dox/modifier/cyclic_shape_snippets.cpp

## See Also

- CyclicShape
- ModCyclicShapeModifiedString

## Member Functions Detail

### `ModifiedIterator::ModifiedIterator(); ModifiedIterator::ModifiedIterator(host); ModifiedIterator::ModifiedIterator(otherModIter);`

The constructor.

#### Parameters

`host` | Host iterator to set.
`otherModIter` | ModifiedIterator which may differ in its host type. Copy construction.

The safe way to create this ModifiedIterator is to use the `begin` and `end` functions of the ModifiedString or to copy construct. When directly initialized with a host iterator, the CyclicShape is not yet taken into account and you have to set it up yourself, for example a CyclicShape starting with a 01... will have skip the first position. So you would have to reset the host iterator using `++host(myCyclicShape)`. Use `cargo()` to assign a shape to the iterator.

#### Data Races

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

## Interface Metafunctions Detail

### `Cargo<ModifiedIterator<THost, ModCyclicShape<CyclicShape<TSpec> > > >::Type;`

Cargo of ModCyclicShape ModCyclicShape Modified Iterator and ModCyclicShape Modified String.

#### Template Parameters

`THost` | Host iterator of ModifiedIterator.
`TSpec` | Specialization of CyclicShape.

#### Returns

`Cargo` | type of ModCyclicShape Modified Iterator is the CyclicShape itself.

## Member Variables Detail

### `TCargo ModCyclicShapeModifiedIterator::_cargo`

Copy of a Cargo object, which is a CyclicShape.

The Cargo is a CyclicShape. This can be very heavy in case of GenericCyclicShape, so prefer the lightweight FixedCyclicShape.

### `TSize ModCyclicShapeModifiedIterator::_idx`

Internal position inside `diffs` of the CylicShape.

#### Dox Sources

    /*!
     * @class ModCyclicShapeModifiedIterator ModCyclicShape ModifiedIterator
     *
     * @extends ModifiedIterator
     *
     * @headerfile <seqan/modifier.h>
     *
     * @brief Iterates over a string leaving out don't-care-positions defined in
     *        CyclicShape.
     *
     * @note ModCyclicShape Modifier should only be used to <b>view/read a
     *       sequence</b>, never to change the underlying sequence. Some operations
     *       will work, e.g. you can use the <tt>operator*()</tt> of the
     *       ModifiedIterator to change a character, but other operations like
     *       <tt>replace</tt> or <tt>append</tt> are unsafe or even conceptionally
     *       wrong.
     *
     * @signature template <typename THost, typename TSpec> class
     *            ModifiedIterator<THost, ModCyclicShape<CyclicShape<TSpec> > >;
     *
     * @tparam THost The host iterator.
     * @tparam TSpec The specialization of @link CyclicShape @endlink.
     * @tparam TCargo Cargo type of ModCyclicShape
     * @tparam TSize Size type of ModCyclicShape
     *
     * Using ModCyclicShape you can <i>mask</i> characters at certain positions of a
     * text. A CylcicShape defines these positions (so called don't-care-positions)
     * and the CyclicShape is repeated till the end of the string. The iterator
     * behaves as if the don't-care-positions had been deleted without actually
     * copying the string.
     *
     * @snippet demos/dox/modifier/cyclic_shape_snippets.cpp Define CyclicShape Modified Iterator
     *
     * @see ModCyclicShapeModifiedString
     * @see CyclicShape
     *
     * @mfn ModCyclicShapeModifiedIterator#Cargo
     *
     * @headerfile <seqan/modifier.h>
     *
     * @brief Cargo of ModCyclicShape ModCyclicShape Modified Iterator and
     *        ModCyclicShape Modified String.
     *
     * @signature Cargo<ModifiedIterator<THost, ModCyclicShape<CyclicShape<TSpec> >
     *            > >::Type;
     *
     * @tparam THost Host iterator of ModifiedIterator.
     * @tparam TSpec Specialization of CyclicShape.
     *
     * @return Cargo type of ModCyclicShape Modified Iterator is the CyclicShape
     *               itself.
     *
     * @fn ModCyclicShapeModifiedIterator::ModifiedIterator
     *
     * @brief The constructor.
     *
     * @signature ModifiedIterator::ModifiedIterator();
     * @signature ModifiedIterator::ModifiedIterator(host);
     * @signature ModifiedIterator::ModifiedIterator(otherModIter);
     *
     * @param[in] host Host iterator to set.
     * @param[in] otherModIter ModifiedIterator which may differ in its host type.
     *                         Copy construction.
     *
     * The safe way to create this ModifiedIterator is to use the <tt>begin</tt> and
     * <tt>end</tt> functions of the ModifiedString or to copy construct. When
     * directly initialized with a host iterator, the CyclicShape is not yet taken
     * into account and you have to set it up yourself, for example a CyclicShape
     * starting with a 01... will have skip the first position. So you would have to
     * reset the host iterator using <tt>++host(myCyclicShape)</tt>. Use
     * <tt>cargo()</tt> to assign a shape to the iterator.
     *
     * @var TCargo ModCyclicShapeModifiedIterator::_cargo;
     *
     * @brief Copy of a Cargo object, which is a CyclicShape.
     *
     * The Cargo is a CyclicShape. This can be very heavy in case of
     * GenericCyclicShape, so prefer the lightweight FixedCyclicShape.
     *
     * @var TSize ModCyclicShapeModifiedIterator::_idx;
     *
     * @brief Internal position inside <tt>diffs</tt> of the CylicShape.
     */