Stxxl
1.2.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
include
stxxl
bits
io
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 <dementiev@mpi-sb.mpg.de>
7
*
8
* Distributed under the Boost Software License, Version 1.0.
9
* (See accompanying file LICENSE_1_0.txt or copy at
10
* http://www.boost.org/LICENSE_1_0.txt)
11
**************************************************************************/
12
13
#ifndef STXXL_MMAP_FILE_HEADER
14
#define STXXL_MMAP_FILE_HEADER
15
16
#ifdef STXXL_BOOST_CONFIG
17
#include <boost/config.hpp>
18
#endif
19
20
#ifndef BOOST_MSVC
21
// mmap call does not exist in Windows
22
23
#include <sys/mman.h>
24
25
#include <stxxl/bits/io/ufs_file.h>
26
27
28
__STXXL_BEGIN_NAMESPACE
29
35
37
class
mmap_file
:
public
ufs_file_base
38
{
39
public
:
44
inline
mmap_file
(
const
std::string & filename,
int
mode,
int
disk = -1) :
45
ufs_file_base
(filename, mode, disk)
46
{ }
47
request_ptr
aread
(
48
void
* buffer,
49
stxxl::int64 pos,
50
size_t
bytes,
51
completion_handler
on_cmpl);
52
request_ptr
awrite
(
53
void
* buffer,
54
stxxl::int64 pos,
55
size_t
bytes,
56
completion_handler
on_cmpl);
57
};
58
60
class
mmap_request
:
public
ufs_request_base
61
{
62
friend
class
mmap_file
;
63
64
protected
:
65
inline
mmap_request
(
mmap_file
* f,
66
void
* buf, stxxl::int64 off,
size_t
b,
67
request_type t,
68
completion_handler
on_cmpl) :
69
ufs_request_base
(f, buf, off, b, t, on_cmpl)
70
{ }
71
void
serve();
72
73
public
:
74
inline
const
char
*
io_type
()
75
{
76
return
"mmap"
;
77
}
78
};
79
81
82
__STXXL_END_NAMESPACE
83
84
#endif // #ifndef BOOST_MSVC
85
86
#endif // !STXXL_MMAP_FILE_HEADER
Generated by
1.8.1.1