50#include <system_error>
54#ifndef WIN32_LEAN_AND_MEAN
55#define WIN32_LEAN_AND_MEAN
59#define INVALID_HANDLE_VALUE -1
81template <access_mode AccessMode,
typename ByteT>
98 static_assert(
sizeof(
ByteT) ==
sizeof(
char),
"ByteT must be the same size as char.");
125 bool is_handle_internal_;
134 : is_handle_internal_(
true) {};
136#ifdef __cpp_exceptions
142 template <
typename String>
145 std::error_code
error;
148 throw std::system_error(
error);
159 std::error_code
error;
162 throw std::system_error(
error);
221 typename =
typename std::enable_if<A == access_mode::write>::type>
232 typename =
typename std::enable_if<A == access_mode::write>::type>
244 typename =
typename std::enable_if<A == access_mode::write>::type>
257 typename =
typename std::enable_if<A == access_mode::write>::type>
269 typename =
typename std::enable_if<A == access_mode::write>::type>
304 template <
typename String>
306 std::error_code&
error);
320 template <
typename String>
345 std::error_code&
error);
376 template <access_mode A = AccessMode>
377 typename std::enable_if<A == access_mode::write, void>::type
sync(std::error_code&
error);
386 typename =
typename std::enable_if<A == access_mode::write>::type>
401 template <access_mode A = AccessMode>
402 typename std::enable_if<A == access_mode::write, void>::type
404 template <access_mode A = AccessMode>
405 typename std::enable_if<A == access_mode::read, void>::type
409template <access_mode AccessMode,
typename ByteT>
412template <access_mode AccessMode,
typename ByteT>
415template <access_mode AccessMode,
typename ByteT>
418template <access_mode AccessMode,
typename ByteT>
421template <access_mode AccessMode,
typename ByteT>
424template <access_mode AccessMode,
typename ByteT>
431template <
typename ByteT>
438template <
typename ByteT>
455template <
typename MMap,
typename MappingToken>
456MMap
make_mmap(
const MappingToken& token, int64_t offset, int64_t length, std::error_code& error) {
458 mmap.
map(token, offset, length, error);
469template <
typename MappingToken>
472 return make_mmap<mmap_source>(token, offset, length, error);
475template <
typename MappingToken>
487template <
typename MappingToken>
490 return make_mmap<mmap_sink>(token, offset, length, error);
493template <
typename MappingToken>
500#include "detail/mmap.ipp"
#define INVALID_HANDLE_VALUE
Definition mmap.hpp:59
Definition string_util.hpp:48
access_mode
Definition page.hpp:59
MMap make_mmap(const MappingToken &token, int64_t offset, int64_t length, std::error_code &error)
Definition mmap.hpp:456
mmap_source make_mmap_source(const MappingToken &token, mmap_source::size_type offset, mmap_source::size_type length, std::error_code &error)
Definition mmap.hpp:470
bool operator!=(const basic_mmap< AccessMode, ByteT > &a, const basic_mmap< AccessMode, ByteT > &b)
bool operator<(const basic_mmap< AccessMode, ByteT > &a, const basic_mmap< AccessMode, ByteT > &b)
bool operator>(const basic_mmap< AccessMode, ByteT > &a, const basic_mmap< AccessMode, ByteT > &b)
bool operator<=(const basic_mmap< AccessMode, ByteT > &a, const basic_mmap< AccessMode, ByteT > &b)
bool operator==(const basic_mmap< AccessMode, ByteT > &a, const basic_mmap< AccessMode, ByteT > &b)
@ map_entire_file
Definition mmap.hpp:68
int file_handle_type
Definition mmap.hpp:74
mmap_sink make_mmap_sink(const MappingToken &token, mmap_sink::size_type offset, mmap_sink::size_type length, std::error_code &error)
Definition mmap.hpp:488
bool operator>=(const basic_mmap< AccessMode, ByteT > &a, const basic_mmap< AccessMode, ByteT > &b)
std::random_access_iterator_tag iterator_category
Definition mmap.hpp:95
const_iterator begin() const noexcept
Definition mmap.hpp:236
void map(const String &path, const size_type &offset, const size_type &length, std::error_code &error)
iterator end() noexcept
Definition mmap.hpp:245
pointer iterator
Definition mmap.hpp:91
const_reverse_iterator crbegin() const noexcept
Definition mmap.hpp:262
const_iterator cbegin() const noexcept
Definition mmap.hpp:237
bool empty() const noexcept
Definition mmap.hpp:198
size_t size_type
Definition mmap.hpp:85
basic_mmap()
Definition mmap.hpp:133
const_iterator cend() const noexcept
Definition mmap.hpp:249
std::enable_if< A==access_mode::write, void >::type sync(std::error_code &error)
size_type length() const noexcept
Definition mmap.hpp:210
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition mmap.hpp:94
pointer data() noexcept
Definition mmap.hpp:222
const_pointer const_iterator
Definition mmap.hpp:92
const value_type * const_pointer
Definition mmap.hpp:89
void map(const handle_type &handle, std::error_code &error)
Definition mmap.hpp:358
const_reverse_iterator rend() const noexcept
Definition mmap.hpp:273
std::reverse_iterator< iterator > reverse_iterator
Definition mmap.hpp:93
std::ptrdiff_t difference_type
Definition mmap.hpp:90
void swap(basic_mmap &other)
basic_mmap(const basic_mmap &)=delete
bool is_open() const noexcept
Definition mmap.hpp:191
const value_type & const_reference
Definition mmap.hpp:87
size_type mapping_offset() const noexcept
Definition mmap.hpp:214
const_pointer data() const noexcept
Definition mmap.hpp:225
handle_type mapping_handle() const noexcept
basic_mmap(basic_mmap &&)
const_iterator end() const noexcept
Definition mmap.hpp:248
reference operator[](const size_type &i) noexcept
Definition mmap.hpp:281
iterator begin() noexcept
Definition mmap.hpp:233
reverse_iterator rbegin() noexcept
Definition mmap.hpp:258
reverse_iterator rend() noexcept
Definition mmap.hpp:270
basic_mmap & operator=(basic_mmap &&)
const_reverse_iterator rbegin() const noexcept
Definition mmap.hpp:261
handle_type file_handle() const noexcept
Definition mmap.hpp:187
value_type * pointer
Definition mmap.hpp:88
value_type & reference
Definition mmap.hpp:86
size_type mapped_length() const noexcept
Definition mmap.hpp:211
bool is_mapped() const noexcept
void map(const handle_type &handle, const size_type &offset, const size_type &length, std::error_code &error)
size_type size() const noexcept
Definition mmap.hpp:209
file_handle_type handle_type
Definition mmap.hpp:96
const_reverse_iterator crend() const noexcept
Definition mmap.hpp:274
ByteT value_type
Definition mmap.hpp:84
const_reference operator[](const size_type &i) const noexcept
Definition mmap.hpp:282
void map(const String &path, std::error_code &error)
Definition mmap.hpp:321
basic_mmap & operator=(const basic_mmap &)=delete