1 /*********************************************************************/
2 // dar - disk archive - a backup/restoration program
3 // Copyright (C) 2002-2052 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18 //
19 // to contact the author : http://dar.linux.free.fr/email.html
20 /*********************************************************************/
21 
22     /// \file cat_device.hpp
23     /// \brief parent class for all special devices inodes
24     /// \ingroup Private
25 
26 #ifndef CAT_DEVICE_HPP
27 #define CAT_DEVICE_HPP
28 
29 #include "../my_config.h"
30 
31 extern "C"
32 {
33 } // end extern "C"
34 
35 #include "cat_inode.hpp"
36 #include "integers.hpp"
37 
38 namespace libdar
39 {
40 
41 	/// \addtogroup Private
42 	/// @{
43 
44 	/// the special cat_device root class
45     class cat_device : public cat_inode
46     {
47     public :
48         cat_device(const infinint & uid, const infinint & gid, U_16 perm,
49 		   const datetime & last_access,
50 		   const datetime & last_modif,
51 		   const datetime &last_change,
52 		   const std::string & name,
53 		   U_16 major,
54 		   U_16 minor,
55 		   const infinint & fs_device);
56         cat_device(user_interaction & dialog,
57 		   const smart_pointer<pile_descriptor> & pdesc,
58 		   const archive_version & reading_ver,
59 		   saved_status saved,
60 		   bool small);
61 
62 	bool operator == (const cat_entree & ref) const;
63 
get_major() const64         int get_major() const { if(get_saved_status() != s_saved) throw SRC_BUG; else return xmajor; };
get_minor() const65         int get_minor() const { if(get_saved_status() != s_saved) throw SRC_BUG; else return xminor; };
set_major(int x)66         void set_major(int x) { xmajor = x; };
set_minor(int x)67         void set_minor(int x) { xminor = x; };
68 
69             // using method is_more_recent_than() from cat_inode class
70             // using method has_changed_since() from cat_inode class
71             // signature is left pure abstract
72 
73     protected :
74         void sub_compare(const cat_inode & other, bool isolated_mode) const;
75         void inherited_dump(const pile_descriptor & pdesc, bool small) const;
76 
77     private :
78         U_16 xmajor, xminor;
79     };
80 
81 	/// @}
82 
83 } // end of namespace
84 
85 #endif
86