Tawara
0.1.0
|
The Tracks element, listing all tracks in the segment. More...
#include <tawara/tracks.h>
Public Types | |
typedef uint64_t | key_type |
The key type (Key) of this container. More... | |
typedef TrackEntry::Ptr | 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 | |
Tracks () | |
Construct a new Tracks element. More... | |
virtual | ~Tracks () |
Destructor. More... | |
mapped_type & | at (key_type const &pos) |
Get the TrackEntry with the given track number. More... | |
mapped_type const & | at (key_type const &pos) const |
Get the TrackEntry with the given track number. More... | |
mapped_type & | operator[] (key_type const &key) |
Gets a reference to the TrackEntry with the given track number. More... | |
mapped_type const & | operator[] (key_type const &key) const |
Gets a reference to the TrackEntry with the given track number. More... | |
iterator | begin () |
Get an iterator to the first TrackEntry. More... | |
const_iterator | begin () const |
Get an iterator to the first TrackEntry. More... | |
iterator | end () |
Get an iterator to the position past the last TrackEntry. More... | |
const_iterator | end () const |
Get an iterator to the position past the last TrackEntry. More... | |
reverse_iterator | rbegin () |
Get a reverse iterator to the last TrackEntry. More... | |
const_reverse_iterator | rbegin () const |
Get a reverse iterator to the last TrackEntry. More... | |
reverse_iterator | rend () |
Get a reverse iterator to the position before the first TrackEntry. More... | |
const_reverse_iterator | rend () const |
Get a reverse iterator to the position before the first TrackEntry. More... | |
bool | empty () const |
Check if there are no TrackElements. More... | |
size_type | count () const |
Get the number of TrackElements. More... | |
size_type | max_count () const |
Get the maximum number of TrackElements. More... | |
void | clear () |
Remove all TrackElements. More... | |
std::pair< iterator, bool > | insert (mapped_type const &value) |
Insert a new TrackElement. More... | |
void | insert (const_iterator first, const_iterator last) |
Insert a range of TrackElements. More... | |
void | erase (iterator position) |
Erase the TrackEntry at the specified iterator. More... | |
void | erase (iterator first, iterator last) |
Erase a range of TrackEntries. More... | |
size_type | erase (key_type const &number) |
Erase the TrackEntry with the given track number. More... | |
void | swap (Tracks &other) |
Swaps the contents of this Tracks element with another. More... | |
iterator | find (key_type const &number) |
Search for the TrackEntry with the given track number. More... | |
const_iterator | find (key_type const &number) const |
Search for the TrackEntry with the given track number. 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::map< 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... | |
void | validate_entries () const |
Checks for duplicate track numbers and UIDs. More... | |
void | verify_not_duplicate (TrackEntry::Ptr entry) const |
Looks for a duplicate track entry, throws an exception if it is. 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_ | entries_ |
The track entry store. More... | |
![]() | |
tawara::ids::ID | id_ |
std::streampos | offset_ |
Friends | |
bool | operator== (Tracks const &lhs, Tracks const &rhs) |
Equality operator. More... | |
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 tawara::Tracks::const_iterator |
typedef storage_type_::const_reference tawara::Tracks::const_reference |
typedef storage_type_::const_reverse_iterator tawara::Tracks::const_reverse_iterator |
typedef storage_type_::iterator tawara::Tracks::iterator |
typedef uint64_t tawara::Tracks::key_type |
typedef storage_type_::reference tawara::Tracks::reference |
typedef storage_type_::reverse_iterator tawara::Tracks::reverse_iterator |
typedef storage_type_::size_type tawara::Tracks::size_type |
|
protected |
typedef storage_type_::value_type tawara::Tracks::value_type |
tawara::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.
|
inlinevirtual |
|
inline |
Get the TrackEntry with the given track number.
std::out_of_range | if the track number is invalid. |
|
inline |
Get the TrackEntry with the given track number.
std::out_of_range | if the track number is invalid. |
|
inline |
Get an iterator to the first TrackEntry.
|
inline |
Get an iterator to the first TrackEntry.
|
protectedvirtual |
Get the size of the body of this element.
Implements tawara::Element.
|
inline |
|
inline |
|
inline |
|
inline |
Get an iterator to the position past the last TrackEntry.
|
inline |
Get an iterator to the position past the last TrackEntry.
|
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. |
|
inline |
Search for the TrackEntry with the given track number.
[in] | number | The track number to search for. |
std::pair<iterator, bool> tawara::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 tawara::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. |
|
inline |
mapped_type& tawara::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& tawara::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. |
|
inline |
Get a reverse iterator to the last TrackEntry.
|
inline |
Get a reverse iterator to the last TrackEntry.
|
protectedvirtual |
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 tawara::Element.
|
inline |
Get a reverse iterator to the position before the first TrackEntry.
|
inline |
Get a reverse iterator to the position before the first TrackEntry.
|
inline |
|
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. |
|
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. |
|
protectedvirtual |
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 tawara::Element.
|
protected |