STXXL  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
disk_queued_file.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * lib/io/disk_queued_file.cpp
3  *
4  * Part of the STXXL. See http://stxxl.sourceforge.net
5  *
6  * Copyright (C) 2008 Andreas Beckmann <[email protected]>
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 
15 #include <stxxl/bits/io/file.h>
16 #include <stxxl/bits/io/request.h>
19 #include <stxxl/bits/namespace.h>
20 #include <stxxl/bits/singleton.h>
21 
22 
24 
25 
26 request_ptr disk_queued_file::aread(
27  void* buffer,
28  offset_type pos,
30  const completion_handler& on_cmpl)
31 {
32  request_ptr req(new serving_request(on_cmpl, this, buffer, pos, bytes,
33  request::READ));
34 
35  disk_queues::get_instance()->add_request(req, get_queue_id());
36 
37  return req;
38 }
39 
40 request_ptr disk_queued_file::awrite(
41  void* buffer,
42  offset_type pos,
44  const completion_handler& on_cmpl)
45 {
46  request_ptr req(new serving_request(on_cmpl, this, buffer, pos, bytes,
47  request::WRITE));
48 
49  disk_queues::get_instance()->add_request(req, get_queue_id());
50 
51  return req;
52 }
53 
55 // vim: et:ts=4:sw=4
static const int bytes
number of bytes in uint_pair
Definition: uint_types.h:99
Completion handler class (Loki-style).
Request which serves an I/O by calling the synchronous routine of the file.
request::size_type size_type
the size of a request
Definition: file.h:66
#define STXXL_BEGIN_NAMESPACE
Definition: namespace.h:16
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