Stxxl
1.4.0
|
00001 /*************************************************************************** 00002 * include/stxxl/bits/io/ufs_file_base.h 00003 * 00004 * UNIX file system file base 00005 * 00006 * Part of the STXXL. See http://stxxl.sourceforge.net 00007 * 00008 * Copyright (C) 2002 Roman Dementiev <dementiev@mpi-sb.mpg.de> 00009 * Copyright (C) 2008 Andreas Beckmann <beckmann@cs.uni-frankfurt.de> 00010 * Copyright (C) 2009 Johannes Singler <singler@ira.uka.de> 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_UFSFILEBASE_HEADER 00018 #define STXXL_UFSFILEBASE_HEADER 00019 00020 #include <stxxl/bits/io/file.h> 00021 #include <stxxl/bits/io/request.h> 00022 00023 00024 __STXXL_BEGIN_NAMESPACE 00025 00026 //! \addtogroup fileimpl 00027 //! \{ 00028 00029 //! \brief Base for UNIX file system implementations 00030 class ufs_file_base : public virtual file 00031 { 00032 protected: 00033 mutex fd_mutex; // sequentialize function calls involving file_des 00034 int file_des; // file descriptor 00035 int mode_; // open mode 00036 const std::string filename; 00037 ufs_file_base(const std::string & filename, int mode); 00038 offset_type _size(); 00039 void close(); 00040 00041 public: 00042 ~ufs_file_base(); 00043 offset_type size(); 00044 void set_size(offset_type newsize); 00045 void lock(); 00046 const char * io_type() const; 00047 void remove(); 00048 void unlink(); 00049 }; 00050 00051 //! \} 00052 00053 __STXXL_END_NAMESPACE 00054 00055 #endif // !STXXL_UFSFILEBASE_HEADER