Thrill  0.1
syscall_file.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * foxxll/io/syscall_file.hpp
3  *
4  * Part of FOXXLL. See http://foxxll.org
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  * Copyright (C) 2014 Timo Bingmann <[email protected]>
10  *
11  * Distributed under the Boost Software License, Version 1.0.
12  * (See accompanying file LICENSE_1_0.txt or copy at
13  * http://www.boost.org/LICENSE_1_0.txt)
14  **************************************************************************/
15 
16 #ifndef FOXXLL_IO_SYSCALL_FILE_HEADER
17 #define FOXXLL_IO_SYSCALL_FILE_HEADER
18 
19 #include <string>
20 
23 
24 namespace foxxll {
25 
26 //! \addtogroup foxxll_fileimpl
27 //! \{
28 
29 //! Implementation of file based on UNIX syscalls.
30 class syscall_file final : public ufs_file_base, public disk_queued_file
31 {
32 public:
33  //! Constructs file object.
34  //! \param filename path of file
35  //! \param mode open mode, see \c foxxll::file::open_modes
36  //! \param queue_id disk queue identifier
37  //! \param allocator_id linked disk_allocator
38  //! \param device_id physical device identifier
39  //! \param file_stats file-specific stats
41  const std::string& filename,
42  int mode,
43  int queue_id = DEFAULT_QUEUE,
44  int allocator_id = NO_ALLOCATOR,
45  unsigned int device_id = DEFAULT_DEVICE_ID,
46  file_stats* file_stats = nullptr)
47  : file(device_id, file_stats),
48  ufs_file_base(filename, mode),
49  disk_queued_file(queue_id, allocator_id)
50  { }
51 
52  void serve(void* buffer, offset_type offset, size_type bytes,
53  request::read_or_write op) final;
54 
55  const char * io_type() const final;
56 };
57 
58 //! \}
59 
60 } // namespace foxxll
61 
62 #endif // !FOXXLL_IO_SYSCALL_FILE_HEADER
63 
64 /**************************************************************************/
const char * io_type() const final
Implementation of file based on UNIX syscalls.
Base for UNIX file system implementations.
static const unsigned int DEFAULT_DEVICE_ID
Definition: file.hpp:92
request::offset_type offset_type
the offset of a request, also the size of the file
Definition: file.hpp:58
Implementation of some file methods based on serving_request.
request::size_type size_type
the size of a request
Definition: file.hpp:60
void serve(void *buffer, offset_type offset, size_type bytes, request::read_or_write op) final
static const int DEFAULT_QUEUE
Definition: file.hpp:89
FOXXLL library namespace
std::basic_string< char, std::char_traits< char >, Allocator< char > > string
string with Manager tracking
Definition: allocator.hpp:220
syscall_file(const std::string &filename, int mode, int queue_id=DEFAULT_QUEUE, int allocator_id=NO_ALLOCATOR, unsigned int device_id=DEFAULT_DEVICE_ID, file_stats *file_stats=nullptr)
static const size_t bytes
number of bytes in uint_pair
Definition: uint_types.hpp:75
static const int NO_ALLOCATOR
Definition: file.hpp:91