STXXL  1.4.0
 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 
27 
29 
30 //! \addtogroup fileimpl
31 //! \{
32 
33 //! Base for UNIX file system implementations.
34 class ufs_file_base : public virtual file
35 {
36 protected:
37  mutex fd_mutex; // sequentialize function calls involving file_des
38  int file_des; // file descriptor
39  int m_mode; // open mode
40  const std::string filename;
41  bool m_is_device; //!< is special device node
42  ufs_file_base(const std::string& filename, int mode);
43  void _after_open();
44  offset_type _size();
45  void _set_size(offset_type newsize);
46  void close();
47 
48 public:
49  ~ufs_file_base();
50  offset_type size();
51  void set_size(offset_type newsize);
52  void lock();
53  const char * io_type() const;
54  void close_remove();
55  //! unlink file without closing it.
56  void unlink();
57  //! return true if file is special device node
58  bool is_device() const;
59 };
60 
61 //! \}
62 
64 
65 #endif // !STXXL_IO_UFS_FILE_BASE_HEADER
const std::string filename
Definition: ufs_file_base.h:40
Defines interface of file.
Definition: file.h:52
#define STXXL_BEGIN_NAMESPACE
Definition: namespace.h:16
bool m_is_device
is special device node
Definition: ufs_file_base.h:41
Base for UNIX file system implementations.
Definition: ufs_file_base.h:34
request::offset_type offset_type
the offset of a request, also the size of the file
Definition: file.h:64
#define STXXL_END_NAMESPACE
Definition: namespace.h:17