arcstk::v_1_0_0::ChecksumSet class final

A set of Checksum instances of different types for a single track.

The ChecksumSet represents the calculation result for a single track. It also holds optionally the track length as number of LBA frames for convenience. The length may be zero which counts as "unknown".

Public types

using const_iterator = storage_type::const_iterator
Unspecified forward iterator type.
using iterator = storage_type::iterator
Unspecified forward iterator type.
using size_type = storage_type::size_type
Size type (unsigned integral type)
using value_type = Checksum
Value type of the ChecksumSet.

Constructors, destructors, conversion operators

ChecksumSet()
Constructor for a track with unknown length (will be 0)
ChecksumSet(const int32_t length) explicit
Constructor.
ChecksumSet(const int32_t length, std::initializer_list<std::pair<const checksum::type, value_type>> sums)
Constructor for a known set of typed Checksums.
operator bool() const explicit noexcept
A ChecksumSet converts to bool iff it is non-empty.

Public functions

auto begin() -> iterator
Obtain a pointer to the first Checksum.
auto begin() const -> const_iterator
Obtain a pointer to the first Checksum.
auto cbegin() const -> const_iterator
Obtain a pointer to the first Checksum.
auto cend() const -> const_iterator
Obtain a pointer pointing behind the last Checksum.
void clear()
Erases all Checksums contained in the instance.
auto contains(const checksum::type& type) const -> bool
Returns TRUE iff the instance contains a Checksum of the type type.
auto empty() const -> bool noexcept
Returns TRUE iff the instance contains no elements, otherwise FALSE.
auto end() -> iterator
Obtain a pointer pointing behind the last Checksum.
auto end() const -> const_iterator
Obtain a pointer pointing behind the last Checksum.
void erase(const checksum::type& type)
Erases the Checksum with the given type.
auto get(const checksum::type type) const -> Checksum
Return the Checksum for the specified type.
auto insert(const checksum::type type, const Checksum& checksum) -> std::pair<iterator, bool>
Inserts a new <type,Checksum> pair to the instance.
auto length() const -> int32_t noexcept
Length (in LBA frames) of this track.
void merge(ChecksumSet& rhs)
Merge the elements of another instance into this instance.
void set_length(const int32_t length) noexcept
Set the length (in LBA frames) of this track.
auto size() const -> size_type noexcept
Returns the number of elements contained in the instance.
auto types() const -> std::set<checksum::type>
Return the checksum types present in this ChecksumSet.

Function documentation

arcstk::v_1_0_0::ChecksumSet::ChecksumSet(const int32_t length) explicit

Constructor.

Parameters
length in Length in LBA frames of the track

arcstk::v_1_0_0::ChecksumSet::ChecksumSet(const int32_t length, std::initializer_list<std::pair<const checksum::type, value_type>> sums)

Constructor for a known set of typed Checksums.

Parameters
length in Track length
sums in Sequence of checksums represented as type-value pairs

arcstk::v_1_0_0::ChecksumSet::operator bool() const explicit noexcept

A ChecksumSet converts to bool iff it is non-empty.

Returns TRUE iff !empty().

iterator arcstk::v_1_0_0::ChecksumSet::begin()

Obtain a pointer to the first Checksum.

Returns Pointer to the first Checksum

const_iterator arcstk::v_1_0_0::ChecksumSet::begin() const

Obtain a pointer to the first Checksum.

Returns Pointer to the first Checksum

const_iterator arcstk::v_1_0_0::ChecksumSet::cbegin() const

Obtain a pointer to the first Checksum.

Returns Pointer to the first Checksum

const_iterator arcstk::v_1_0_0::ChecksumSet::cend() const

Obtain a pointer pointing behind the last Checksum.

Returns Pointer pointing behind the last Checksum

void arcstk::v_1_0_0::ChecksumSet::clear()

Erases all Checksums contained in the instance.

After clear() has been called the size of the container will be 0 .

bool arcstk::v_1_0_0::ChecksumSet::contains(const checksum::type& type) const

Returns TRUE iff the instance contains a Checksum of the type type.

Parameters
type in The type to lookup the Checksum for
Returns TRUE iff type is present in the instance, otherwise FALSE

bool arcstk::v_1_0_0::ChecksumSet::empty() const noexcept

Returns TRUE iff the instance contains no elements, otherwise FALSE.

Returns TRUE iff instance contains no elements, otherwise FALSE

iterator arcstk::v_1_0_0::ChecksumSet::end()

Obtain a pointer pointing behind the last Checksum.

Returns Pointer pointing behind the last Checksum

const_iterator arcstk::v_1_0_0::ChecksumSet::end() const

Obtain a pointer pointing behind the last Checksum.

Returns Pointer pointing behind the last Checksum

void arcstk::v_1_0_0::ChecksumSet::erase(const checksum::type& type)

Erases the Checksum with the given type.

Parameters
type in The type to erase

Iff the given type is not contained in the instance, the call has no effect.

Checksum arcstk::v_1_0_0::ChecksumSet::get(const checksum::type type) const

Return the Checksum for the specified type.

Parameters
type in The checksum::type to return the value
Returns The checksum for the specified type

If there is no Checksum represented for the type, the Checksum returned will be empty().

std::pair<iterator, bool> arcstk::v_1_0_0::ChecksumSet::insert(const checksum::type type, const Checksum& checksum)

Inserts a new <type,Checksum> pair to the instance.

Parameters
type in The key to use
checksum in The checksum for the given key
Returns Pair with an iterator to the inserted value and a status flag

If the key is already present in the instance, the existing checksum will be left unmodified.

The pair returned contains an iterator to the inserted Checksum and a bool that is TRUE iff the insertion was successful. If the insertion was not successful, the value FALSE is returned for the bool and the iterator will point to the element that prevented the insertion.

int32_t arcstk::v_1_0_0::ChecksumSet::length() const noexcept

Length (in LBA frames) of this track.

Returns Length of this track in LBA frames

For ChecksumSets constructed by an instance of Algorithm, this will be the length actually used for computing the Checksum. It may or may not be identical to the parsed length hold in the ToC. The parsed length might be smaller since it is possible that it does not contain the silence adjacent to the respective track. Hence, a mismatch between the length() of a ChecksumSet and the parsed_length() of the ToC used in the Calculation that created the ChecksumSet is not an error.

void arcstk::v_1_0_0::ChecksumSet::merge(ChecksumSet& rhs)

Merge the elements of another instance into this instance.

Parameters
rhs in The list to be merged into the instance
Exceptions
domain_error If rhs.length() != length() and both are != 0

If a key in the other instance is already present in this instance, the corresponding element will be left unmodified.

Trying to merge a set with non-zero length into an instance with non-zero length of different value will cause a std::domain_error. If either rhs or this has zero length, the merge will succeed.

void arcstk::v_1_0_0::ChecksumSet::set_length(const int32_t length) noexcept

Set the length (in LBA frames) of this track.

Parameters
length in New length for this instance

size_type arcstk::v_1_0_0::ChecksumSet::size() const noexcept

Returns the number of elements contained in the instance.

Returns Number of elements contained in the instance.

std::set<checksum::type> arcstk::v_1_0_0::ChecksumSet::types() const

Return the checksum types present in this ChecksumSet.

Returns The checksum types in this ChecksumSet