arcstk::v_1_0_0::Matcher class

Interface: Try to Match Checksums against a specified ARResponse.

A Matcher implements a concrete logic of matching Checksums against a specified ARResponse. This logic defines which comparisons are actually performed, in which order and which input information is actually considered. Different Matchers may therefore produce Matches with different content on identical input.

Constructors, destructors, conversion operators

~Matcher() virtual noexcept
Virtual default destructor.

Public functions

auto best_difference() const -> int noexcept
Returns the difference value of the ARBlock with index best_match().
auto best_match() const -> int noexcept
Returns the 0-based index of the best matching block in the ARResponse.
auto best_match_is_v2() const -> bool noexcept
Returns TRUE iff the ARBlock with index best_match() matches the ARCSsv2 of the request, otherwise FALSE.
auto clone() const -> std::unique_ptr<Matcher> noexcept
Clones this instance.
auto equals(const Matcher& rhs) const -> bool noexcept
Return TRUE iff the specified Matcher equals this instance.
auto match() const -> const Match* noexcept
Returns the actual Match.
auto matches() const -> bool noexcept
Returns TRUE iff at least one block in the ARResponse has a difference() of 0 to either the ARCSs v1 or the ARCSs v2 in the request.

Private functions

auto do_best_difference() const -> int pure virtual noexcept
Implements best_difference().
auto do_best_match() const -> int pure virtual noexcept
Implements best_match().
auto do_best_match_is_v2() const -> bool pure virtual noexcept
Implements best_match_is_v2().
auto do_clone() const -> std::unique_ptr<Matcher> pure virtual noexcept
Implements clone().
auto do_equals(const Matcher& rhs) const -> bool pure virtual noexcept
Implements equals().
auto do_match() const -> const Match* pure virtual noexcept
Implements match().
auto do_matches() const -> bool pure virtual noexcept
Implements matches().

Function documentation

int arcstk::v_1_0_0::Matcher::best_difference() const noexcept

Returns the difference value of the ARBlock with index best_match().

Returns Difference value of best block

The difference is the sum of the number of non-matching ARCSs and the number of non-matching ARIds in a single block. A block whose ARId does not match the ARId of the result has therefore at least a difference of 1 to the result.

int arcstk::v_1_0_0::Matcher::best_match() const noexcept

Returns the 0-based index of the best matching block in the ARResponse.

Returns 0-based index of the best matching block in response

If there is an ARCSv1 block that matches equally good as another ARCSv2 block, best_match() will point to the ARCSv2 block.

bool arcstk::v_1_0_0::Matcher::best_match_is_v2() const noexcept

Returns TRUE iff the ARBlock with index best_match() matches the ARCSsv2 of the request, otherwise FALSE.

Returns TRUE if best_match() was to the ARCSsv2 in the ARResponse

std::unique_ptr<Matcher> arcstk::v_1_0_0::Matcher::clone() const noexcept

Clones this instance.

Returns Deep copy of this instance

bool arcstk::v_1_0_0::Matcher::equals(const Matcher& rhs) const noexcept

Return TRUE iff the specified Matcher equals this instance.

Parameters
rhs in The right hand side of the operation
Returns TRUE iff rhs equals this instance

const Match* arcstk::v_1_0_0::Matcher::match() const noexcept

Returns the actual Match.

Returns The actual Match

bool arcstk::v_1_0_0::Matcher::matches() const noexcept

Returns TRUE iff at least one block in the ARResponse has a difference() of 0 to either the ARCSs v1 or the ARCSs v2 in the request.

Returns TRUE if response contains a block matching result

int arcstk::v_1_0_0::Matcher::do_best_difference() const pure virtual private noexcept

Implements best_difference().

Returns Difference value of best block

int arcstk::v_1_0_0::Matcher::do_best_match() const pure virtual private noexcept

Implements best_match().

Returns 0-based index of the best matching block in response

bool arcstk::v_1_0_0::Matcher::do_best_match_is_v2() const pure virtual private noexcept

Implements best_match_is_v2().

Returns TRUE if best_match() was a match to the ARCSsv2

std::unique_ptr<Matcher> arcstk::v_1_0_0::Matcher::do_clone() const pure virtual private noexcept

Implements clone().

Returns Deep copy of this instance.

const Match* arcstk::v_1_0_0::Matcher::do_match() const pure virtual private noexcept

Implements match().

Returns The actual match information.

bool arcstk::v_1_0_0::Matcher::do_matches() const pure virtual private noexcept

Implements matches().

Returns TRUE if response contains a block matching result