Spec
ModCyclicShape ModifiedIteratorIterates 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
Member Functions Inherited From LessThanComparableConcept
Member Functions Inherited From RandomAccessIteratorConcept
Interface Function Overview
Interface Functions Inherited From BidirectionalIteratorConcept
Interface Functions Inherited From InputIteratorConcept
Interface Functions Inherited From IteratorAssociatedTypesConcept
Interface Functions Inherited From RandomAccessIteratorConcept
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
Interface Metafunctions Inherited From RandomAccessIteratorConcept
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
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,
See Also
Member Functions Detail
ModifiedIterator::ModifiedIterator();
ModifiedIterator::ModifiedIterator(host);
ModifiedIterator::ModifiedIterator(otherModIter);
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.
Member Variables Detail
TCargo ModCyclicShapeModifiedIterator::_cargo
The Cargo is a CyclicShape. This can be very heavy in case of GenericCyclicShape, so prefer the lightweight FixedCyclicShape.