Disk ARchive  2.5.10
Full featured and portable backup and archiving tool
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 
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
67 #endif
68  return 0;
69  };
70 
71  void inherited_write(const char *a, U_I size)
72  {
73 #ifdef MUTEX_WORKS
75 #endif
76  };
77 
81  };
82 
84 
85 } // end of namespace
86 
87 #endif
bool skip_to_eof()
skip to the end of file
Definition: null_file.hpp:56
infinint get_position() const
get the current read/write position
Definition: null_file.hpp:58
class generic_file is defined here as well as class fichierthe generic_file interface is widely used ...
gf_mode
generic_file openning modes
the null_file class implements the /dev/null behavior
Definition: null_file.hpp:50
U_I inherited_read(char *a, U_I size)
implementation of read() operation
Definition: null_file.hpp:63
void inherited_flush_read()
Definition: null_file.hpp:79
void check_self_cancellation() const
Checkpoint test : whether the current libdar call must abort or not.
bool skippable(skippability direction, const infinint &amount)
Definition: null_file.hpp:54
to be able to cancel libdar operation while running in a given thread.the class thread_cancellation i...
void inherited_sync_write()
write down any pending data
Definition: null_file.hpp:78
generic_file(gf_mode m)
main constructor
class to be used as parent to provide checkpoints to inherited classes
void inherited_terminate()
destructor-like call, except that it is allowed to throw exceptions
Definition: null_file.hpp:80
bool skip(const infinint &pos)
Definition: null_file.hpp:55
this is the interface class from which all other data transfer classes inherit
void inherited_write(const char *a, U_I size)
implementation of the write() operation
Definition: null_file.hpp:71
the arbitrary large positive integer class
void inherited_read_ahead(const infinint &amount)
Definition: null_file.hpp:61
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47