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

Loading...
Searching...
No Matches
semaphore.hpp
Go to the documentation of this file.
1/*********************************************************************/
2// dar - disk archive - a backup/restoration program
3// Copyright (C) 2002-2026 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18//
19// to contact the author, see the AUTHOR file
20/*********************************************************************/
21
25
26#ifndef SEMAPHORE_HPP
27#define SEMAPHORE_HPP
28
29#include "../my_config.h"
30
31#include "mem_ui.hpp"
32#include "mask.hpp"
33
34 namespace libdar
35{
36
39
41
62
63 class semaphore : public mem_ui
64 {
65 public:
66
68
75 semaphore(const std::shared_ptr<user_interaction> & dialog,
76 const std::string & backup_hook_file_execute,
77 const mask & backup_hook_file_mask);
78
80 semaphore(const semaphore & ref) : mem_ui(ref) { copy_from(ref); };
81
83 semaphore(semaphore && ref) noexcept: mem_ui(std::move(ref)) { nullifyptr(); move_from(std::move(ref)); };
84
86 semaphore & operator = (const semaphore & ref) { detruit(); copy_from(ref); return *this; };
87
89 semaphore & operator = (semaphore && ref) noexcept { move_from(std::move(ref)); return *this; };
90
92 ~semaphore() { detruit(); };
93
95
105 void raise(const std::string & path,
106 const cat_entree *object,
107 bool data_to_save);
108
110 void lower();
111
112 private:
113 infinint count;
114 std::string chem;
115 std::string filename;
116 infinint uid;
117 infinint gid;
118 unsigned char sig;
119 std::string execute;
120 const mask *match;
121
122 void nullifyptr() noexcept { match = nullptr; };
123 std::string build_string(const std::string & context);
124 void copy_from(const semaphore & ref);
125 void move_from(semaphore && ref) noexcept;
126 void detruit();
127 };
128
130
131} // end of namespace
132
133#endif
libdar::cat_entree
the root class from all other inherite for any entry in the catalogue
Definition cat_entree.hpp:60
libdar::infinint
the arbitrary large positive integer class
Definition real_infinint.hpp:62
libdar::mask
the generic class, parent of all masks
Definition mask.hpp:62
libdar::mem_ui::mem_ui
mem_ui(const std::shared_ptr< user_interaction > &dialog)
constructor
libdar::path
the class path is here to manipulate paths in the Unix notation: using'/'
Definition path.hpp:51
libdar::semaphore
class semaphore
Definition semaphore.hpp:64
libdar::semaphore::gid
infinint gid
GID of that same file.
Definition semaphore.hpp:117
libdar::semaphore::filename
std::string filename
filename of that same file
Definition semaphore.hpp:115
libdar::semaphore::sig
unsigned char sig
object type
Definition semaphore.hpp:118
libdar::semaphore::semaphore
semaphore(const semaphore &ref)
copy constructor
Definition semaphore.hpp:80
libdar::semaphore::raise
void raise(const std::string &path, const cat_entree *object, bool data_to_save)
to prepare a file for backup
libdar::semaphore::~semaphore
~semaphore()
destructor
Definition semaphore.hpp:92
libdar::semaphore::semaphore
semaphore(semaphore &&ref) noexcept
move constructor
Definition semaphore.hpp:83
libdar::semaphore::lower
void lower()
to tell that the backup is completed for the last "raised" entry.
libdar::semaphore::chem
std::string chem
path of the file that has to be call in the "end" context when count will drop to zero
Definition semaphore.hpp:114
libdar::semaphore::execute
std::string execute
command to execute
Definition semaphore.hpp:119
libdar::semaphore::semaphore
semaphore(const std::shared_ptr< user_interaction > &dialog, const std::string &backup_hook_file_execute, const mask &backup_hook_file_mask)
constructor
libdar::semaphore::count
infinint count
is the number of subdirectories currently saved in the last directory that matched the mask
Definition semaphore.hpp:113
libdar::semaphore::operator=
semaphore & operator=(const semaphore &ref)
assignment operator
Definition semaphore.hpp:86
libdar::semaphore::uid
infinint uid
UID of that same file.
Definition semaphore.hpp:116
libdar::semaphore::match
const mask * match
for which file to run the execute command
Definition semaphore.hpp:120
mask.hpp
here lies a collection of mask classes
mem_ui.hpp
class mem_ui definition. This class is to be used as parent class to handle user_interaction object m...
my_config.h
include macro defined by the configure script and some specific additional ones
libdar
libdar namespace encapsulate all libdar symbols
Definition archive.hpp:47