![]() |
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 SEMAPHORE_HPP 00027 #define SEMAPHORE_HPP 00028 00029 #include "../my_config.h" 00030 00031 #include "mem_ui.hpp" 00032 #include "mask.hpp" 00033 #include "catalogue.hpp" 00034 #include "on_pool.hpp" 00035 00036 namespace libdar 00037 { 00038 00041 00043 00064 00065 00066 class semaphore : public mem_ui, public on_pool 00067 { 00068 public: 00069 00071 00078 semaphore(const user_interaction & dialog, 00079 const std::string & backup_hook_file_execute, 00080 const mask & backup_hook_file_mask); 00081 00083 semaphore(const semaphore & ref) : mem_ui(ref.get_ui()) { copy_from(ref); }; 00084 00086 semaphore & operator = (const semaphore & ref) { detruit(); copy_from(ref); return *this; }; 00087 00089 ~semaphore() { detruit(); }; 00090 00092 00101 void raise(const std::string & path, 00102 const cat_entree *object, 00103 bool data_to_save); 00104 00106 void lower(); 00107 00108 private: 00109 infinint count; //< is the number of subdirectories currently saved in the last directory that matched the mask 00110 std::string chem; //< path of the file that has to be call in the "end" context when count will drop to zero 00111 std::string filename; //< filename of that same file 00112 infinint uid; //< UID of that same file 00113 infinint gid; //< GID of that same file 00114 std::string execute; //< command to execute 00115 const mask *match; //< for which file to run the execute command 00116 00117 std::string build_string(const std::string & context); 00118 void copy_from(const semaphore & ref); 00119 void detruit(); 00120 }; 00121 00123 00124 } // end of namespace 00125 00126 #endif