Disk ARchive  2.5.2
Full featured and portable backup and archiving tool
slice_layout.hpp
Go to the documentation of this file.
00001 /*********************************************************************/
00002 // dar - disk archive - a backup/restoration program
00003 // Copyright (C) 2002-2052 Denis Corbin
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018 //
00019 // to contact the author : http://dar.linux.free.fr/email.html
00020 /*********************************************************************/
00021 
00025 
00026 
00027 #ifndef SLICE_LAYOUT_HPP
00028 #define SLICE_LAYOUT_HPP
00029 
00030 #include <string>
00031 #include <set>
00032 
00033 #include "../my_config.h"
00034 #include "infinint.hpp"
00035 #include "generic_file.hpp"
00036 #include "on_pool.hpp"
00037 
00038 namespace libdar
00039 {
00040 
00041     class slice_layout : public on_pool
00042     {
00043     public:
00044         // field still exposed (slice_layout was a struct before being a class)
00045         // we keep these fields as is for now
00046 
00047     infinint first_size;         //< size of the first slice
00048     infinint other_size;         //< maximum size of other slices
00049     infinint first_slice_header; //< size of the slice header in the first slice
00050     infinint other_slice_header; //< size of the slice header in the other slices
00051     bool older_sar_than_v8;      //< true if the archive format is older than version 8
00052 
00053     void read(generic_file & f);
00054     void write(generic_file & f) const;
00055     void clear();
00056 
00063     void which_slice(const infinint & offset,
00064              infinint & slice_num,
00065              infinint & slice_offset) const;
00066 
00067     private:
00068     static const char OLDER_THAN_V8 = '7';
00069     static const char V8 = '8';
00070     };
00071 
00072 } // end of namespace
00073 
00074 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines