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

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

null_file.hpp
Go to the documentation of this file.
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
27
28 #ifndef NULL_FILE_HPP
29 #define NULL_FILE_HPP
30
31 #include "../my_config.h"
32 #include "generic_file.hpp"
33 #include "thread_cancellation.hpp"
34
35 namespace libdar
36 {
37
40
42
49
50 class null_file : public generic_file, public thread_cancellation
51 {
52 public :
53 null_file(gf_mode m) : generic_file(m) {};
54 bool skippable(skippability direction, const infinint & amount) { return true; };
55 bool skip(const infinint &pos) { return true; };
56 bool skip_to_eof() { return true; };
57 bool skip_relative(signed int x) { return false; };
58 infinint get_position() const { return 0; };
59
60 protected :
61 void inherited_read_ahead(const infinint & amount) {};
62
63 U_I inherited_read(char *a, U_I size)
64 {
65 #ifdef MUTEX_WORKS
66 check_self_cancellation();
67 #endif
68 return 0;
69 };
70
71 void inherited_write(const char *a, U_I size)
72 {
73 #ifdef MUTEX_WORKS
74 check_self_cancellation();
75 #endif
76 };
77
78 void inherited_sync_write() {};
79 void inherited_flush_read() {};
80 void inherited_terminate() {};
81 };
82
84
85 } // end of namespace
86
87 #endif
libdar::null_file::skip_to_eof
bool skip_to_eof()
skip to the end of file
Definition: null_file.hpp:56
libdar::null_file::get_position
infinint get_position() const
get the current read/write position
Definition: null_file.hpp:58
generic_file.hpp
class generic_file is defined here as well as class fichierthe generic_file interface is widely used ...
libdar::gf_mode
gf_mode
generic_file openning modes
Definition: generic_file.hpp:77
libdar::null_file
the null_file class implements the /dev/null behavior
Definition: null_file.hpp:50
libdar::null_file::inherited_read
U_I inherited_read(char *a, U_I size)
implementation of read() operation
Definition: null_file.hpp:63
libdar::null_file::inherited_flush_read
void inherited_flush_read()
Definition: null_file.hpp:79
libdar::thread_cancellation::check_self_cancellation
void check_self_cancellation() const
Checkpoint test : whether the current libdar call must abort or not.
libdar::null_file::skippable
bool skippable(skippability direction, const infinint &amount)
Definition: null_file.hpp:54
thread_cancellation.hpp
to be able to cancel libdar operation while running in a given thread.the class thread_cancellation i...
libdar::null_file::inherited_sync_write
void inherited_sync_write()
write down any pending data
Definition: null_file.hpp:78
libdar::generic_file::generic_file
generic_file(gf_mode m)
main constructor
Definition: generic_file.hpp:104
libdar::thread_cancellation
class to be used as parent to provide checkpoints to inherited classes
Definition: thread_cancellation.hpp:64
libdar::null_file::inherited_terminate
void inherited_terminate()
destructor-like call, except that it is allowed to throw exceptions
Definition: null_file.hpp:80
libdar::null_file::skip
bool skip(const infinint &pos)
Definition: null_file.hpp:55
libdar::generic_file
this is the interface class from which all other data transfer classes inherit
Definition: generic_file.hpp:100
libdar::null_file::inherited_write
void inherited_write(const char *a, U_I size)
implementation of the write() operation
Definition: null_file.hpp:71
libdar::infinint
the arbitrary large positive integer class
Definition: real_infinint.hpp:59
libdar::null_file::inherited_read_ahead
void inherited_read_ahead(const infinint &amount)
Definition: null_file.hpp:61
libdar
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47