| Disk ARchive 2.5.10 Full featured and portable backup and archiving tool

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

zapette.hpp
Go to the documentation of this file.
1 /*********************************************************************/
2 // dar - disk archive - a backup/restoration program
3 // Copyright (C) 2002-2052 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 //
19 // to contact the author : http://dar.linux.free.fr/email.html
20 /*********************************************************************/
21
31
32 #ifndef ZAPETTE_HPP
33 #define ZAPETTE_HPP
34
35 #include "../my_config.h"
36 #include "infinint.hpp"
37 #include "generic_file.hpp"
38 #include "integers.hpp"
39 #include "mem_ui.hpp"
40
41 namespace libdar
42 {
43
44
47
49
54 class zapette : public generic_file, public contextual, protected mem_ui
55 {
56 public:
57
59
64 zapette(const user_interaction & dialog, generic_file *input, generic_file *output, bool by_the_end);
65 ~zapette();
66
67 // inherited methods from generic_file
68 bool skippable(skippability direction, const infinint & amount) { return true; };
69 bool skip(const infinint &pos);
70 bool skip_to_eof() { if(is_terminated()) throw SRC_BUG; position = file_size; return true; };
71 bool skip_relative(S_I x);
72 infinint get_position() const { if(is_terminated()) throw SRC_BUG; return position; };
73
74 // overwritten inherited methods from contextual
75 void set_info_status(const std::string & s);
76 bool is_an_old_start_end_archive() const;
77 const label & get_data_name() const;
78
82 infinint get_first_slice_header_size() const;
83
87 infinint get_non_first_slice_header_size() const;
88
89 protected:
90 void inherited_read_ahead(const infinint & amount) {}; // optimization will be done when zapette will use the messaging_encode/decode exchange format
91 U_I inherited_read(char *a, U_I size);
92 void inherited_write(const char *a, U_I size);
93 void inherited_sync_write() {};
94 void inherited_flush_read() {};
95 void inherited_terminate();
96
97 private:
98 generic_file *in, *out;
99 infinint position, file_size;
100 char serial_counter;
101
103
119
120 void make_transfert(U_16 size, const infinint &offset, char *data, const std::string & info, S_I & lu, infinint & arg) const;
121 };
122
124
128 class slave_zapette : public on_pool
129 {
130 public:
131
133
137 slave_zapette(generic_file *input, generic_file *output, generic_file *data);
138 ~slave_zapette();
139
140
142
145 void action();
146
147 private:
148 generic_file *in; //< where to read orders from
149 generic_file *out; //< where to send requested info or data to
150 generic_file *src; //< where to read data from
151 contextual *src_ctxt; //< same as src but seen as contextual
152 };
153
155
156 } // end of namespace
157
158 #endif
libdar::on_pool
Definition: on_pool.hpp:52
libdar::zapette::inherited_write
void inherited_write(const char *a, U_I size)
implementation of the write() operation
mem_ui.hpp
class mem_ui definition. This class is to be used as parent class to handle user_interaction object m...
integers.hpp
are defined here basic integer types that tend to be portable
generic_file.hpp
class generic_file is defined here as well as class fichierthe generic_file interface is widely used ...
libdar::slave_zapette
this class answers to order given by a zapette object
Definition: zapette.hpp:128
libdar::zapette::zapette
zapette(const user_interaction &dialog, generic_file *input, generic_file *output, bool by_the_end)
zapette constructor
libdar::user_interaction
This is a pure virtual class that is used by libdar when interaction with the user is required...
Definition: user_interaction.hpp:98
libdar::zapette::get_position
infinint get_position() const
get the current read/write position
Definition: zapette.hpp:72
libdar::generic_file::is_terminated
bool is_terminated() const
Definition: generic_file.hpp:316
libdar::slave_zapette::slave_zapette
slave_zapette(generic_file *input, generic_file *output, generic_file *data)
slave_zapette constructor
libdar::zapette::inherited_sync_write
void inherited_sync_write()
write down any pending data
Definition: zapette.hpp:93
libdar::zapette::skip
bool skip(const infinint &pos)
libdar::zapette
zapette emulate a file that is remotely controlled by slave_zapette
Definition: zapette.hpp:54
libdar::zapette::skip_to_eof
bool skip_to_eof()
skip to the end of file
Definition: zapette.hpp:70
libdar::zapette::skip_relative
bool skip_relative(S_I x)
skip relatively to the current position
libdar::slave_zapette::action
void action()
main execution method for slave_zapette class
libdar::zapette::inherited_read
U_I inherited_read(char *a, U_I size)
implementation of read() operation
libdar::zapette::inherited_terminate
void inherited_terminate()
destructor-like call, except that it is allowed to throw exceptions
infinint.hpp
switch module to limitint (32 ou 64 bits integers) or infinint
libdar::zapette::get_non_first_slice_header_size
infinint get_non_first_slice_header_size() const
libdar::zapette::inherited_flush_read
void inherited_flush_read()
Definition: zapette.hpp:94
libdar::generic_file
this is the interface class from which all other data transfer classes inherit
Definition: generic_file.hpp:100
libdar::mem_ui
class mem_ui to keep a copy of a user_interaction object
Definition: mem_ui.hpp:53
libdar::infinint
the arbitrary large positive integer class
Definition: real_infinint.hpp:59
libdar::zapette::skippable
bool skippable(skippability direction, const infinint &amount)
Definition: zapette.hpp:68
libdar::zapette::get_first_slice_header_size
infinint get_first_slice_header_size() const
libdar
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47
libdar::zapette::inherited_read_ahead
void inherited_read_ahead(const infinint &amount)
Definition: zapette.hpp:90