Loading...
Searching...
No Matches
elastic.hpp
Go to the documentation of this file.
/*********************************************************************/
// dar - disk archive - a backup/restoration program
// Copyright (C) 2002-2025 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 ELASTIC_HPP
#define ELASTIC_HPP
#include "../my_config.h"
#include "integers.hpp"
#include "infinint.hpp"
#include "generic_file.hpp"
#include "archive_version.hpp"
namespace libdar
{
enum elastic_direction { elastic_forward, elastic_backward };
class elastic
{
public:
elastic(U_32 size);
elastic(const unsigned char *buffer, U_32 size, elastic_direction dir, const archive_version & reading_ver);
elastic(generic_file &f, elastic_direction dir, const archive_version & reading_ver);
elastic(const elastic & ref) = default;
elastic(elastic && ref) noexcept = default;
elastic & operator = (const elastic & ref) = default;
elastic & operator = (elastic && ref) noexcept = default;
~elastic() = default;
U_32 dump(unsigned char *buffer, U_32 size) const;
U_32 get_size() const { return taille; };
static U_I max_length() { return (U_I)(254)*254*254*254 - 1; };
private:
U_32 taille; // max size of elastic buffer is 4GB which is large enough
void randomize(unsigned char *a) const;
U_I base_from_version(const archive_version & reading_ver) const;
unsigned char get_low_mark(const archive_version & reading_ver) const;
unsigned char get_high_mark(const archive_version & reading_ver) const;
unsigned char get_low_mark() const { return 255; };
unsigned char get_high_mark() const { return 254; };
};
} // end of namespace
#endif
archive_version.hpp
class archive_version that rules which archive format to follow
libdar::archive_version
class archive_version manages the version of the archive format
Definition archive_version.hpp:47
libdar::generic_file
this is the interface class from which all other data transfer classes inherit
Definition generic_file.hpp:77
generic_file.hpp
class generic_file is defined here as well as class fichier
libdar::elastic_direction
elastic_direction
reading direction of an elastic buffer
Definition elastic.hpp:44
infinint.hpp
switch module to limitint (32 ou 64 bits integers) or infinint
integers.hpp
are defined here basic integer types that tend to be portable
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