Disk ARchive  2.6.8
Full featured and portable backup and archiving tool
delta_sig_block_size.hpp
Go to the documentation of this file.
1 /*********************************************************************/
2 // dar - disk archive - a backup/restoration program
3 // Copyright (C) 2002-2020 Denis Corbin
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 //
19 // to contact the author : http://dar.linux.free.fr/email.html
20 /*********************************************************************/
21 
25 
26 #ifndef DELTA_SIG_BLOCK_SIZE_HPP
27 #define DELTA_SIG_BLOCK_SIZE_HPP
28 
29 #include "../my_config.h"
30 
31 extern "C"
32 {
33 } // end extern "C"
34 
35 #include "infinint.hpp"
36 
37 
38 namespace libdar
39 {
41 
44 
45 
47  {
50  {
53  log2,
56  };
57 
58  fs_function_t fs_function; //< the function to use to calculate the signature block len
63 
64  // definitions to help using the struct
65 
66  delta_sig_block_size() { reset(); };
67  delta_sig_block_size(const delta_sig_block_size & ref) = default;
68  delta_sig_block_size(delta_sig_block_size && ref) noexcept = default;
69  delta_sig_block_size & operator = (const delta_sig_block_size & ref) = default;
70  delta_sig_block_size & operator = (delta_sig_block_size && ref) noexcept = default;
71  ~delta_sig_block_size() = default;
72 
73  bool operator == (const delta_sig_block_size & ref) const;
74 
76  void reset();
77 
79  bool equals_default() { return (*this) == delta_sig_block_size(); };
80 
82  void check() const;
83 
85 
88  U_I calculate(const infinint & filesize) const;
89 
90  };
91 
92 
93 } // end of namespace
94 
95 #endif
libdar::delta_sig_block_size::reset
void reset()
reset to default value
libdar::delta_sig_block_size::fixed
block size is independant from file size
Definition: delta_sig_block_size.hpp:51
infinint.hpp
switch module to limitint (32 ou 64 bits integers) or infinint
libdar::delta_sig_block_size::square3
block size if proportional to filesize^3
Definition: delta_sig_block_size.hpp:55
libdar::infinint
the arbitrary large positive integer class
Definition: real_infinint.hpp:61
libdar::delta_sig_block_size::log2
block size is proportional to log2(file size)
Definition: delta_sig_block_size.hpp:53
libdar::delta_sig_block_size::multiplier
infinint multiplier
function dependently used multiplier
Definition: delta_sig_block_size.hpp:59
libdar::delta_sig_block_size::divisor
infinint divisor
function dependently used divisor
Definition: delta_sig_block_size.hpp:60
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:46
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::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::calculate
U_I calculate(const infinint &filesize) const
calculate the value of the block size given the file size
libdar::delta_sig_block_size::square2
block size is proportional to filesize^2
Definition: delta_sig_block_size.hpp:54
libdar::delta_sig_block_size::check
void check() const
check the sanity of the provided values
libdar::delta_sig_block_size::linear
block size if proportionnal to file size
Definition: delta_sig_block_size.hpp:52
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::fs_function_t
fs_function_t
defines the function to use to derivate block size from file size
Definition: delta_sig_block_size.hpp:49
libdar
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:46