Stxxl
1.4.0
|
00001 /*************************************************************************** 00002 * include/stxxl/bits/io/wfs_file_base.h 00003 * 00004 * Windows file system file base 00005 * 00006 * Part of the STXXL. See http://stxxl.sourceforge.net 00007 * 00008 * Copyright (C) 2005 Roman Dementiev <dementiev@ira.uka.de> 00009 * Copyright (C) 2008, 2010 Andreas Beckmann <beckmann@cs.uni-frankfurt.de> 00010 * Copyright (C) 2009, 2010 Johannes Singler <singler@kit.edu> 00011 * 00012 * Distributed under the Boost Software License, Version 1.0. 00013 * (See accompanying file LICENSE_1_0.txt or copy at 00014 * http://www.boost.org/LICENSE_1_0.txt) 00015 **************************************************************************/ 00016 00017 #ifndef STXXL_WFSFILEBASE_HEADER 00018 #define STXXL_WFSFILEBASE_HEADER 00019 00020 #ifdef STXXL_BOOST_CONFIG 00021 #include <boost/config.hpp> 00022 #endif 00023 00024 #ifdef BOOST_MSVC 00025 00026 #include <stxxl/bits/io/file.h> 00027 #include <stxxl/bits/io/request.h> 00028 #include <windows.h> 00029 00030 00031 __STXXL_BEGIN_NAMESPACE 00032 00033 //! \addtogroup fileimpl 00034 //! \{ 00035 00036 //! \brief Base for Windows file system implementations 00037 class wfs_file_base : public virtual file 00038 { 00039 protected: 00040 mutex fd_mutex; // sequentialize function calls involving file_des 00041 HANDLE file_des; // file descriptor 00042 int mode_; // open mode 00043 const std::string filename; 00044 offset_type bytes_per_sector; 00045 bool locked; 00046 wfs_file_base(const std::string & filename, int mode); 00047 offset_type _size(); 00048 void close(); 00049 00050 public: 00051 ~wfs_file_base(); 00052 offset_type size(); 00053 void set_size(offset_type newsize); 00054 void lock(); 00055 const char * io_type() const; 00056 void remove(); 00057 }; 00058 00059 //! \} 00060 00061 __STXXL_END_NAMESPACE 00062 00063 #endif // #ifdef BOOST_MSVC 00064 00065 #endif // !STXXL_WFSFILEBASE_HEADER