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

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

cat_entree.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
25
26 #ifndef CAT_ENTREE_HPP
27 #define CAT_ENTREE_HPP
28
29 #include "../my_config.h"
30
31 extern "C"
32 {
33 } // end extern "C"
34
35 #include "infinint.hpp"
36 #include "user_interaction.hpp"
37 #include "pile.hpp"
38 #include "escape.hpp"
39 #include "on_pool.hpp"
40 #include "archive_version.hpp"
41 #include "compressor.hpp"
42 #include "pile_descriptor.hpp"
43 #include "smart_pointer.hpp"
44
45 namespace libdar
46 {
47 class cat_etoile;
48 class cat_entree;
49
52
53 enum saved_status
54 {
55 s_saved, //< inode is saved in the archive
56 s_fake, //< inode is not saved in the archive but is in the archive of reference (isolation context) s_fake is no more used in archive format "08" and above: isolated catalogue do keep the data pointers and s_saved stays a valid status in isolated catalogues.
57 s_not_saved //< inode is not saved in the archive
58 };
59
61 struct entree_stats
62 {
63 infinint num_x; //< number of file referenced as destroyed since last backup
64 infinint num_d; //< number of directories
65 infinint num_f; //< number of plain files (hard link or not, thus file directory entries)
66 infinint num_c; //< number of char devices
67 infinint num_b; //< number of block devices
68 infinint num_p; //< number of named pipes
69 infinint num_s; //< number of unix sockets
70 infinint num_l; //< number of symbolic links
71 infinint num_D; //< number of Door
72 infinint num_hard_linked_inodes; //< number of inode that have more than one link (inode with "hard links")
73 infinint num_hard_link_entries; //< total number of hard links (file directory entry pointing to \an
74 //< inode already linked in the same or another directory (i.e. hard linked))
75 infinint saved; //< total number of saved inode (unix inode, not inode class) hard links do not count here
76 infinint total; //< total number of inode in archive (unix inode, not inode class) hard links do not count here
77 void clear() { num_x = num_d = num_f = num_c = num_b = num_p
78 = num_s = num_l = num_D = num_hard_linked_inodes
79 = num_hard_link_entries = saved = total = 0; };
80 void add(const cat_entree *ref);
81 void listing(user_interaction & dialog) const;
82 };
83
85 class cat_entree : public on_pool
86 {
87 public :
100 static cat_entree *read(user_interaction & dialog,
101 memory_pool *pool,
102 const smart_pointer<pile_descriptor> & f,
103 const archive_version & reading_ver,
104 entree_stats & stats,
105 std::map <infinint, cat_etoile *> & corres,
106 compression default_algo,
107 bool lax,
108 bool only_detruit,
109 bool small);
110
116 cat_entree(const smart_pointer<pile_descriptor> & pdesc, bool small);
117
118 // copy constructor is fine as we only copy the address of pointers
119
120 // assignment operator is fine too for the same reason
121
123 cat_entree() {};
124
126 virtual ~cat_entree() throw(Ebug) {};
127
129 virtual bool operator == (const cat_entree & ref) const { return true; };
130 bool operator != (const cat_entree & ref) const { return ! (*this == ref); };
131
136 void dump(const pile_descriptor & pdesc, bool small) const;
137
142 void specific_dump(const pile_descriptor & pdesc, bool small) const { inherited_dump(pdesc, small); };
143
149 virtual void post_constructor(const pile_descriptor & pdesc) {};
150
152 virtual unsigned char signature() const = 0;
153
155 virtual cat_entree *clone() const = 0;
156
164 virtual void change_location(const smart_pointer<pile_descriptor> & pdesc);
165
166
167 protected:
169 virtual void inherited_dump(const pile_descriptor & pdesc, bool small) const;
170
171
173 pile *get_pile() const { return pdesc.is_null() ? nullptr : pdesc->stack; };
174
180 compressor *get_compressor_layer() const { return pdesc.is_null() ? nullptr : pdesc->compr; };
181
187 escape *get_escape_layer() const { return pdesc.is_null() ? nullptr : pdesc->esc; };
188
190 generic_file *get_read_cat_layer(bool small) const;
191
192 private:
193 static const U_I ENTREE_CRC_SIZE;
194
195 smart_pointer<pile_descriptor> pdesc;
196 };
197
199
200 } // end of namespace
201
202 #endif
libdar::on_pool
Definition: on_pool.hpp:52
libdar::cat_entree::~cat_entree
virtual ~cat_entree()
destructor
Definition: cat_entree.hpp:126
libdar::entree_stats
holds the statistics contents of a catalogue
Definition: cat_entree.hpp:61
libdar::cat_entree::get_read_cat_layer
generic_file * get_read_cat_layer(bool small) const
return the adhoc layer in the stack to read from the catalogue objects (except the EA...
pile.hpp
class pile definition. Used to manage a stack of generic_file objects
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::cat_entree::get_compressor_layer
compressor * get_compressor_layer() const
Definition: cat_entree.hpp:180
libdar::cat_entree::get_pile
pile * get_pile() const
stack used to read object from (nullptr is returned for object created from filesystem) ...
Definition: cat_entree.hpp:173
libdar::cat_entree::clone
virtual cat_entree * clone() const =0
a way to copy the exact type of an object even if pointed to by a parent class pointer ...
libdar::cat_entree::specific_dump
void specific_dump(const pile_descriptor &pdesc, bool small) const
Definition: cat_entree.hpp:142
libdar::cat_entree::read
static cat_entree * read(user_interaction &dialog, memory_pool *pool, const smart_pointer< pile_descriptor > &f, const archive_version &reading_ver, entree_stats &stats, std::map< infinint, cat_etoile * > &corres, compression default_algo, bool lax, bool only_detruit, bool small)
libdar::cat_entree::signature
virtual unsigned char signature() const =0
inherited class signature
user_interaction.hpp
defines the interaction between libdar and the user.Three classes are defined
escape.hpp
class escape definition, used for sequential reading of archivesThe class escape is used to insert es...
libdar::cat_entree::operator==
virtual bool operator==(const cat_entree &ref) const
returns true if the two object have the same content
Definition: cat_entree.hpp:129
pile_descriptor.hpp
optimization structure to quickly access some commonly used layers of a stack of generic_file ...
smart_pointer.hpp
template class implementing memory efficient smart pointer
libdar::cat_entree::inherited_dump
virtual void inherited_dump(const pile_descriptor &pdesc, bool small) const
inherited class may overload this method but shall first call the parent's inherited_dump() in the ov...
infinint.hpp
switch module to limitint (32 ou 64 bits integers) or infinint
libdar::cat_entree::get_escape_layer
escape * get_escape_layer() const
Definition: cat_entree.hpp:187
libdar::compressor
compression class for gzip and bzip2 algorithms
Definition: compressor.hpp:67
libdar::smart_pointer< pile_descriptor >
libdar::Ebug
exception used to signal a bug. A bug is triggered when reaching some code that should never be reach...
Definition: erreurs.hpp:137
libdar::compression
compression
the different compression algorithm available
Definition: compressor.hpp:43
libdar::generic_file
this is the interface class from which all other data transfer classes inherit
Definition: generic_file.hpp:100
libdar::cat_entree::dump
void dump(const pile_descriptor &pdesc, bool small) const
compressor.hpp
compression engine implementation
libdar::cat_entree::change_location
virtual void change_location(const smart_pointer< pile_descriptor > &pdesc)
archive_version.hpp
class archive_version that rules which archive format to follow
on_pool.hpp
this is the base class of object that can be allocated on a memory pool
libdar::infinint
the arbitrary large positive integer class
Definition: real_infinint.hpp:59
libdar::archive_version
class archive_version manages the version of the archive format
Definition: archive_version.hpp:44
libdar::cat_entree
the root class from all other inherite for any entry in the catalogue
Definition: cat_entree.hpp:85
libdar::cat_entree::cat_entree
cat_entree()
setup an object when read from filesystem
Definition: cat_entree.hpp:123
libdar::cat_entree::post_constructor
virtual void post_constructor(const pile_descriptor &pdesc)
Definition: cat_entree.hpp:149
libdar::smart_pointer::is_null
bool is_null() const
return whether the smart_pointer is pointing to nullptr
Definition: smart_pointer.hpp:140
libdar
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47