Tide 0.1.0
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | Friends

tide::Tracks Class Reference

The Tracks element, listing all tracks in the segment. More...

#include <tide/tracks.h>

Inheritance diagram for tide::Tracks:
Inheritance graph
[legend]
Collaboration diagram for tide::Tracks:
Collaboration graph
[legend]

List of all members.

Public Types

typedef uint64_t key_type
 The key type (Key) of this container.
typedef TrackEntry::Ptr 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

 Tracks ()
 Construct a new Tracks element.
virtual ~Tracks ()
 Destructor.
Tracksoperator= (Tracks const &other)
 Replace the stored TrackEntries with those from another Tracks element.
mapped_typeat (key_type const &pos)
 Get the TrackEntry with the given track number.
mapped_type const & at (key_type const &pos) const
 Get the TrackEntry with the given track number.
mapped_typeoperator[] (key_type const &key)
 Gets a reference to the TrackEntry with the given track number.
mapped_type const & operator[] (key_type const &key) const
 Gets a reference to the TrackEntry with the given track number.
iterator begin ()
 Get an iterator to the first TrackEntry.
const_iterator begin () const
 Get an iterator to the first TrackEntry.
iterator end ()
 Get an iterator to the position past the last TrackEntry.
const_iterator end () const
 Get an iterator to the position past the last TrackEntry.
reverse_iterator rbegin ()
 Get a reverse iterator to the last TrackEntry.
const_reverse_iterator rbegin () const
 Get a reverse iterator to the last TrackEntry.
reverse_iterator rend ()
 Get a reverse iterator to the position before the first TrackEntry.
const_reverse_iterator rend () const
 Get a reverse iterator to the position before the first TrackEntry.
bool empty () const
 Check if there are no TrackElements.
size_type count () const
 Get the number of TrackElements.
size_type max_count () const
 Get the maximum number of TrackElements.
void clear ()
 Remove all TrackElements.
std::pair< iterator, bool > insert (mapped_type const &value)
 Insert a new TrackElement.
void insert (const_iterator first, const_iterator last)
 Insert a range of TrackElements.
void erase (iterator position)
 Erase the TrackEntry at the specified iterator.
void erase (iterator first, iterator last)
 Erase a range of TrackEntries.
size_type erase (key_type const &number)
 Erase the TrackEntry with the given track number.
void swap (Tracks &other)
 Swaps the contents of this Tracks element with another.
iterator find (key_type const &number)
 Search for the TrackEntry with the given track number.
const_iterator find (key_type const &number) const
 Search for the TrackEntry with the given track number.
virtual std::streamsize write_body (std::ostream &output)
 Element body writing.

Protected Types

typedef std::map< 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 read_body (std::istream &input, std::streamsize size)
 Element body loading.
void validate_entries () const
 Checks for duplicate track numbers and UIDs.
void verify_not_duplicate (TrackEntry::Ptr entry) const
 Looks for a duplicate track entry, throws an exception if it is.

Protected Attributes

storage_type_ entries_
 The track entry store.

Friends

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

Detailed Description

The Tracks element, listing all tracks in the segment.

The Tracks element contains the list of tracks that have data in the segment. Each track is represented by a TrackEntry element, and each has a number and a UID. The numbers and UIDs must be unique within the segment, and UIDs should be as unique as possible.

Definition at line 50 of file tracks.h.


Member Typedef Documentation

typedef storage_type_::const_iterator tide::Tracks::const_iterator

The constant random access iterator type.

Definition at line 85 of file tracks.h.

typedef storage_type_::const_reference tide::Tracks::const_reference

The constant reference type.

Definition at line 81 of file tracks.h.

typedef storage_type_::const_reverse_iterator tide::Tracks::const_reverse_iterator

The constant reversed random access iterator type.

Definition at line 90 of file tracks.h.

typedef storage_type_::iterator tide::Tracks::iterator

The random access iterator type.

Definition at line 83 of file tracks.h.

typedef uint64_t tide::Tracks::key_type

The key type (Key) of this container.

Definition at line 55 of file tracks.h.

The mapped type (T) of this container.

Definition at line 57 of file tracks.h.

typedef storage_type_::reference tide::Tracks::reference

The reference type.

Definition at line 79 of file tracks.h.

typedef storage_type_::reverse_iterator tide::Tracks::reverse_iterator

The reversed random access iterator type.

Definition at line 87 of file tracks.h.

typedef storage_type_::size_type tide::Tracks::size_type

The size type of this container.

Definition at line 77 of file tracks.h.

typedef std::map<key_type, mapped_type> tide::Tracks::storage_type_ [protected]

The type of the internal storage.

Definition at line 61 of file tracks.h.

typedef storage_type_::value_type tide::Tracks::value_type

The value type of this container.

Definition at line 72 of file tracks.h.


Constructor & Destructor Documentation

tide::Tracks::Tracks ( )

Construct a new Tracks element.

Upon construction, the list of tracks will be empty. At least one TrackEntry must be added before writing the element.

virtual tide::Tracks::~Tracks ( ) [inline, virtual]

Destructor.

Definition at line 72 of file tracks.h.


Member Function Documentation

mapped_type& tide::Tracks::at ( key_type const &  pos) [inline]

Get the TrackEntry with the given track number.

Returns:
A reference to the specified TrackEntry.
Exceptions:
std::out_of_rangeif the track number is invalid.

Definition at line 103 of file tracks.h.

mapped_type const& tide::Tracks::at ( key_type const &  pos) const [inline]

Get the TrackEntry with the given track number.

Returns:
A reference to the specified TrackEntry.
Exceptions:
std::out_of_rangeif the track number is invalid.

Definition at line 110 of file tracks.h.

iterator tide::Tracks::begin ( ) [inline]

Get an iterator to the first TrackEntry.

Definition at line 129 of file tracks.h.

const_iterator tide::Tracks::begin ( ) const [inline]

Get an iterator to the first TrackEntry.

Definition at line 131 of file tracks.h.

virtual std::streamsize tide::Tracks::body_size ( ) const [protected, virtual]

Get the size of the body of this element.

Implements tide::Element.

void tide::Tracks::clear ( ) [inline]

Remove all TrackElements.

Definition at line 157 of file tracks.h.

size_type tide::Tracks::count ( ) const [inline]

Get the number of TrackElements.

Definition at line 152 of file tracks.h.

bool tide::Tracks::empty ( ) const [inline]

Check if there are no TrackElements.

Definition at line 150 of file tracks.h.

iterator tide::Tracks::end ( ) [inline]

Get an iterator to the position past the last TrackEntry.

Definition at line 133 of file tracks.h.

const_iterator tide::Tracks::end ( ) const [inline]

Get an iterator to the position past the last TrackEntry.

Definition at line 135 of file tracks.h.

void tide::Tracks::erase ( iterator  position) [inline]

Erase the TrackEntry at the specified iterator.

Parameters:
[in]positionThe position to erase at.

Definition at line 190 of file tracks.h.

void tide::Tracks::erase ( iterator  first,
iterator  last 
) [inline]

Erase a range of TrackEntries.

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

Definition at line 197 of file tracks.h.

size_type tide::Tracks::erase ( key_type const &  number) [inline]

Erase the TrackEntry with the given track number.

Parameters:
[in]numberThe track number to erase.
Returns:
The number of TrackEntries erased.

Definition at line 204 of file tracks.h.

iterator tide::Tracks::find ( key_type const &  number) [inline]

Search for the TrackEntry with the given track number.

Parameters:
[in]numberThe track number to search for.
Returns:
An iterator to the matching TrackEntry, or end() if there is no TrackEntry with that number.

Definition at line 219 of file tracks.h.

const_iterator tide::Tracks::find ( key_type const &  number) const [inline]

Search for the TrackEntry with the given track number.

Parameters:
[in]numberThe track number to search for.
Returns:
An iterator to the matching TrackEntry, or end() if there is no TrackEntry with that number.

Definition at line 227 of file tracks.h.

std::pair<iterator, bool> tide::Tracks::insert ( mapped_type const &  value)

Insert a new TrackElement.

If a TrackElement already exists with the same track number, the new one will not replace it, and the return code will indicate that no insertion took place.

Parameters:
[in]valueThe TrackEntry to insert. Its track number will be used as the key.
Returns:
A pair of the iterator at the position where the TrackEntry was added (or blocked) and a boolean indicating if the insertion took place.
Exceptions:
DuplicateTrackNumberif an existing track entry uses the same track number.
DuplicateUIDif an existing track entry uses the same UID.
void tide::Tracks::insert ( const_iterator  first,
const_iterator  last 
)

Insert a range of TrackElements.

Parameters:
[in]firstThe start of the range.
[in]lastThe end of the range.
Exceptions:
DuplicateTrackNumberif an existing track entry uses the same track number.
DuplicateUIDif an existing track entry uses the same UID.
size_type tide::Tracks::max_count ( ) const [inline]

Get the maximum number of TrackElements.

Definition at line 154 of file tracks.h.

Tracks& tide::Tracks::operator= ( Tracks const &  other) [inline]

Replace the stored TrackEntries with those from another Tracks element.

Definition at line 95 of file tracks.h.

mapped_type& tide::Tracks::operator[] ( key_type const &  key)

Gets a reference to the TrackEntry with the given track number.

Returns:
A reference to a TrackEntry with the given track number.
Exceptions:
std::out_of_rangeif the track number is invalid.
mapped_type const& tide::Tracks::operator[] ( key_type const &  key) const

Gets a reference to the TrackEntry with the given track number.

Returns:
A reference to a TrackEntry with the given track number.
Exceptions:
std::out_of_rangeif the track number is invalid.
const_reverse_iterator tide::Tracks::rbegin ( ) const [inline]

Get a reverse iterator to the last TrackEntry.

Definition at line 139 of file tracks.h.

reverse_iterator tide::Tracks::rbegin ( ) [inline]

Get a reverse iterator to the last TrackEntry.

Definition at line 137 of file tracks.h.

virtual std::streamsize tide::Tracks::read_body ( std::istream &  input,
std::streamsize  size 
) [protected, virtual]

Element body loading.

Exceptions:
DuplicateTrackNumberif more than one TrackEntry in the stored element has the same track number.
DuplicateUIDif more than one TrackEntry in the stored element has the same UID.

Implements tide::Element.

const_reverse_iterator tide::Tracks::rend ( ) const [inline]

Get a reverse iterator to the position before the first TrackEntry.

Definition at line 147 of file tracks.h.

reverse_iterator tide::Tracks::rend ( ) [inline]

Get a reverse iterator to the position before the first TrackEntry.

Definition at line 143 of file tracks.h.

void tide::Tracks::swap ( Tracks other) [inline]

Swaps the contents of this Tracks element with another.

Parameters:
[in]otherThe other Tracks element to swap with.

Definition at line 210 of file tracks.h.

void tide::Tracks::validate_entries ( ) const [protected]

Checks for duplicate track numbers and UIDs.

Exceptions:
DuplicateTrackNumberif more than one TrackEntry in the element has the same track number.
DuplicateUIDif more than one TrackEntry in the element has the same UID.
void tide::Tracks::verify_not_duplicate ( TrackEntry::Ptr  entry) const [protected]

Looks for a duplicate track entry, throws an exception if it is.

This function searchers the stored TrackEntry elements for one with the same track number OR track UID as the given entry. The result is indicated by throwing an exception. No exception means the TrackEntry is unique.

Parameters:
[in]entryThe entry to look for a duplicate for.
Exceptions:
DuplicateTrackNumberif more than one TrackEntry in the element has the same track number.
DuplicateUIDif more than one TrackEntry in the element has the same UID.
virtual std::streamsize tide::Tracks::write_body ( std::ostream &  output) [virtual]

Element body writing.

Exceptions:
DuplicateTrackNumberif more than one TrackEntry in the element has the same track number.
DuplicateUIDif more than one TrackEntry in the element has the same UID.

Implements tide::Element.


Friends And Related Function Documentation

bool operator== ( Tracks const &  lhs,
Tracks const &  rhs 
) [friend]

Equality operator.


Member Data Documentation

The track entry store.

This must always be sorted by TrackNumber.

Definition at line 247 of file tracks.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines