STXXL  1.4.1
 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 
23 
24 request_ptr disk_queued_file::aread(
25  void* buffer,
26  offset_type pos,
28  const completion_handler& on_cmpl)
29 {
30  request_ptr req(new serving_request(on_cmpl, this, buffer, pos, bytes,
31  request::READ));
32 
33  disk_queues::get_instance()->add_request(req, get_queue_id());
34 
35  return req;
36 }
37 
38 request_ptr disk_queued_file::awrite(
39  void* buffer,
40  offset_type pos,
42  const completion_handler& on_cmpl)
43 {
44  request_ptr req(new serving_request(on_cmpl, this, buffer, pos, bytes,
45  request::WRITE));
46 
47  disk_queues::get_instance()->add_request(req, get_queue_id());
48 
49  return req;
50 }
51 
53 // vim: et:ts=4:sw=4
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:62
#define STXXL_BEGIN_NAMESPACE
Definition: namespace.h:16
static const size_t bytes
number of bytes in uint_pair
Definition: uint_types.h:96
request::offset_type offset_type
the offset of a request, also the size of the file
Definition: file.h:60
#define STXXL_END_NAMESPACE
Definition: namespace.h:17