Thrill  0.1
wincall_file.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * foxxll/io/wincall_file.hpp
3  *
4  * Part of FOXXLL. See http://foxxll.org
5  *
6  * Copyright (C) 2005-2006 Roman Dementiev <[email protected]>
7  * Copyright (C) 2008 Andreas Beckmann <[email protected]>
8  * Copyright (C) 2009-2010 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_WINCALL_FILE_HEADER
16 #define FOXXLL_IO_WINCALL_FILE_HEADER
17 
18 #include <foxxll/config.hpp>
19 
20 #ifndef FOXXLL_HAVE_WINCALL_FILE
21 #if FOXXLL_WINDOWS
22  #define FOXXLL_HAVE_WINCALL_FILE 1
23 #else
24  #define FOXXLL_HAVE_WINCALL_FILE 0
25 #endif
26 #endif
27 
28 #if FOXXLL_HAVE_WINCALL_FILE
29 
30 #include <string>
31 
34 
35 namespace foxxll {
36 
37 //! \addtogroup foxxll_fileimpl
38 //! \{
39 
40 //! Implementation of file based on Windows native I/O calls.
41 class wincall_file final : public wfs_file_base, public disk_queued_file
42 {
43 public:
44  //! Constructs file object.
45  //! \param filename path of file
46  //! \param mode open mode, see \c foxxll::file::open_modes
47  //! \param queue_id disk queue identifier
48  //! \param allocator_id linked disk_allocator
49  //! \param device_id physical device identifier
50  //! \param file_stats file-specific stats
51  wincall_file(
52  const std::string& filename,
53  int mode,
54  int queue_id = DEFAULT_QUEUE,
55  int allocator_id = NO_ALLOCATOR,
56  unsigned int device_id = DEFAULT_DEVICE_ID,
57  file_stats* file_stats = nullptr)
58  : file(device_id, file_stats),
59  wfs_file_base(filename, mode),
60  disk_queued_file(queue_id, allocator_id)
61  { }
62  void serve(void* buffer, offset_type offset, size_type bytes,
63  request::read_or_write op) final;
64  const char * io_type() const final;
65 };
66 
67 //! \}
68 
69 } // namespace foxxll
70 
71 #endif // #if FOXXLL_HAVE_WINCALL_FILE
72 
73 #endif // !FOXXLL_IO_WINCALL_FILE_HEADER
74 
75 /**************************************************************************/
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