Tawara
0.1.0
|
The SeekHead element, used as an index for a Tawara file. More...
#include <tawara/metaseek.h>
Public Types | |
typedef ids::ID | key_type |
The key type (Key) of this container. More... | |
typedef std::streamoff | mapped_type |
The mapped type (T) of this container. More... | |
typedef storage_type_::value_type | value_type |
The value type of this container. More... | |
typedef storage_type_::size_type | size_type |
The size type of this container. More... | |
typedef storage_type_::reference | reference |
The reference type. More... | |
typedef storage_type_::const_reference | const_reference |
The constant reference type. More... | |
typedef storage_type_::iterator | iterator |
The random access iterator type. More... | |
typedef storage_type_::const_iterator | const_iterator |
The constant random access iterator type. More... | |
typedef storage_type_::reverse_iterator | reverse_iterator |
The reversed random access iterator type. More... | |
typedef storage_type_::const_reverse_iterator | const_reverse_iterator |
The constant reversed random access iterator type. More... | |
Public Member Functions | |
SeekHead () | |
Create a new SeekHead element. More... | |
SeekHead & | operator= (SeekHead const &other) |
Replace the stored offsets with those from another SeekHead element. More... | |
iterator | begin () |
Get an iterator to the first index entry. More... | |
const_iterator | begin () const |
Get an iterator to the first index entry. More... | |
iterator | end () |
Get an iterator to the position past the last index entry. More... | |
const_iterator | end () const |
Get an iterator to the position past the last index entry. More... | |
reverse_iterator | rbegin () |
Get a reverse iterator to the last index entry. More... | |
const_reverse_iterator | rbegin () const |
Get a reverse iterator to the last index entry. More... | |
reverse_iterator | rend () |
Get a reverse iterator to the position before the first index entry. More... | |
const_reverse_iterator | rend () const |
Get a reverse iterator to the position before the first index entry. More... | |
bool | empty () const |
Check if there are no index entries. More... | |
size_type | count () const |
Get the number of index entries. More... | |
size_type | max_count () const |
Get the maximum number of index entries. More... | |
void | clear () |
Remove all index entries. More... | |
iterator | insert (value_type const &value) |
Insert a new index entry. More... | |
void | insert (const_iterator first, const_iterator last) |
Insert a range of offsets. More... | |
void | erase (iterator position) |
Erase the index entry at the specified iterator. More... | |
void | erase (iterator first, iterator last) |
Erase a range of index entries. More... | |
size_type | erase (key_type const &id) |
Erase all index entries with the given ID. More... | |
void | swap (SeekHead &other) |
Swaps the contents of this SeekHead with another. More... | |
iterator | find (key_type const &id) |
Search for the index entry with the given ID. More... | |
const_iterator | find (key_type const &id) const |
Search for the index entry with the given ID. More... | |
![]() | |
MasterElement (uint32_t id, bool crc=false) | |
Create a new MasterElement. More... | |
virtual | ~MasterElement () |
Destructor. More... | |
![]() | |
Element (tawara::ids::ID id) | |
Create a new Element. More... | |
virtual | ~Element () |
Destructor. More... | |
uint32_t | id () const |
Get the element's ID. More... | |
std::streampos | offset () const |
Get the element's offset in the byte stream. More... | |
virtual std::streamsize | size () const |
Get the total size of the element. More... | |
virtual std::streamsize | write (std::ostream &output) |
Element writing. More... | |
virtual std::streamsize | read (std::istream &input) |
Element reading. More... | |
Protected Types | |
typedef std::multimap < key_type, mapped_type > | storage_type_ |
The type of the internal storage. More... | |
Protected Member Functions | |
virtual std::streamsize | body_size () const |
Get the size of the body of this element. More... | |
virtual std::streamsize | write_body (std::ostream &output) |
Element body writing. More... | |
virtual std::streamsize | read_body (std::istream &input, std::streamsize size) |
Element body loading. More... | |
![]() | |
std::streamsize | write_id (std::ostream &output) |
Element ID writing. More... | |
virtual std::streamsize | write_size (std::ostream &output) |
Element size writing. More... | |
Protected Attributes | |
storage_type_ | index_ |
![]() | |
tawara::ids::ID | id_ |
std::streampos | offset_ |
Friends | |
bool | operator== (SeekHead const &lhs, SeekHead const &rhs) |
Equality operator. More... | |
The SeekHead element, used as an index for a Tawara file.
Generally, any Tawara 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 Tawara 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 67 of file metaseek.h.
typedef storage_type_::const_iterator tawara::SeekHead::const_iterator |
The constant random access iterator type.
Definition at line 98 of file metaseek.h.
typedef storage_type_::const_reference tawara::SeekHead::const_reference |
The constant reference type.
Definition at line 94 of file metaseek.h.
typedef storage_type_::const_reverse_iterator tawara::SeekHead::const_reverse_iterator |
The constant reversed random access iterator type.
Definition at line 103 of file metaseek.h.
typedef storage_type_::iterator tawara::SeekHead::iterator |
The random access iterator type.
Definition at line 96 of file metaseek.h.
typedef ids::ID tawara::SeekHead::key_type |
The key type (Key) of this container.
Definition at line 72 of file metaseek.h.
typedef std::streamoff tawara::SeekHead::mapped_type |
The mapped type (T) of this container.
Definition at line 74 of file metaseek.h.
typedef storage_type_::reference tawara::SeekHead::reference |
The reference type.
Definition at line 92 of file metaseek.h.
typedef storage_type_::reverse_iterator tawara::SeekHead::reverse_iterator |
The reversed random access iterator type.
Definition at line 100 of file metaseek.h.
typedef storage_type_::size_type tawara::SeekHead::size_type |
The size type of this container.
Definition at line 90 of file metaseek.h.
|
protected |
The type of the internal storage.
Definition at line 78 of file metaseek.h.
typedef storage_type_::value_type tawara::SeekHead::value_type |
The value type of this container.
Definition at line 88 of file metaseek.h.
tawara::SeekHead::SeekHead | ( | ) |
Create a new SeekHead element.
Upon creation, the element's index will be empty.
|
inline |
Get an iterator to the first index entry.
Definition at line 112 of file metaseek.h.
|
inline |
Get an iterator to the first index entry.
Definition at line 114 of file metaseek.h.
|
protectedvirtual |
Get the size of the body of this element.
Implements tawara::Element.
|
inline |
Remove all index entries.
Definition at line 144 of file metaseek.h.
|
inline |
Get the number of index entries.
Definition at line 139 of file metaseek.h.
|
inline |
Check if there are no index entries.
Definition at line 137 of file metaseek.h.
|
inline |
Get an iterator to the position past the last index entry.
Definition at line 118 of file metaseek.h.
|
inline |
Get an iterator to the position past the last index entry.
Definition at line 122 of file metaseek.h.
|
inline |
Erase the index entry at the specified iterator.
[in] | position | The position to erase at. |
Definition at line 168 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 174 of file metaseek.h.
Erase all index entries with the given ID.
[in] | id | The ID to erase. |
Definition at line 181 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 199 of file metaseek.h.
|
inline |
Search for the index entry with the given ID.
[in] | id | The ID to search for. |
Definition at line 206 of file metaseek.h.
|
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 155 of file metaseek.h.
|
inline |
Insert a range of offsets.
[in] | first | The start of the range. |
[in] | last | The end of the range. |
Definition at line 162 of file metaseek.h.
|
inline |
Get the maximum number of index entries.
Definition at line 141 of file metaseek.h.
Replace the stored offsets with those from another SeekHead element.
Definition at line 108 of file metaseek.h.
|
inline |
Get a reverse iterator to the last index entry.
Definition at line 124 of file metaseek.h.
|
inline |
Get a reverse iterator to the last index entry.
Definition at line 126 of file metaseek.h.
|
protectedvirtual |
Element body loading.
Implements tawara::Element.
|
inline |
Get a reverse iterator to the position before the first index entry.
Definition at line 130 of file metaseek.h.
|
inline |
Get a reverse iterator to the position before the first index entry.
Definition at line 134 of file metaseek.h.
|
inline |
Swaps the contents of this SeekHead with another.
[in] | other | The other SeekHead to swap with. |
Definition at line 187 of file metaseek.h.
|
protectedvirtual |
Element body writing.
Implements tawara::Element.
|
protected |
Definition at line 213 of file metaseek.h.