Loading...
Searching...
No Matches
semaphore.hpp
Go to the documentation of this file.
/*********************************************************************/
// dar - disk archive - a backup/restoration program
// Copyright (C) 2002-2024 Denis Corbin
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// to contact the author, see the AUTHOR file
/*********************************************************************/
#ifndef SEMAPHORE_HPP
#define SEMAPHORE_HPP
#include "../my_config.h"
#include "mem_ui.hpp"
#include "mask.hpp"
namespace libdar
{
class semaphore : public mem_ui
{
public:
semaphore(const std::shared_ptr<user_interaction> & dialog,
const std::string & backup_hook_file_execute,
const mask & backup_hook_file_mask);
semaphore(const semaphore & ref) : mem_ui(ref) { copy_from(ref); };
semaphore(semaphore && ref) noexcept: mem_ui(std::move(ref)) { nullifyptr(); move_from(std::move(ref)); };
semaphore & operator = (const semaphore & ref) { detruit(); copy_from(ref); return *this; };
semaphore & operator = (semaphore && ref) noexcept { move_from(std::move(ref)); return *this; };
~semaphore() { detruit(); };
void raise(const std::string & path,
const cat_entree *object,
bool data_to_save);
void lower();
private:
infinint count;
std::string chem;
std::string filename;
infinint uid;
infinint gid;
unsigned char sig;
std::string execute;
const mask *match;
void nullifyptr() noexcept { match = nullptr; };
std::string build_string(const std::string & context);
void copy_from(const semaphore & ref);
void move_from(semaphore && ref) noexcept;
void detruit();
};
} // end of namespace
#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
class mem_ui to keep a copy of a user_interaction object
Definition mem_ui.hpp:55
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...
libdar
libdar namespace encapsulate all libdar symbols
Definition archive.hpp:47