arcstk::v_1_0_0::Checksum class final

An AccurateRip checksum for a single file or track.

A Checksum has a value_type. This is its numeric representation. It is an unsigned integer of 32 bit length.

A Checksum can be represented by its numeric value() which is of type value_type. A Checksum can be compared for equality with instances of its value_type using operator ==.

A Checksum has a converting constructor for its value_type, thus every parameter that expects a checksum can be assigned a value of type value_type instead of a Checksum. Some compilers will do the conversion with other numerical types but issue a warning if a conversion from signed to unsigned types is required (e.g. -Wsign-conversion).

Operator << is overloaded for printing Checksums to streams. The Checksum will then occurr in its standard layout: as a hexadecimal number without the base '0x', all digits in upper case, and filled with leading zeros up to a width of 8 digits.

As a technical convenience, a Checksum may be empty() which means: it carries no value. Calling value() on an empty() Checksum may lead any result. Two empty Checksum instances qualify as equal when compared using operator ==.

Public types

using value_type = uint32_t
Numerical base type of checksums: a 32-bit wide unsigned integer.

Constructors, destructors, conversion operators

Checksum()
Constructor.
Checksum(const value_type value)
Converting constructor.

Public functions

auto empty() const -> bool noexcept
Return TRUE iff this Checksum is empty, otherwise FALSE.
auto value() const -> value_type noexcept
Numeric value of the checksum.

Function documentation

arcstk::v_1_0_0::Checksum::Checksum()

Constructor.

Creates an empty Checksum.

arcstk::v_1_0_0::Checksum::Checksum(const value_type value)

Converting constructor.

Parameters
value in Actual checksum value

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

Return TRUE iff this Checksum is empty, otherwise FALSE.

Returns Return TRUE iff this Checksum is empty, otherwise FALSE.

A Checksum is empty if it contains no valid value. Note that this does not entail value() == 0 in all cases. Nonetheless, for most checksum types, the converse holds, they are empty() if they are 0 .

value_type arcstk::v_1_0_0::Checksum::value() const noexcept

Numeric value of the checksum.

Returns Numeric value of the checksum