Loading...
Searching...
No Matches
cat_etoile.hpp
Go to the documentation of this file.
/*********************************************************************/
// dar - disk archive - a backup/restoration program
// Copyright (C) 2002-2026 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 CAT_ETOILE_HPP
#define CAT_ETOILE_HPP
#include "../my_config.h"
extern "C"
{
} // end extern "C"
#include <list>
#include "cat_inode.hpp"
namespace libdar
{
class cat_etoile
{
public:
cat_etoile(cat_inode *host, const infinint & etiquette_number);
cat_etoile(const cat_etoile & ref) = delete; // copy constructor not allowed for this class
cat_etoile(cat_etoile && ref) = delete;
cat_etoile & operator = (const cat_etoile & ref) = delete; // assignment not allowed for this class
cat_etoile & operator = (cat_etoile && ref) = delete;
~cat_etoile() { delete hosted; };
void add_ref(void *ref);
void drop_ref(void *ref);
infinint get_ref_count() const { return refs.size(); };
cat_inode *get_inode() const { return hosted; };
infinint get_etiquette() const { return etiquette; };
void change_etiquette(const infinint & new_val) { etiquette = new_val; };
void disable_reduction_to_normal_inode() { tags.reduceable = 0; };
bool cannot_reduce_to_normal_inode() const { return tags.reduceable == 0; };
bool is_counted() const { return tags.counted; };
bool is_wrote() const { return tags.wrote; };
bool is_dumped() const { return tags.dumped; };
void set_counted(bool val) { tags.counted = val ? 1 : 0; };
void set_wrote(bool val) { tags.wrote = val ? 1 : 0; };
void set_dumped(bool val) { tags.dumped = val ? 1 : 0; };
// return the address of the first mirage that triggered the creation of this mirage
// if this object is destroyed afterward this call returns nullptr
const void *get_first_ref() const { if(refs.size() == 0) throw SRC_BUG; return refs.front(); };
private:
struct bool_tags
{
unsigned counted : 1;
unsigned wrote : 1;
unsigned dumped : 1;
unsigned reduceable : 1;
unsigned : 4;
bool_tags() { counted = wrote = dumped = 0; reduceable = 1; };
};
std::list<void *> refs;
cat_inode *hosted;
infinint etiquette;
bool_tags tags;
};
} // end of namespace
#endif
cat_inode.hpp
base object for all inode types, managed EA and FSA, dates, permissions, ownership,...
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