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

Loading...
Searching...
No Matches
cat_etoile.hpp
Go to the documentation of this file.
1/*********************************************************************/
2// dar - disk archive - a backup/restoration program
3// Copyright (C) 2002-2025 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 CAT_ETOILE_HPP
27#define CAT_ETOILE_HPP
28
29#include "../my_config.h"
30
31 extern "C"
32{
33} // end extern "C"
34
35#include <list>
36#include "cat_inode.hpp"
37
38 namespace libdar
39{
42
43
45
47 class cat_etoile
48 {
49 public:
50
52
56 cat_etoile(cat_inode *host, const infinint & etiquette_number);
57 cat_etoile(const cat_etoile & ref) = delete; // copy constructor not allowed for this class
58 cat_etoile(cat_etoile && ref) = delete;
59 cat_etoile & operator = (const cat_etoile & ref) = delete; // assignment not allowed for this class
60 cat_etoile & operator = (cat_etoile && ref) = delete;
61 ~cat_etoile() { delete hosted; };
62
63 void add_ref(void *ref);
64 void drop_ref(void *ref);
65 infinint get_ref_count() const { return refs.size(); };
66 cat_inode *get_inode() const { return hosted; };
67 infinint get_etiquette() const { return etiquette; };
68 void change_etiquette(const infinint & new_val) { etiquette = new_val; };
69 void disable_reduction_to_normal_inode() { tags.reduceable = 0; };
70 bool cannot_reduce_to_normal_inode() const { return tags.reduceable == 0; };
71
72 bool is_counted() const { return tags.counted; };
73 bool is_wrote() const { return tags.wrote; };
74 bool is_dumped() const { return tags.dumped; };
75 void set_counted(bool val) { tags.counted = val ? 1 : 0; };
76 void set_wrote(bool val) { tags.wrote = val ? 1 : 0; };
77 void set_dumped(bool val) { tags.dumped = val ? 1 : 0; };
78
79 // return the address of the first mirage that triggered the creation of this mirage
80 // if this object is destroyed afterward this call returns nullptr
81 const void *get_first_ref() const { if(refs.size() == 0) throw SRC_BUG; return refs.front(); };
82
83
84 private:
86 struct bool_tags
87 {
88 unsigned counted : 1;
89 unsigned wrote : 1;
90 unsigned dumped : 1;
91 unsigned reduceable : 1;
92 unsigned : 4;
93
94 bool_tags() { counted = wrote = dumped = 0; reduceable = 1; };
95 };
96
97 std::list<void *> refs;
98 cat_inode *hosted;
99 infinint etiquette;
100 bool_tags tags;
101 };
102
103
105
106} // end of namespace
107
108#endif
cat_inode.hpp
base object for all inode types, managed EA and FSA, dates, permissions, ownership,...
libdar::cat_etoile
the hard link implementation
Definition cat_etoile.hpp:48
libdar::cat_etoile::cat_etoile
cat_etoile(cat_inode *host, const infinint &etiquette_number)
build an object
libdar::cat_etoile::refs
std::list< void * > refs
list of pointers to the mirages objects, in the order of their creation
Definition cat_etoile.hpp:97
libdar::cat_inode
the root class for all cat_inode
Definition cat_inode.hpp:53
libdar::infinint
the arbitrary large positive integer class
Definition real_infinint.hpp:62
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
libdar::cat_etoile::bool_tags
bitfield used to record pointed to inode information
Definition cat_etoile.hpp:87
libdar::cat_etoile::bool_tags::wrote
unsigned wrote
whether the inode has its data copied to archive
Definition cat_etoile.hpp:89
libdar::cat_etoile::bool_tags::dumped
unsigned dumped
whether the inode information has been dumped in the catalogue
Definition cat_etoile.hpp:90
libdar::cat_etoile::bool_tags::counted
unsigned counted
whether the inode has been counted
Definition cat_etoile.hpp:88
libdar::cat_etoile::bool_tags::reduceable
unsigned reduceable
whether the inode can be reduce to normal inode
Definition cat_etoile.hpp:91