STXXL  1.4-dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ufs_file_base.h
Go to the documentation of this file.
1 /***************************************************************************
2  * include/stxxl/bits/io/ufs_file_base.h
3  *
4  * UNIX file system file base
5  *
6  * Part of the STXXL. See http://stxxl.sourceforge.net
7  *
8  * Copyright (C) 2002 Roman Dementiev <[email protected]>
9  * Copyright (C) 2008 Andreas Beckmann <[email protected]>
10  * Copyright (C) 2009 Johannes Singler <[email protected]>
11  * Copyright (C) 2013 Timo Bingmann <[email protected]>
12  *
13  * Distributed under the Boost Software License, Version 1.0.
14  * (See accompanying file LICENSE_1_0.txt or copy at
15  * http://www.boost.org/LICENSE_1_0.txt)
16  **************************************************************************/
17 
18 #ifndef STXXL_IO_UFS_FILE_BASE_HEADER
19 #define STXXL_IO_UFS_FILE_BASE_HEADER
20 
22 #include <stxxl/bits/io/file.h>
23 #include <stxxl/bits/namespace.h>
24 
25 #include <string>
26 
28 
29 //! \addtogroup fileimpl
30 //! \{
31 
32 //! Base for UNIX file system implementations.
33 class ufs_file_base : public virtual file
34 {
35 protected:
36  mutex fd_mutex; // sequentialize function calls involving file_des
37  int file_des; // file descriptor
38  int m_mode; // open mode
39  const std::string filename;
40  bool m_is_device; //!< is special device node
41  ufs_file_base(const std::string& filename, int mode);
42  void _after_open();
43  offset_type _size();
44  void _set_size(offset_type newsize);
45  void close();
46 
47 public:
48  ~ufs_file_base();
49  offset_type size();
50  void set_size(offset_type newsize);
51  void lock();
52  const char * io_type() const;
53  void close_remove();
54  //! unlink file without closing it.
55  void unlink();
56  //! return true if file is special device node
57  bool is_device() const;
58 };
59 
60 //! \}
61 
63 
64 #endif // !STXXL_IO_UFS_FILE_BASE_HEADER
const std::string filename
Definition: ufs_file_base.h:39
Defines interface of file.
Definition: file.h:56
#define STXXL_BEGIN_NAMESPACE
Definition: namespace.h:16
bool m_is_device
is special device node
Definition: ufs_file_base.h:40
Base for UNIX file system implementations.
Definition: ufs_file_base.h:33
request::offset_type offset_type
the offset of a request, also the size of the file
Definition: file.h:60
#define STXXL_END_NAMESPACE
Definition: namespace.h:17