Loading...
Searching...
No Matches
delta_sig_block_size.hpp
Go to the documentation of this file.
/*********************************************************************/
// dar - disk archive - a backup/restoration program
// Copyright (C) 2002-2024 Denis Corbin
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// to contact the author, see the AUTHOR file
/*********************************************************************/
#ifndef DELTA_SIG_BLOCK_SIZE_HPP
#define DELTA_SIG_BLOCK_SIZE_HPP
#include "../my_config.h"
extern "C"
{
} // end extern "C"
#include "infinint.hpp"
namespace libdar
{
struct delta_sig_block_size
{
enum fs_function_t
{
fixed,
linear,
log2,
square2,
square3
};
fs_function_t fs_function; //< the function to use to calculate the signature block len
infinint multiplier;
infinint divisor;
U_I min_block_len;
U_I max_block_len;
// definitions to help using the struct
delta_sig_block_size() { reset(); };
delta_sig_block_size(const delta_sig_block_size & ref) = default;
delta_sig_block_size(delta_sig_block_size && ref) noexcept = default;
delta_sig_block_size & operator = (const delta_sig_block_size & ref) = default;
delta_sig_block_size & operator = (delta_sig_block_size && ref) noexcept = default;
~delta_sig_block_size() = default;
bool operator == (const delta_sig_block_size & ref) const;
void reset();
bool equals_default() { return (*this) == delta_sig_block_size(); };
void check() const;
U_I calculate(const infinint & filesize) const;
};
} // end of namespace
#endif
libdar::infinint
the arbitrary large positive integer class
Definition real_infinint.hpp:62
infinint.hpp
switch module to limitint (32 ou 64 bits integers) or infinint
my_config.h
include macro defined by the configure script and some specific additional ones
libdar
libdar namespace encapsulate all libdar symbols
Definition archive.hpp:47
libdar::delta_sig_block_size
defines how to calculate delta signature block size based of file size to delta sign
Definition delta_sig_block_size.hpp:47
libdar::delta_sig_block_size::multiplier
infinint multiplier
function dependently used multiplier
Definition delta_sig_block_size.hpp:59
libdar::delta_sig_block_size::min_block_len
U_I min_block_len
calculated block len will never be lower than that
Definition delta_sig_block_size.hpp:61
libdar::delta_sig_block_size::check
void check() const
check the sanity of the provided values
libdar::delta_sig_block_size::fs_function_t
fs_function_t
defines the function to use to derivate block size from file size
Definition delta_sig_block_size.hpp:50
libdar::delta_sig_block_size::square3
@ square3
block size if proportional to filesize^3
Definition delta_sig_block_size.hpp:55
libdar::delta_sig_block_size::square2
@ square2
block size is proportional to filesize^2
Definition delta_sig_block_size.hpp:54
libdar::delta_sig_block_size::log2
@ log2
block size is proportional to log2(file size)
Definition delta_sig_block_size.hpp:53
libdar::delta_sig_block_size::fixed
@ fixed
block size is independant from file size
Definition delta_sig_block_size.hpp:51
libdar::delta_sig_block_size::linear
@ linear
block size if proportionnal to file size
Definition delta_sig_block_size.hpp:52
libdar::delta_sig_block_size::delta_sig_block_size
delta_sig_block_size(const delta_sig_block_size &ref)=default
set the structure to defaults value
libdar::delta_sig_block_size::calculate
U_I calculate(const infinint &filesize) const
calculate the value of the block size given the file size
libdar::delta_sig_block_size::equals_default
bool equals_default()
whether structure has default values
Definition delta_sig_block_size.hpp:79
libdar::delta_sig_block_size::divisor
infinint divisor
function dependently used divisor
Definition delta_sig_block_size.hpp:60
libdar::delta_sig_block_size::max_block_len
U_I max_block_len
calculated block len will never be higer than that except if this field is set to zero (disabling thi...
Definition delta_sig_block_size.hpp:62
libdar::delta_sig_block_size::reset
void reset()
reset to default value