Stxxl  1.3.2
ufs_file_base.h
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  *
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_UFSFILEBASE_HEADER
18 #define STXXL_UFSFILEBASE_HEADER
19 
20 #include <stxxl/bits/io/file.h>
21 #include <stxxl/bits/io/request.h>
22 
23 
24 __STXXL_BEGIN_NAMESPACE
25 
28 
30 class ufs_file_base : public virtual file
31 {
32 protected:
33  mutex fd_mutex; // sequentialize function calls involving file_des
34  int file_des; // file descriptor
35  int mode_; // open mode
36  const std::string filename;
37  ufs_file_base(const std::string & filename, int mode);
38  offset_type _size();
39  void close();
40 
41 public:
42  ~ufs_file_base();
43  offset_type size();
44  void set_size(offset_type newsize);
45  void lock();
46  const char * io_type() const;
47  void remove();
48 };
49 
51 
52 __STXXL_END_NAMESPACE
53 
54 #endif // !STXXL_UFSFILEBASE_HEADER
void lock()
Locks file for reading and writing (acquires a lock in the file system)
Definition: ufs_file_base.cpp:118
Base for UNIX file system implementations.
Definition: ufs_file_base.h:30
Defines interface of file.
Definition: file.h:90
offset_type size()
Returns size of the file.
Definition: ufs_file_base.cpp:146
const char * io_type() const
Identifies the type of I/O implementation.
Definition: ufs_file_base.cpp:31
void set_size(offset_type newsize)
Changes the size of the file.
Definition: ufs_file_base.cpp:152