 |
Disk ARchive
2.6.8
Full featured and portable backup and archiving tool
|
Go to the documentation of this file.
29 #include "../my_config.h"
49 static constexpr U_I OLD_CRC_SIZE = 2;
52 crc(
const crc & ref) =
default;
53 crc(
crc && ref) noexcept =
default;
54 crc & operator = (
const crc & ref) =
default;
55 crc & operator = (
crc && ref) noexcept =
default;
56 virtual ~
crc() =
default;
58 virtual bool operator == (
const crc & ref)
const = 0;
59 bool operator != (
const crc & ref)
const {
return ! (*
this == ref); };
61 virtual void compute(
const infinint & offset,
const char *buffer, U_I length) = 0;
62 virtual void compute(
const char *buffer, U_I length) = 0;
63 virtual void clear() = 0;
65 virtual std::string crc2str()
const = 0;
66 virtual infinint get_size()
const = 0;
67 virtual crc *clone()
const = 0;
85 crc_i & operator = (
const crc_i & ref) { copy_from(ref);
return *
this; };
86 crc_i & operator = (
crc_i && ref) noexcept =
default;
89 bool operator == (
const crc & ref)
const override;
91 virtual void compute(
const infinint & offset,
const char *buffer, U_I length)
override;
92 virtual void compute(
const char *buffer, U_I length)
override;
93 virtual void clear()
override;
95 virtual std::string crc2str()
const override;
96 virtual infinint get_size()
const override {
return size; };
99 virtual crc *clone()
const override {
crc *tmp =
new (std::nothrow)
crc_i(*
this);
if(tmp ==
nullptr)
throw Ememory(
"crc");
return tmp; };
107 void copy_from(
const crc_i & ref);
108 void copy_data_from(
const crc_i & ref);
123 crc_n & operator = (
crc_n && ref) noexcept =
default;
124 ~
crc_n() { destroy(); };
126 bool operator == (
const crc & ref)
const override;
128 virtual void compute(
const infinint & offset,
const char *buffer, U_I length)
override;
129 virtual void compute(
const char *buffer, U_I length)
override;
130 virtual void clear()
override;
132 virtual std::string crc2str()
const override;
133 virtual infinint get_size()
const override {
return size; };
136 virtual crc *clone()
const override {
crc *tmp =
new (std::nothrow)
crc_n(*
this);
if(tmp ==
nullptr)
throw Ememory(
"crc");
return tmp; };
144 void alloc(U_I width);
145 void copy_from(
const crc_n & ref);
146 void copy_data_from(
const crc_n & ref);
unsigned char * pointer
points to the next byte to modify (non infinint mode)
crc implementation based on infinint
ancestor class of generic_file
are defined here basic integer types that tend to be portable
switch module to limitint (32 ou 64 bits integers) or infinint
the arbitrary large positive integer class
arbitrary large storage structure
precursor class of generic_file used to avoid cyclic dependencies with storage and infinint
storage cyclic
the checksum storage
pure virtual class defining interface of a CRC object
crc * create_crc_from_size(infinint width)
generate a CRC object with adhoc width based on a file size
storage::iterator pointer
points to the next byte to modify
crc * create_crc_from_file(proto_generic_file &f, bool old=false)
generate a CRC object reading it from file
exception used when memory has been exhausted
infinint size
size of the checksum
unsigned char * cyclic
the checksum storage (non infinint mode)
crc implementation based on U_I
contains a class that permits arbitrary large data storage
U_I size
size of checksum (non infinint mode)
libdar namespace encapsulate all libdar symbols