Thrill  0.1
mmap_file.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * foxxll/io/mmap_file.hpp
3  *
4  * Part of FOXXLL. See http://foxxll.org
5  *
6  * Copyright (C) 2002 Roman Dementiev <[email protected]>
7  * Copyright (C) 2008 Andreas Beckmann <[email protected]>
8  * Copyright (C) 2009 Johannes Singler <[email protected]>
9  *
10  * Distributed under the Boost Software License, Version 1.0.
11  * (See accompanying file LICENSE_1_0.txt or copy at
12  * http://www.boost.org/LICENSE_1_0.txt)
13  **************************************************************************/
14 
15 #ifndef FOXXLL_IO_MMAP_FILE_HEADER
16 #define FOXXLL_IO_MMAP_FILE_HEADER
17 
18 #include <foxxll/config.hpp>
19 
20 #if FOXXLL_HAVE_MMAP_FILE
21 
22 #include <string>
23 
26 
27 namespace foxxll {
28 
29 //! \addtogroup foxxll_fileimpl
30 //! \{
31 
32 //! Implementation of memory mapped access file.
33 class mmap_file final : public ufs_file_base, public disk_queued_file
34 {
35 public:
36  //! Constructs file object.
37  //! \param filename path of file
38  //! \param mode open mode, see \c foxxll::file::open_modes
39  //! \param queue_id disk queue identifier
40  //! \param allocator_id linked disk_allocator
41  //! \param device_id physical device identifier
42  //! \param file_stats file-specific stats
43  inline mmap_file(
44  const std::string& filename,
45  int mode,
46  int queue_id = DEFAULT_QUEUE,
47  int allocator_id = NO_ALLOCATOR,
48  unsigned int device_id = DEFAULT_DEVICE_ID,
49  file_stats* file_stats = nullptr)
50  : file(device_id, file_stats),
51  ufs_file_base(filename, mode),
52  disk_queued_file(queue_id, allocator_id)
53  { }
54  void serve(void* buffer, offset_type offset, size_type bytes,
55  request::read_or_write op) final;
56  const char * io_type() const final;
57 };
58 
59 //! \}
60 
61 } // namespace foxxll
62 
63 #endif // #if FOXXLL_HAVE_MMAP_FILE
64 
65 #endif // !FOXXLL_IO_MMAP_FILE_HEADER
66 
67 /**************************************************************************/
FOXXLL library namespace
std::basic_string< char, std::char_traits< char >, Allocator< char > > string
string with Manager tracking
Definition: allocator.hpp:220
static const size_t bytes
number of bytes in uint_pair
Definition: uint_types.hpp:75