![]() |
Disk ARchive
2.5.2
Full featured and portable backup and archiving tool
|
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 : http://dar.linux.free.fr/email.html 00020 /*********************************************************************/ 00021 00025 00026 #ifndef CAT_MIRAGE_HPP 00027 #define CAT_MIRAGE_HPP 00028 00029 #include "../my_config.h" 00030 00031 extern "C" 00032 { 00033 } // end extern "C" 00034 00035 #include "cat_nomme.hpp" 00036 #include "cat_etoile.hpp" 00037 00038 namespace libdar 00039 { 00040 00043 00045 00047 class cat_mirage : public cat_nomme 00048 { 00049 public: 00050 enum mirage_format {fmt_mirage, //< new format 00051 fmt_hard_link, //< old dual format 00052 fmt_file_etiquette }; //< old dual format 00053 00054 cat_mirage(const std::string & name, cat_etoile *ref) : cat_nomme(name) { star_ref = ref; if(ref == nullptr) throw SRC_BUG; star_ref->add_ref(this); }; 00055 cat_mirage(user_interaction & dialog, 00056 const pile_descriptor & pdesc, 00057 const archive_version & reading_ver, 00058 saved_status saved, 00059 entree_stats & stats, 00060 std::map <infinint, cat_etoile *> & corres, 00061 compression default_algo, 00062 mirage_format fmt, 00063 bool lax, 00064 bool small); 00065 cat_mirage(user_interaction & dialog, 00066 const pile_descriptor & pdesc, 00067 const archive_version & reading_ver, 00068 saved_status saved, 00069 entree_stats & stats, 00070 std::map <infinint, cat_etoile *> & corres, 00071 compression default_algo, 00072 bool lax, 00073 bool small); 00074 cat_mirage(const cat_mirage & ref) : cat_nomme (ref) { star_ref = ref.star_ref; if(star_ref == nullptr) throw SRC_BUG; star_ref->add_ref(this); }; 00075 const cat_mirage & operator = (const cat_mirage & ref); 00076 ~cat_mirage() { star_ref->drop_ref(this); }; 00077 00078 bool operator == (const cat_entree & ref) const; 00079 00080 unsigned char signature() const { return 'm'; }; 00081 cat_entree *clone() const { return new (get_pool()) cat_mirage(*this); }; 00082 00083 cat_inode *get_inode() const { if(star_ref == nullptr) throw SRC_BUG; return star_ref->get_inode(); }; 00084 infinint get_etiquette() const { return star_ref->get_etiquette(); }; 00085 infinint get_etoile_ref_count() const { return star_ref->get_ref_count(); }; 00086 cat_etoile *get_etoile() const { return star_ref; }; 00087 00088 bool is_inode_counted() const { return star_ref->is_counted(); }; 00089 bool is_inode_wrote() const { return star_ref->is_wrote(); }; 00090 bool is_inode_dumped() const { return star_ref->is_dumped(); }; 00091 void set_inode_counted(bool val) const { star_ref->set_counted(val); }; 00092 void set_inode_wrote(bool val) const { star_ref->set_wrote(val); }; 00093 void set_inode_dumped(bool val) const { star_ref->set_dumped(val); }; 00094 00095 void post_constructor(const pile_descriptor & pdesc); 00096 00098 bool is_first_mirage() const { return star_ref->get_first_ref() == this; }; 00099 00100 // overwriting virtual method from cat_entree 00101 virtual void change_location(const pile_descriptor & pdesc) { get_inode()->change_location(pdesc); }; 00102 00103 protected: 00104 void inherited_dump(const pile_descriptor & pdesc, bool small) const; 00105 00106 private: 00107 cat_etoile *star_ref; 00108 00109 void init(user_interaction & dialog, 00110 const pile_descriptor & pdesc, 00111 const archive_version & reading_ver, 00112 saved_status saved, 00113 entree_stats & stats, 00114 std::map <infinint, cat_etoile *> & corres, 00115 compression default_algo, 00116 mirage_format fmt, 00117 bool lax, 00118 bool small); 00119 }; 00120 00122 00123 } // end of namespace 00124 00125 #endif