Tawara  0.1.0
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
tawara::SeekHead Class Reference

The SeekHead element, used as an index for a Tawara file. More...

#include <tawara/metaseek.h>

Inheritance diagram for tawara::SeekHead:
Inheritance graph
[legend]
Collaboration diagram for tawara::SeekHead:
Collaboration graph
[legend]

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...
 
SeekHeadoperator= (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...
 
- Public Member Functions inherited from tawara::MasterElement
 MasterElement (uint32_t id, bool crc=false)
 Create a new MasterElement. More...
 
virtual ~MasterElement ()
 Destructor. More...
 
- Public Member Functions inherited from tawara::Element
 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...
 
- Protected Member Functions inherited from tawara::Element
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_
 
- Protected Attributes inherited from tawara::Element
tawara::ids::ID id_
 
std::streampos offset_
 

Friends

bool operator== (SeekHead const &lhs, SeekHead const &rhs)
 Equality operator. More...
 

Detailed Description

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.

Member Typedef Documentation

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.

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.

typedef std::multimap<key_type, mapped_type> tawara::SeekHead::storage_type_
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.

Constructor & Destructor Documentation

tawara::SeekHead::SeekHead ( )

Create a new SeekHead element.

Upon creation, the element's index will be empty.

Member Function Documentation

iterator tawara::SeekHead::begin ( )
inline

Get an iterator to the first index entry.

Definition at line 112 of file metaseek.h.

const_iterator tawara::SeekHead::begin ( ) const
inline

Get an iterator to the first index entry.

Definition at line 114 of file metaseek.h.

virtual std::streamsize tawara::SeekHead::body_size ( ) const
protectedvirtual

Get the size of the body of this element.

Implements tawara::Element.

void tawara::SeekHead::clear ( )
inline

Remove all index entries.

Definition at line 144 of file metaseek.h.

size_type tawara::SeekHead::count ( ) const
inline

Get the number of index entries.

Definition at line 139 of file metaseek.h.

bool tawara::SeekHead::empty ( ) const
inline

Check if there are no index entries.

Definition at line 137 of file metaseek.h.

iterator tawara::SeekHead::end ( )
inline

Get an iterator to the position past the last index entry.

Definition at line 118 of file metaseek.h.

const_iterator tawara::SeekHead::end ( ) const
inline

Get an iterator to the position past the last index entry.

Definition at line 122 of file metaseek.h.

void tawara::SeekHead::erase ( iterator  position)
inline

Erase the index entry at the specified iterator.

Parameters
[in]positionThe position to erase at.

Definition at line 168 of file metaseek.h.

void tawara::SeekHead::erase ( iterator  first,
iterator  last 
)
inline

Erase a range of index entries.

Parameters
[in]firstThe start of the range.
[in]lastThe end of the range.

Definition at line 174 of file metaseek.h.

size_type tawara::SeekHead::erase ( key_type const &  id)
inline

Erase all index entries with the given ID.

Parameters
[in]idThe ID to erase.
Returns
The ID of entries erased.

Definition at line 181 of file metaseek.h.

iterator tawara::SeekHead::find ( key_type const &  id)
inline

Search for the index entry with the given ID.

If multiple offsets exist for the ID, the first one inserted will be returned.

Parameters
[in]idThe ID to search for.
Returns
An iterator to the matching offset, or end() if there is no index entry with that ID.

Definition at line 199 of file metaseek.h.

const_iterator tawara::SeekHead::find ( key_type const &  id) const
inline

Search for the index entry with the given ID.

Parameters
[in]idThe ID to search for.
Returns
An iterator to the matching offset, or end() if there is no index entry with that ID.

Definition at line 206 of file metaseek.h.

iterator tawara::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.

Parameters
[in]valueThe offset to insert and its ID.
Returns
The iterator at the position where the offset was added.

Definition at line 155 of file metaseek.h.

void tawara::SeekHead::insert ( const_iterator  first,
const_iterator  last 
)
inline

Insert a range of offsets.

Parameters
[in]firstThe start of the range.
[in]lastThe end of the range.

Definition at line 162 of file metaseek.h.

size_type tawara::SeekHead::max_count ( ) const
inline

Get the maximum number of index entries.

Definition at line 141 of file metaseek.h.

SeekHead& tawara::SeekHead::operator= ( SeekHead const &  other)
inline

Replace the stored offsets with those from another SeekHead element.

Definition at line 108 of file metaseek.h.

reverse_iterator tawara::SeekHead::rbegin ( )
inline

Get a reverse iterator to the last index entry.

Definition at line 124 of file metaseek.h.

const_reverse_iterator tawara::SeekHead::rbegin ( ) const
inline

Get a reverse iterator to the last index entry.

Definition at line 126 of file metaseek.h.

virtual std::streamsize tawara::SeekHead::read_body ( std::istream &  input,
std::streamsize  size 
)
protectedvirtual

Element body loading.

Implements tawara::Element.

reverse_iterator tawara::SeekHead::rend ( )
inline

Get a reverse iterator to the position before the first index entry.

Definition at line 130 of file metaseek.h.

const_reverse_iterator tawara::SeekHead::rend ( ) const
inline

Get a reverse iterator to the position before the first index entry.

Definition at line 134 of file metaseek.h.

void tawara::SeekHead::swap ( SeekHead other)
inline

Swaps the contents of this SeekHead with another.

Parameters
[in]otherThe other SeekHead to swap with.

Definition at line 187 of file metaseek.h.

virtual std::streamsize tawara::SeekHead::write_body ( std::ostream &  output)
protectedvirtual

Element body writing.

Implements tawara::Element.

Friends And Related Function Documentation

bool operator== ( SeekHead const &  lhs,
SeekHead const &  rhs 
)
friend

Equality operator.

Member Data Documentation

storage_type_ tawara::SeekHead::index_
protected

Definition at line 213 of file metaseek.h.


The documentation for this class was generated from the following file: