Tide 0.1.0
|
The SeekHead element, used as an index for a Tide file. More...
#include <tide/metaseek.h>
Public Types | |
typedef ids::ID | key_type |
The key type (Key) of this container. | |
typedef std::streamoff | mapped_type |
The mapped type (T) of this container. | |
typedef storage_type_::value_type | value_type |
The value type of this container. | |
typedef storage_type_::size_type | size_type |
The size type of this container. | |
typedef storage_type_::reference | reference |
The reference type. | |
typedef storage_type_::const_reference | const_reference |
The constant reference type. | |
typedef storage_type_::iterator | iterator |
The random access iterator type. | |
typedef storage_type_::const_iterator | const_iterator |
The constant random access iterator type. | |
typedef storage_type_::reverse_iterator | reverse_iterator |
The reversed random access iterator type. | |
typedef storage_type_::const_reverse_iterator | const_reverse_iterator |
The constant reversed random access iterator type. | |
Public Member Functions | |
SeekHead () | |
Create a new SeekHead element. | |
SeekHead & | operator= (SeekHead const &other) |
Replace the stored offsets with those from another SeekHead element. | |
iterator | begin () |
Get an iterator to the first index entry. | |
const_iterator | begin () const |
Get an iterator to the first index entry. | |
iterator | end () |
Get an iterator to the position past the last index entry. | |
const_iterator | end () const |
Get an iterator to the position past the last index entry. | |
reverse_iterator | rbegin () |
Get a reverse iterator to the last index entry. | |
const_reverse_iterator | rbegin () const |
Get a reverse iterator to the last index entry. | |
reverse_iterator | rend () |
Get a reverse iterator to the position before the first index entry. | |
const_reverse_iterator | rend () const |
Get a reverse iterator to the position before the first index entry. | |
bool | empty () const |
Check if there are no index entries. | |
size_type | count () const |
Get the number of index entries. | |
size_type | max_count () const |
Get the maximum number of index entries. | |
void | clear () |
Remove all index entries. | |
iterator | insert (value_type const &value) |
Insert a new index entry. | |
void | insert (const_iterator first, const_iterator last) |
Insert a range of offsets. | |
void | erase (iterator position) |
Erase the index entry at the specified iterator. | |
void | erase (iterator first, iterator last) |
Erase a range of index entries. | |
size_type | erase (key_type const &id) |
Erase all index entries with the given ID. | |
void | swap (SeekHead &other) |
Swaps the contents of this SeekHead with another. | |
iterator | find (key_type const &id) |
Search for the index entry with the given ID. | |
const_iterator | find (key_type const &id) const |
Search for the index entry with the given ID. | |
Protected Types | |
typedef std::multimap < key_type, mapped_type > | storage_type_ |
The type of the internal storage. | |
Protected Member Functions | |
virtual std::streamsize | body_size () const |
Get the size of the body of this element. | |
virtual std::streamsize | write_body (std::ostream &output) |
Element body writing. | |
virtual std::streamsize | read_body (std::istream &input, std::streamsize size) |
Element body loading. | |
Protected Attributes | |
storage_type_ | index_ |
Friends | |
bool | operator== (SeekHead const &lhs, SeekHead const &rhs) |
Equality operator. |
The SeekHead element, used as an index for a Tide file.
Generally, any Tide segment should contain one, and only one, instance of a SeekHead element. This element should provide the byte offsets in the data stream of the other Level 1 elements (SegmentInfo, Tracks, etc.) in the segment. This function also means that the SeekHead element should be placed first in its segment, so that it can be found quickly to speed up file loading.
When writing Tide files, it is advisable to reserve some space at the start of the segment for the SeekHead element to be written in once the file is complete.
Definition at line 56 of file metaseek.h.
typedef storage_type_::const_iterator tide::SeekHead::const_iterator |
The constant random access iterator type.
Definition at line 87 of file metaseek.h.
typedef storage_type_::const_reference tide::SeekHead::const_reference |
The constant reference type.
Definition at line 83 of file metaseek.h.
typedef storage_type_::const_reverse_iterator tide::SeekHead::const_reverse_iterator |
The constant reversed random access iterator type.
Definition at line 92 of file metaseek.h.
typedef storage_type_::iterator tide::SeekHead::iterator |
The random access iterator type.
Definition at line 85 of file metaseek.h.
typedef ids::ID tide::SeekHead::key_type |
The key type (Key) of this container.
Definition at line 61 of file metaseek.h.
typedef std::streamoff tide::SeekHead::mapped_type |
The mapped type (T) of this container.
Definition at line 63 of file metaseek.h.
typedef storage_type_::reference tide::SeekHead::reference |
The reference type.
Definition at line 81 of file metaseek.h.
typedef storage_type_::reverse_iterator tide::SeekHead::reverse_iterator |
The reversed random access iterator type.
Definition at line 89 of file metaseek.h.
typedef storage_type_::size_type tide::SeekHead::size_type |
The size type of this container.
Definition at line 79 of file metaseek.h.
typedef std::multimap<key_type, mapped_type> tide::SeekHead::storage_type_ [protected] |
The type of the internal storage.
Definition at line 67 of file metaseek.h.
typedef storage_type_::value_type tide::SeekHead::value_type |
The value type of this container.
Definition at line 77 of file metaseek.h.
tide::SeekHead::SeekHead | ( | ) |
Create a new SeekHead element.
Upon creation, the element's index will be empty.
iterator tide::SeekHead::begin | ( | ) | [inline] |
Get an iterator to the first index entry.
Definition at line 101 of file metaseek.h.
const_iterator tide::SeekHead::begin | ( | ) | const [inline] |
Get an iterator to the first index entry.
Definition at line 103 of file metaseek.h.
virtual std::streamsize tide::SeekHead::body_size | ( | ) | const [protected, virtual] |
Get the size of the body of this element.
Implements tide::Element.
void tide::SeekHead::clear | ( | ) | [inline] |
Remove all index entries.
Definition at line 133 of file metaseek.h.
size_type tide::SeekHead::count | ( | ) | const [inline] |
Get the number of index entries.
Definition at line 128 of file metaseek.h.
bool tide::SeekHead::empty | ( | ) | const [inline] |
Check if there are no index entries.
Definition at line 126 of file metaseek.h.
const_iterator tide::SeekHead::end | ( | ) | const [inline] |
Get an iterator to the position past the last index entry.
Definition at line 111 of file metaseek.h.
iterator tide::SeekHead::end | ( | ) | [inline] |
Get an iterator to the position past the last index entry.
Definition at line 107 of file metaseek.h.
void tide::SeekHead::erase | ( | iterator | position | ) | [inline] |
Erase the index entry at the specified iterator.
[in] | position | The position to erase at. |
Definition at line 157 of file metaseek.h.
Erase a range of index entries.
[in] | first | The start of the range. |
[in] | last | The end of the range. |
Definition at line 163 of file metaseek.h.
Erase all index entries with the given ID.
[in] | id | The ID to erase. |
Definition at line 170 of file metaseek.h.
const_iterator tide::SeekHead::find | ( | key_type const & | id | ) | const [inline] |
Search for the index entry with the given ID.
[in] | id | The ID to search for. |
Definition at line 195 of file metaseek.h.
Search for the index entry with the given ID.
If multiple offsets exist for the ID, the first one inserted will be returned.
[in] | id | The ID to search for. |
Definition at line 188 of file metaseek.h.
iterator tide::SeekHead::insert | ( | value_type const & | value | ) | [inline] |
Insert a new index entry.
If an index entry already exists with the same ID, the new offset is entered into the index after it. No index entries are overwritten.
[in] | value | The offset to insert and its ID. |
Definition at line 144 of file metaseek.h.
void tide::SeekHead::insert | ( | const_iterator | first, |
const_iterator | last | ||
) | [inline] |
Insert a range of offsets.
[in] | first | The start of the range. |
[in] | last | The end of the range. |
Definition at line 151 of file metaseek.h.
size_type tide::SeekHead::max_count | ( | ) | const [inline] |
Get the maximum number of index entries.
Definition at line 130 of file metaseek.h.
Replace the stored offsets with those from another SeekHead element.
Definition at line 97 of file metaseek.h.
const_reverse_iterator tide::SeekHead::rbegin | ( | ) | const [inline] |
Get a reverse iterator to the last index entry.
Definition at line 115 of file metaseek.h.
reverse_iterator tide::SeekHead::rbegin | ( | ) | [inline] |
Get a reverse iterator to the last index entry.
Definition at line 113 of file metaseek.h.
virtual std::streamsize tide::SeekHead::read_body | ( | std::istream & | input, |
std::streamsize | size | ||
) | [protected, virtual] |
Element body loading.
Implements tide::Element.
const_reverse_iterator tide::SeekHead::rend | ( | ) | const [inline] |
Get a reverse iterator to the position before the first index entry.
Definition at line 123 of file metaseek.h.
reverse_iterator tide::SeekHead::rend | ( | ) | [inline] |
Get a reverse iterator to the position before the first index entry.
Definition at line 119 of file metaseek.h.
void tide::SeekHead::swap | ( | SeekHead & | other | ) | [inline] |
Swaps the contents of this SeekHead with another.
[in] | other | The other SeekHead to swap with. |
Definition at line 176 of file metaseek.h.
virtual std::streamsize tide::SeekHead::write_body | ( | std::ostream & | output | ) | [protected, virtual] |
Element body writing.
Implements tide::Element.
storage_type_ tide::SeekHead::index_ [protected] |
Definition at line 202 of file metaseek.h.