Disk ARchive  2.5.0
Full featured and portable backup and archiving tool
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
fichier_global.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 
27 
29 
30 #ifndef FICHIER_GLOBAL_HPP
31 #define FICHIER_GLOBAL_HPP
32 
33 
34 #include "../my_config.h"
35 
36 extern "C"
37 {
38 #if HAVE_UNISTD_H
39 #include <unistd.h>
40 #endif
41 } // end extern "C"
42 
43 #include "integers.hpp"
44 #include "thread_cancellation.hpp"
45 #include "label.hpp"
46 #include "crc.hpp"
47 #include "user_interaction.hpp"
48 #include "mem_ui.hpp"
49 
50 #include <string>
51 
52 namespace libdar
53 {
54 
57 
58  class fichier_global : public generic_file, public thread_cancellation, public mem_ui
59  {
60  public :
61  enum advise
62  {
63  advise_normal, //< no advise given by the application
64  advise_sequential, //< application expect to read the data sequentially
65  advise_random, //< application expect to read the data in random order
66  advise_noreuse, //< application does not expect to read the data more than once
67  advise_willneed, //< application expect to read the data again in near future
68  advise_dontneed //< application will not read the data in near future
69  };
70 
75  fichier_global(const user_interaction & dialog, gf_mode mode): generic_file(mode), mem_ui(dialog) {};
76  fichier_global(const fichier_global & ref) : generic_file(ref), thread_cancellation(ref), mem_ui(ref) {};
77 
78  // default assignment operator is fine here
79  // default destructor is fine too here
80 
82  virtual void change_ownership(const std::string & user, const std::string & group) = 0;
83 
85  virtual void change_permission(U_I perm) = 0;
86 
88  virtual infinint get_size() const = 0;
89 
91  virtual void fadvise(advise adv) const = 0;
92 
93  protected :
104  virtual U_I fichier_global_inherited_write(const char *a, U_I size) = 0;
105 
106 
117  virtual bool fichier_global_inherited_read(char *a, U_I size, U_I & read, std::string & message) = 0;
118 
119  private:
120 
121  // inherited from generic_file class and relocated as private methods
122  void inherited_write(const char *a, U_I size);
123  U_I inherited_read(char *a, U_I size);
124  };
125 
126 
128 
129 } // end of namespace
130 
131 #endif
class mem_ui definition. This class is to be used as parent class to handle user_interaction object m...
are defined here basic integer types that tend to be portable
class crc definition, used to handle Cyclic Redundancy Checks
define the datastructure &quot;label&quot; used to identify slice membership to an archive
gf_mode
generic_file openning modes
defines the interaction between libdar and the user.Three classes are defined
to be able to cancel libdar operation while running in a given thread.the class thread_cancellation i...
mem_ui(const user_interaction &dialog)
constructor
Definition: mem_ui.hpp:62
generic_file(gf_mode m)
main constructor
thread_cancellation()
the constructor