Stxxl  1.3.2
mmap_file.h
1 /***************************************************************************
2  * include/stxxl/bits/io/mmap_file.h
3  *
4  * Part of the STXXL. See http://stxxl.sourceforge.net
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 STXXL_MMAP_FILE_HEADER
16 #define STXXL_MMAP_FILE_HEADER
17 
18 #ifndef STXXL_HAVE_MMAP_FILE
19 #ifdef STXXL_BOOST_CONFIG
20  #include <boost/config.hpp>
21 #endif
22 
23 #ifndef BOOST_MSVC
24 // mmap call does not exist in Windows
25  #define STXXL_HAVE_MMAP_FILE 1
26 #else
27  #define STXXL_HAVE_MMAP_FILE 0
28 #endif
29 #endif
30 
31 #if STXXL_HAVE_MMAP_FILE
32 
33 #include <sys/mman.h>
34 
35 #include <stxxl/bits/io/ufs_file_base.h>
36 #include <stxxl/bits/io/disk_queued_file.h>
37 
38 
39 __STXXL_BEGIN_NAMESPACE
40 
46 
49 {
50 public:
55  inline mmap_file(const std::string & filename, int mode, int queue_id = DEFAULT_QUEUE, int allocator_id = NO_ALLOCATOR) :
56  ufs_file_base(filename, mode), disk_queued_file(queue_id, allocator_id)
57  { }
58  void serve(const request * req) throw (io_error);
59  const char * io_type() const;
60 };
61 
63 
64 __STXXL_END_NAMESPACE
65 
66 #endif // #if STXXL_HAVE_MMAP_FILE
67 
68 #endif // !STXXL_MMAP_FILE_HEADER
Base for UNIX file system implementations.
Definition: ufs_file_base.h:30
Request with basic properties like file and offset.
Definition: request.h:39
const char * io_type() const
Identifies the type of I/O implementation.
mmap_file(const std::string &filename, int mode, int queue_id=DEFAULT_QUEUE, int allocator_id=NO_ALLOCATOR)
constructs file object
Definition: mmap_file.h:55
Implementation of some file methods based on serving_request.
Definition: disk_queued_file.h:26
Implementation of memory mapped access file.
Definition: mmap_file.h:48