Stxxl  1.3.2
wfs_file_base.h
1 /***************************************************************************
2  * include/stxxl/bits/io/wfs_file_base.h
3  *
4  * Windows file system file base
5  *
6  * Part of the STXXL. See http://stxxl.sourceforge.net
7  *
8  * Copyright (C) 2005 Roman Dementiev <[email protected]>
9  * Copyright (C) 2008, 2010 Andreas Beckmann <[email protected]>
10  * Copyright (C) 2009, 2010 Johannes Singler <[email protected]>
11  *
12  * Distributed under the Boost Software License, Version 1.0.
13  * (See accompanying file LICENSE_1_0.txt or copy at
14  * http://www.boost.org/LICENSE_1_0.txt)
15  **************************************************************************/
16 
17 #ifndef STXXL_WFSFILEBASE_HEADER
18 #define STXXL_WFSFILEBASE_HEADER
19 
20 #ifdef STXXL_BOOST_CONFIG
21  #include <boost/config.hpp>
22 #endif
23 
24 #ifdef BOOST_MSVC
25 
26 #include <stxxl/bits/io/file.h>
27 #include <stxxl/bits/io/request.h>
28 #include <windows.h>
29 
30 
31 __STXXL_BEGIN_NAMESPACE
32 
35 
37 class wfs_file_base : public virtual file
38 {
39 protected:
40  mutex fd_mutex; // sequentialize function calls involving file_des
41  HANDLE file_des; // file descriptor
42  int mode_; // open mode
43  const std::string filename;
44  offset_type bytes_per_sector;
45  bool locked;
46  wfs_file_base(const std::string & filename, int mode);
47  offset_type _size();
48  void close();
49 
50 public:
51  ~wfs_file_base();
52  offset_type size();
53  void set_size(offset_type newsize);
54  void lock();
55  const char * io_type() const;
56  void remove();
57 };
58 
60 
61 __STXXL_END_NAMESPACE
62 
63 #endif // #ifdef BOOST_MSVC
64 
65 #endif // !STXXL_WFSFILEBASE_HEADER
virtual void set_size(offset_type newsize)=0
Changes the size of the file.
Defines interface of file.
Definition: file.h:90
virtual const char * io_type() const
Identifies the type of I/O implementation.
Definition: file.h:214
virtual offset_type size()=0
Returns size of the file.
virtual void lock()=0
Locks file for reading and writing (acquires a lock in the file system)