Tide 0.1.0
|
The Tracks element, listing all tracks in the segment. More...
#include <tide/tracks.h>
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. | |
Tracks & | operator= (Tracks const &other) |
Replace the stored TrackEntries with those from another Tracks element. | |
mapped_type & | at (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_type & | operator[] (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. |
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.
typedef storage_type_::const_iterator tide::Tracks::const_iterator |
typedef storage_type_::const_reference tide::Tracks::const_reference |
typedef storage_type_::const_reverse_iterator tide::Tracks::const_reverse_iterator |
typedef storage_type_::iterator tide::Tracks::iterator |
typedef uint64_t tide::Tracks::key_type |
typedef storage_type_::reference tide::Tracks::reference |
typedef storage_type_::reverse_iterator tide::Tracks::reverse_iterator |
typedef storage_type_::size_type tide::Tracks::size_type |
typedef std::map<key_type, mapped_type> tide::Tracks::storage_type_ [protected] |
typedef storage_type_::value_type tide::Tracks::value_type |
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] |
mapped_type& tide::Tracks::at | ( | key_type const & | pos | ) | [inline] |
Get the TrackEntry with the given track number.
std::out_of_range | if the track number is invalid. |
mapped_type const& tide::Tracks::at | ( | key_type const & | pos | ) | const [inline] |
Get the TrackEntry with the given track number.
std::out_of_range | if the track number is invalid. |
iterator tide::Tracks::begin | ( | ) | [inline] |
Get an iterator to the first TrackEntry.
const_iterator tide::Tracks::begin | ( | ) | const [inline] |
Get an iterator to the first TrackEntry.
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] |
size_type tide::Tracks::count | ( | ) | const [inline] |
bool tide::Tracks::empty | ( | ) | const [inline] |
iterator tide::Tracks::end | ( | ) | [inline] |
Get an iterator to the position past the last TrackEntry.
const_iterator tide::Tracks::end | ( | ) | const [inline] |
Get an iterator to the position past the last TrackEntry.
void tide::Tracks::erase | ( | iterator | position | ) | [inline] |
Erase the TrackEntry at the specified iterator.
[in] | position | The position to erase at. |
Erase the TrackEntry with the given track number.
[in] | number | The track number to erase. |
Search for the TrackEntry with the given track number.
[in] | number | The track number to search for. |
const_iterator tide::Tracks::find | ( | key_type const & | number | ) | const [inline] |
Search for the TrackEntry with the given track number.
[in] | number | The track number to search for. |
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.
[in] | value | The TrackEntry to insert. Its track number will be used as the key. |
DuplicateTrackNumber | if an existing track entry uses the same track number. |
DuplicateUID | if an existing track entry uses the same UID. |
void tide::Tracks::insert | ( | const_iterator | first, |
const_iterator | last | ||
) |
Insert a range of TrackElements.
[in] | first | The start of the range. |
[in] | last | The end of the range. |
DuplicateTrackNumber | if an existing track entry uses the same track number. |
DuplicateUID | if an existing track entry uses the same UID. |
size_type tide::Tracks::max_count | ( | ) | const [inline] |
mapped_type& tide::Tracks::operator[] | ( | key_type const & | key | ) |
Gets a reference to the TrackEntry with the given track number.
std::out_of_range | if 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.
std::out_of_range | if the track number is invalid. |
const_reverse_iterator tide::Tracks::rbegin | ( | ) | const [inline] |
Get a reverse iterator to the last TrackEntry.
reverse_iterator tide::Tracks::rbegin | ( | ) | [inline] |
Get a reverse iterator to the last TrackEntry.
virtual std::streamsize tide::Tracks::read_body | ( | std::istream & | input, |
std::streamsize | size | ||
) | [protected, virtual] |
Element body loading.
DuplicateTrackNumber | if more than one TrackEntry in the stored element has the same track number. |
DuplicateUID | if 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.
reverse_iterator tide::Tracks::rend | ( | ) | [inline] |
Get a reverse iterator to the position before the first TrackEntry.
void tide::Tracks::swap | ( | Tracks & | other | ) | [inline] |
void tide::Tracks::validate_entries | ( | ) | const [protected] |
Checks for duplicate track numbers and UIDs.
DuplicateTrackNumber | if more than one TrackEntry in the element has the same track number. |
DuplicateUID | if 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.
[in] | entry | The entry to look for a duplicate for. |
DuplicateTrackNumber | if more than one TrackEntry in the element has the same track number. |
DuplicateUID | if 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.
DuplicateTrackNumber | if more than one TrackEntry in the element has the same track number. |
DuplicateUID | if more than one TrackEntry in the element has the same UID. |
Implements tide::Element.
storage_type_ tide::Tracks::entries_ [protected] |