24 #ifndef INC_CKCALCULATOR_HPP_71DAD55B_09B4_426A_920E_27BCDBE81D7B
25 #define INC_CKCALCULATOR_HPP_71DAD55B_09B4_426A_920E_27BCDBE81D7B
68 virtual void update(
size_t read,
bool& cancelled) = 0;
101 void update(
size_t read,
bool& cancelled)
override {}
129 static constexpr
size_t default_buffer_size = 4096u;
130 static constexpr
size_t min_buffer_size = 1u;
131 static constexpr
size_t max_buffer_size = 1048576u;
136 static constexpr
unsigned int default_thread_number = 2u;
138 static constexpr
unsigned int max_thread_number = 32u;
146 static constexpr
unsigned int automatic_thread_number = 0u;
158 const unsigned int newNbThreads = automatic_thread_number,
159 const size_t newBufferSize = default_buffer_size);
176 size_t getBufferSize()
const;
188 size_t setBufferSize(
const size_t newBufSize);
195 unsigned int getNbThreads()
const;
203 unsigned int setNbThreads(
const unsigned int newNbThreads);
271 static constexpr
size_t default_file_buffer_size = 0xFFFFu;
284 const unsigned int newNbThreads = automatic_thread_number,
285 const size_t newBufferSize = default_file_buffer_size);
318 const std::filesystem::path& filepath);
348 const std::filesystem::path& filepath);
Stores the value of a checksum.
std::vector< ChecksumValue > ArrayChecksumValue
Array of values of checksum.
Handles the progression of the process of computing of a checksum.
ChecksumCalculatorProgress(const ChecksumCalculatorProgress &)=delete
Deleted copy constructor.
virtual void update(size_t read, bool &cancelled)=0
Updates the progress of the computing of a checksum.
ChecksumCalculatorProgress()=default
Default constructor.
ChecksumCalculatorProgress & operator=(const ChecksumCalculatorProgress &)=delete
Deleted assignment operator.
virtual ~ChecksumCalculatorProgress()=default
Destructor.
ChecksumCalculator & operator=(const ChecksumCalculator &)=delete
Deleted assignment operator.
static DefaultChecksumCalculatorProgress defaultChecksumCalculatorProgress
Default progress checksum calculator instance.
ChecksumCalculatorProgress & progress
The progress handler used to show the progression.
virtual ~ChecksumCalculator()=default
Destructor.
State
States that can be returned by the calculate or the check method.
size_t bufferSize
The size of the buffer to use for reading the input stream.
unsigned int nbThreads
Number of threads to compute checksums.
ChecksumCalculator(const ChecksumCalculator &)=delete
Deleted copy constructor.
Computes a checksum from a file.
virtual ~ChecksumFileCalculator()=default
Destructor.
ChecksumFileCalculator(const ChecksumFileCalculator &)=delete
Deleted copy constructor.
ChecksumFileCalculator & operator=(const ChecksumFileCalculator &)=delete
Deleted assignment operator.
Stores the value of a checksum.
Handles the progression of the process of computing of a checksum.
DefaultChecksumCalculatorProgress()=default
Default constructor.
DefaultChecksumCalculatorProgress(const DefaultChecksumCalculatorProgress &)=delete
Deleted copy constructor.
virtual ~DefaultChecksumCalculatorProgress()=default
Destructor.
void update(size_t read, bool &cancelled) override
Updates the progress of the computing of a checksum.
DefaultChecksumCalculatorProgress & operator=(const DefaultChecksumCalculatorProgress &)=delete
Deleted assignment operator.
std::vector< ChecksumAlgoId > ArrayChecksumAlgoId
Array of ids of algorithms of checksums.
ChecksumAlgoId
Ids of algorithms of checksums.