# zapette.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 : dar.linux@free.fr
    00020 /*********************************************************************/
    00021 // $Id: zapette.hpp,v 1.10.4.2 2009/04/07 08:45:29 edrusb Rel $
    00022 //
    00023 /*********************************************************************/
    00024 //
    00025
    00034
    00035 #ifndef ZAPETTE_HPP
    00036 #define ZAPETTE_HPP
    00037
    00038 #include "../my_config.h"
    00039 #include "infinint.hpp"
    00040 #include "generic_file.hpp"
    00041 #include "integers.hpp"
    00042
    00043 namespace libdar
    00044 {
    00045
    00047
    00052     class zapette : public contextual
    00053     {
    00054     public:
    00055
    00057
    00061         zapette(user_interaction & dialog, generic_file *input, generic_file *output);
    00062         ~zapette();
    00063
    00064             // inherited methods from generic_file
    00065         bool skip(const infinint &pos);
    00066         bool skip_to_eof() { position = file_size; return true; };
    00067         bool skip_relative(S_I x);
    00068         infinint get_position() { return position; };
    00069
    00070             // inherited methods from contextual
    00071         void set_info_status(const std::string & s);
    00072         std::string get_info_status() const { return info; };
    00073
    00074     protected:
    00075         S_I inherited_read(char *a, size_t size);
    00076         S_I inherited_write(const char *a, size_t size);
    00077
    00078     private:
    00079         generic_file *in, *out;
    00080         infinint position, file_size;
    00081         char serial_counter;
    00082         std::string info;
    00083
    00084         void make_transfert(U_16 size, const infinint &offset, char *data, const std::string & info, S_I & lu, infinint & arg);
    00085     };
    00086
    00088
    00092     class slave_zapette
    00093     {
    00094     public:
    00095
    00097
    00101         slave_zapette(generic_file *input, generic_file *output, contextual *data);
    00102         ~slave_zapette();
    00103
    00104
    00106
    00109         void action();
    00110
    00111     private:
    00112         generic_file *in, *out;
    00113         contextual *src;
    00114     };
    00115
    00116 } // end of namespace
    00117
    00118 #endif