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

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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
59
60 class fichier_global : public generic_file, public thread_cancellation, public mem_ui
61 {
62 public :
63 enum advise
64 {
65 advise_normal, //< no advise given by the application
66 advise_sequential, //< application expect to read the data sequentially
67 advise_random, //< application expect to read the data in random order
68 advise_noreuse, //< application does not expect to read the data more than once
69 advise_willneed, //< application expect to read the data again in near future
70 advise_dontneed //< application will not read the data in near future
71 };
72
77 fichier_global(const user_interaction & dialog, gf_mode mode): generic_file(mode), mem_ui(dialog) {};
78 fichier_global(const fichier_global & ref) : generic_file(ref), thread_cancellation(ref), mem_ui(ref) {};
79
80 // default assignment operator is fine here
81 // default destructor is fine too here
82
84 virtual void change_ownership(const std::string & user, const std::string & group) = 0;
85
87 virtual void change_permission(U_I perm) = 0;
88
90 virtual infinint get_size() const = 0;
91
93 virtual void fadvise(advise adv) const = 0;
94
95 protected :
106 virtual U_I fichier_global_inherited_write(const char *a, U_I size) = 0;
107
108
119 virtual bool fichier_global_inherited_read(char *a, U_I size, U_I & read, std::string & message) = 0;
120
121 private:
122
123 // inherited from generic_file class and relocated as private methods
124 void inherited_write(const char *a, U_I size);
125 U_I inherited_read(char *a, U_I size);
126 };
127
128
130
131 } // end of namespace
132
133 #endif
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
crc.hpp
class crc definition, used to handle Cyclic Redundancy Checks
label.hpp
define the datastructure "label" used to identify slice membership to an archive
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::generic_file::read
U_I read(char *a, U_I size)
read data from the generic_file
libdar::gf_mode
gf_mode
generic_file openning modes
Definition: generic_file.hpp:77
user_interaction.hpp
defines the interaction between libdar and the user.Three classes are defined
libdar::fichier_global::fichier_global_inherited_read
virtual bool fichier_global_inherited_read(char *a, U_I size, U_I &read, std::string &message)=0
libdar::fichier_global::change_permission
virtual void change_permission(U_I perm)=0
change the permission of the file
libdar::fichier_global
abstraction of filesystem files for entrepot
Definition: fichier_global.hpp:60
thread_cancellation.hpp
to be able to cancel libdar operation while running in a given thread.the class thread_cancellation i...
libdar::fichier_global::change_ownership
virtual void change_ownership(const std::string &user, const std::string &group)=0
set the ownership of the file
libdar::thread_cancellation
class to be used as parent to provide checkpoints to inherited classes
Definition: thread_cancellation.hpp:64
libdar::fichier_global::fadvise
virtual void fadvise(advise adv) const =0
set posix_fadvise for the whole file
libdar::fichier_global::fichier_global
fichier_global(const user_interaction &dialog, gf_mode mode)
Definition: fichier_global.hpp:77
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::fichier_global::fichier_global_inherited_write
virtual U_I fichier_global_inherited_write(const char *a, U_I size)=0
libdar
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47
libdar::fichier_global::get_size
virtual infinint get_size() const =0
return the size of the file