class
#include <calculate.hpp>
v_1_0_0::Algorithm Interface: Checksum calculation algorithm.
Algorithm instances hold the concrete subtotals. An Algorithm can be updated with new input by the caller and provides the result after the last update. The calculation of tracks is to be finished manually by calling track_
The caller is required to instantiate and setup an Algorithm. However, it should usually not be required to use an Algorithm directly. This is performed via a Calculation.
Constructors, destructors, conversion operators
- Algorithm()
- Default constructor.
- ~Algorithm() virtual noexcept
- Virtual default destructor.
Public functions
- auto clone() const -> std::unique_ptr<Algorithm>
- Clone this instance.
- auto range(const AudioSize& size, const Points& points) const -> std::pair<int32_t, int32_t>
- Determine the legal range of samples for the calculation performed on the input amount.
- auto result() const -> ChecksumSet
- Return the result of the algorithm.
- void set_settings(const Settings* s) noexcept
- Configure the algorithm with settings.
- auto settings() const -> const Settings* noexcept
- Return the settings of this instance.
- void track_finished(const int trackno, const AudioSize& length)
- Mark current track as finished.
- auto types() const -> ChecksumtypeSet
- Types of checksums the algorithm calculates.
- void update(SampleInputIterator start, SampleInputIterator stop)
- Update with a sequence of samples.
Protected functions
Function documentation
std::pair<int32_t, int32_t> arcstk:: v_1_0_0:: Algorithm:: range(const AudioSize& size,
const Points& points) const
Determine the legal range of samples for the calculation performed on the input amount.
Parameters | |
---|---|
size in | The input size of samples to process |
points in | The offset points in number of PCM samples |
Returns | Input range of 1-based sample indices to use for calculation. |
The algorithm may request to process only a part of the input - e.g. it may skip an amount of samples at the beginning and at the end.
ChecksumSet arcstk:: v_1_0_0:: Algorithm:: result() const
Return the result of the algorithm.
Returns | Calculation result. |
---|
void arcstk:: v_1_0_0:: Algorithm:: set_settings(const Settings* s) noexcept
Configure the algorithm with settings.
Parameters | |
---|---|
s in | Settings to use on this instance |
void arcstk:: v_1_0_0:: Algorithm:: track_finished(const int trackno,
const AudioSize& length)
Mark current track as finished.
Parameters | |
---|---|
trackno in | Track number |
length in | Track length as calculated |
What the instance has to do whenever a track is finished can be implemented in this hook.
ChecksumtypeSet arcstk:: v_1_0_0:: Algorithm:: types() const
Types of checksums the algorithm calculates.
Returns | Checksum types calculated by this algorithm |
---|
void arcstk:: v_1_0_0:: Algorithm:: update(SampleInputIterator start,
SampleInputIterator stop)
Update with a sequence of samples.
Parameters | |
---|---|
start in | Iterator pointing to the first sample of the sequence |
stop in | Iterator pointing behind the last sample of the sequence |