# Spec JournaledString
Journaled versions of arbitrary underlying strings.

Extends | String
All Extended | String
All Impl'd | AssignableConcept, ContainerConcept, DestructibleConcept, ForwardContainerConcept, RandomAccessContainerConcept, ReversibleContainerConcept, SegmentableConcept, StringConcept, TextConcept
Defined in | <seqan/sequence_journaled.h>
Signature | `template <typename TValue, typename THostSpec[, typename TJournalSpec[, typename TBufferSpec]]> class String<TValue, Journaled<THostSpec, TJournalSpec, TBufferSpec> >;`

## Template Parameters

`TValue` | The element type of the string.
`THostSpec` | Specialization type for the host string.
`TJournalSpec` | Specialization type for the journal. Default: `SortedArray`.
`TBufferSpec` | Specialization type for the buffer string. Default: `Alloc<>`.

## Member Function Overview

### Member Functions Inherited From String

- `operator=`
- `String`

### Member Functions Inherited From AssignableConcept

- `operator=`

### Member Functions Inherited From RandomAccessContainerConcept

- `operator[]`

## Interface Function Overview

- `void clear(js);`
  Remove all changes from the journal, resetting the JournaledString to its state after construction.
- `void flatten(js);`
  Apply the journal to the underlying string, modifying the underlying string.
- `THost host(js);`
  Return the host of a JournaledString.
- `TPos hostToVirtualPosition(js, pos);`
  Translates host position to virtual position.
- `bool isFlat(js);`
  Returns whether a JournaledString has modifications.
- `void setHost(js, str);`
  Set the host of a JournaledString.
- `TPos virtualToHostPosition(js, pos);`
  Translates virtual (view) position to position in host.

### Interface Functions Inherited From String

- `beginPosition`
- `endPosition`
- `reserve`
- `resizeSpace`
- `toCString`

### Interface Functions Inherited From AssignableConcept

- `assign`
- `set`
- `move`

### Interface Functions Inherited From ContainerConcept

- `begin`
- `end`
- `length`
- `empty`
- `swap`
- `writeValue`
- `write`
- `getObjectId`
- `moveValue`
- `append`
- `appendValue`
- `shrinkToFit`
- `directionIterator`

### Interface Functions Inherited From RandomAccessContainerConcept

- `value`
- `assignValue`
- `getValue`

### Interface Functions Inherited From SegmentableConcept

- `prefix`
- `infixWithLength`
- `infix`
- `suffix`

### Interface Functions Inherited From StringConcept

- `iter`
- `append`
- `appendValue`
- `front`
- `back`
- `resize`
- `clear`
- `erase`
- `eraseFront`
- `eraseBack`
- `capacity`
- `computeGenerousCapacity`
- `insert`
- `insertValue`
- `replace`

### Interface Functions Inherited From TextConcept

- `stringSetLimits`
- `posLocalToX`
- `posLocalize`
- `posGlobalize`
- `getSeqNo`
- `getSeqOffset`

## Interface Metafunction Overview

- `Host<TJournaledString>::Type;`
  The host type.
- `InsertionBuffer<TJournaledString>::Type;`
  Return type of insertion buffer string for a journaled string.
- `JournalType<TJournaledString>::Type;`
  Query a JournaledString for its journal type.

### Interface Metafunctions Inherited From ContainerConcept

- `DefaultGetIteratorSpec`
- `DefaultIteratorSpec`
- `Difference`
- `DirectionIterator`
- `GetValue`
- `Iterator`
- `Position`
- `Reference`
- `Size`
- `Value`

### Interface Metafunctions Inherited From SegmentableConcept

- `Infix`
- `Prefix`
- `Suffix`

### Interface Metafunctions Inherited From TextConcept

- `SAValue`
- `StringSetLimits`

## Interface Functions Detail

### `void clear(js);`

Remove all changes from the journal, resetting the JournaledString to its state after construction.

#### Parameters

`js` | The JournaledString to clear.

#### Data Races

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

### `void flatten(js);`

Apply the journal to the underlying string, modifying the underlying string.

#### Parameters

`js` | The JournaledString to flatten.

#### Data Races

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

### `THost host(js);`

Return the host of a JournaledString.

#### Parameters

`js` | The JournaledString to query.

#### Returns

`THost` | Reference to the host of `js`.

#### Data Races

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

### `TPos hostToVirtualPosition(js, pos);`

Translates host position to virtual position.

#### Parameters

`js` | The JournaledString to translate the position for.
`pos` | The host position to translate.

#### Returns

`TPos` | The virtual view position. Note the returned position equates to length of the journaled string if `pos` is greater or equal the length of the underlying host.

#### Data Races

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

### `bool isFlat(js);`

Returns whether a JournaledString has modifications.

#### Parameters

`js` | The JournaledString to query.

#### Returns

`bool` | Indicates whether the string has been modified.

#### Data Races

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

### `void setHost(js, str);`

Set the host of a JournaledString.

#### Parameters

`js` | The JournaledString to set the host for.
`str` | The string to set as the host.

#### Data Races

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

### `TPos virtualToHostPosition(js, pos);`

Translates virtual (view) position to position in host.

#### Parameters

`js` | The JournaledString to translate the position for.
`pos` | The virtual position to translate.

#### Returns

`TPos` | Position in the host.

#### Data Races

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

## Interface Metafunctions Detail

### `Host<TJournaledString>::Type;`

The host type.

#### Template Parameters

`TJournaledString` | The JournaldString to get the host type for.

#### Returns

`Type` | The host type.

### `InsertionBuffer<TJournaledString>::Type;`

Return type of insertion buffer string for a journaled string.

#### Template Parameters

`TJournaledString` | The journaled string to get the insertion buffer type for.

#### Returns

`Type` | The insertion buffer type.

### `JournalType<TJournaledString>::Type;`

Query a JournaledString for its journal type.

#### Template Parameters

`TJournaledString` | The JournaledString to query.

#### Returns

`Type` | the journal type.

#### Dox Sources

    /*!
     * @class JournaledString
     *
     * @extends String
     *
     * @headerfile <seqan/sequence_journaled.h>
     *
     * @brief Journaled versions of arbitrary underlying strings.
     *
     * @signature template <typename TValue, typename THostSpec[, typename
     *            TJournalSpec[, typename TBufferSpec]]> class String<TValue,
     *            Journaled<THostSpec, TJournalSpec, TBufferSpec> >;
     *
     * @tparam TValue The element type of the string.
     * @tparam THostSpec Specialization type for the host string.
     * @tparam TJournalSpec Specialization type for the journal. Default:
     *                      <tt>SortedArray</tt>.
     * @tparam TBufferSpec Specialization type for the buffer string. Default:
     *                     <tt>Alloc&lt;&gt;</tt>.
     *
     * @mfn JournaledString#Host
     *
     * @brief The host type.
     *
     * @signature Host<TJournaledString>::Type;
     *
     * @tparam TJournaledString The JournaldString to get the host type for.
     *
     * @return Type The host type.
     *
     * @mfn JournaledString#InsertionBuffer
     *
     * @brief Return type of insertion buffer string for a journaled string.
     *
     * @signature InsertionBuffer<TJournaledString>::Type;
     *
     * @tparam TJournaledString The journaled string to get the insertion buffer
     *                          type for.
     *
     * @return Type The insertion buffer type.
     *
     * @mfn JournaledString#JournalType
     *
     * @brief Query a JournaledString for its journal type.
     *
     * @signature JournalType<TJournaledString>::Type;
     *
     * @tparam TJournaledString The JournaledString to query.
     *
     * @return Type the journal type.
     *
     * @fn JournaledString#setHost
     *
     * @brief Set the host of a JournaledString.
     *
     * @signature void setHost(js, str);
     *
     * @param[in,out] js The JournaledString to set the host for.
     * @param[in] str The string to set as the host.
     *
     * @fn JournaledString#host
     *
     * @brief Return the host of a JournaledString.
     *
     * @signature THost host(js);
     *
     * @param[in] js The JournaledString to query.
     *
     * @return THost Reference to the host of <tt>js</tt>.
     *
     * @fn JournaledString#clear
     *
     * @brief Remove all changes from the journal, resetting the JournaledString to
     *        its state after construction.
     *
     * @signature void clear(js);
     *
     * @param[in,out] js The JournaledString to clear.
     *
     * @fn JournaledString#flatten
     *
     * @brief Apply the journal to the underlying string, modifying the underlying
     *        string.
     *
     * @signature void flatten(js);
     *
     * @param[in,out] js The JournaledString to flatten.
     *
     * @fn JournaledString#virtualToHostPosition
     *
     * @brief Translates virtual (view) position to position in host.
     *
     * @signature TPos virtualToHostPosition(js, pos);
     *
     * @param[in] js The JournaledString to translate the position for.
     * @param[in] pos The virtual position to translate.
     *
     * @return TPos Position in the host.
     *
     * @fn JournaledString#hostToVirtualPosition
     *
     * @brief Translates host position to virtual position.
     *
     * @signature TPos hostToVirtualPosition(js, pos);
     *
     * @param[in] js The JournaledString to translate the position for.
     * @param[in] pos The host position to translate.
     *
     * @return TPos The virtual view position. Note the returned position equates to
     *              length of the journaled string if <tt>pos</tt> is greater or
     *              equal the length of the underlying host.
     *
     * @fn JournaledString#isFlat
     *
     * @brief Returns whether a JournaledString has modifications.
     *
     * @signature bool isFlat(js);
     *
     * @param[in] js The JournaledString to query.
     *
     * @return bool Indicates whether the string has been modified.
     */