header_utils
Loading...
Searching...
No Matches
ghassanpl::mmap_sink< VALUE_TYPE > Struct Template Reference

A read-write view over a file. More...

#include <mmap.h>

Inherits ghassanpl::basic_mmap< CRTP, VALUE_TYPE >.

Public Types

using value_type = VALUE_TYPE
 
using size_type = size_t
 
using reference = value_type &
 
using const_reference = const value_type &
 
using pointer = value_type *
 
using const_pointer = const value_type *
 
using difference_type = std::ptrdiff_t
 
using iterator = pointer
 
using const_iterator = const_pointer
 
using reverse_iterator = std::reverse_iterator< iterator >
 
using const_reverse_iterator = std::reverse_iterator< const_iterator >
 
using iterator_category = std::random_access_iterator_tag
 
using handle_type = file_handle_type
 

Public Member Functions

reference operator[] (const size_type i) const noexcept
 
pointer data () noexcept
 
iterator begin () noexcept
 
iterator end () noexcept
 
reverse_iterator rbegin () noexcept
 
reverse_iterator rend () noexcept
 
void sync (std::error_code &error) noexcept
 
handle_type file_handle () const noexcept
 
handle_type mapping_handle () const noexcept
 
bool is_open () const noexcept
 
bool empty () const noexcept
 
bool is_mapped () const noexcept
 
template<typename T = VALUE_TYPE>
std::span< T constto_span () const noexcept
 
size_type size () const noexcept
 
size_type length () const noexcept
 
size_type mapped_length () const noexcept
 
size_type mapping_offset () const noexcept
 
const_pointer data () const noexcept
 
const_iterator begin () const noexcept
 
const_iterator cbegin () const noexcept
 
const_iterator end () const noexcept
 
const_iterator cend () const noexcept
 
const_reverse_iterator rbegin () const noexcept
 
const_reverse_iterator crbegin () const noexcept
 
const_reverse_iterator rend () const noexcept
 
const_reverse_iterator crend () const noexcept
 
void swap (basic_mmap_base &other) noexcept
 
void unmap () noexcept
 

Protected Member Functions

pointer get_mapping_start () noexcept
 
void conditional_sync ()
 
void map (const std::filesystem::path &path, const size_type offset, const size_type length, std::error_code &error) noexcept
 
void map (const std::filesystem::path &path, std::error_code &error) noexcept
 
const_pointer get_mapping_start () const noexcept
 

Static Protected Member Functions

static file_handle_type open_file (const std::filesystem::path &path, std::error_code &error) noexcept
 
static mmap_context memory_map (const file_handle_type file_handle, const int64_t offset, const int64_t length, std::error_code &error) noexcept
 

Protected Attributes

pointer data_
 
size_type length_
 
size_type mapped_length_
 
handle_type file_handle_
 
handle_type file_mapping_handle_
 

Friends

struct basic_mmap< mmap_sink< VALUE_TYPE >, VALUE_TYPE >
 

Detailed Description

template<typename VALUE_TYPE = std::byte>
struct ghassanpl::mmap_sink< VALUE_TYPE >

A read-write view over a file.

Definition at line 349 of file mmap.h.

Member Typedef Documentation

◆ const_iterator

template<typename VALUE_TYPE >
using ghassanpl::basic_mmap_base< VALUE_TYPE >::const_iterator = const_pointer
inherited

Definition at line 93 of file mmap.h.

◆ const_pointer

template<typename VALUE_TYPE >
using ghassanpl::basic_mmap_base< VALUE_TYPE >::const_pointer = const value_type*
inherited

Definition at line 90 of file mmap.h.

◆ const_reference

template<typename VALUE_TYPE >
using ghassanpl::basic_mmap_base< VALUE_TYPE >::const_reference = const value_type&
inherited

Definition at line 88 of file mmap.h.

◆ const_reverse_iterator

template<typename VALUE_TYPE >
using ghassanpl::basic_mmap_base< VALUE_TYPE >::const_reverse_iterator = std::reverse_iterator<const_iterator>
inherited

Definition at line 95 of file mmap.h.

◆ difference_type

template<typename VALUE_TYPE >
using ghassanpl::basic_mmap_base< VALUE_TYPE >::difference_type = std::ptrdiff_t
inherited

Definition at line 91 of file mmap.h.

◆ handle_type

template<typename VALUE_TYPE >
using ghassanpl::basic_mmap_base< VALUE_TYPE >::handle_type = file_handle_type
inherited

Definition at line 97 of file mmap.h.

◆ iterator

template<typename VALUE_TYPE >
using ghassanpl::basic_mmap_base< VALUE_TYPE >::iterator = pointer
inherited

Definition at line 92 of file mmap.h.

◆ iterator_category

template<typename VALUE_TYPE >
using ghassanpl::basic_mmap_base< VALUE_TYPE >::iterator_category = std::random_access_iterator_tag
inherited

Definition at line 96 of file mmap.h.

◆ pointer

template<typename VALUE_TYPE >
using ghassanpl::basic_mmap_base< VALUE_TYPE >::pointer = value_type*
inherited

Definition at line 89 of file mmap.h.

◆ reference

template<typename VALUE_TYPE >
using ghassanpl::basic_mmap_base< VALUE_TYPE >::reference = value_type&
inherited

Definition at line 87 of file mmap.h.

◆ reverse_iterator

template<typename VALUE_TYPE >
using ghassanpl::basic_mmap_base< VALUE_TYPE >::reverse_iterator = std::reverse_iterator<iterator>
inherited

Definition at line 94 of file mmap.h.

◆ size_type

template<typename VALUE_TYPE >
using ghassanpl::basic_mmap_base< VALUE_TYPE >::size_type = size_t
inherited

Definition at line 86 of file mmap.h.

◆ value_type

template<typename VALUE_TYPE >
using ghassanpl::basic_mmap_base< VALUE_TYPE >::value_type = VALUE_TYPE
inherited

Definition at line 85 of file mmap.h.

Member Function Documentation

◆ begin() [1/2]

template<typename VALUE_TYPE >
const_iterator ghassanpl::basic_mmap_base< VALUE_TYPE >::begin ( ) const
inlinenoexceptinherited

Definition at line 139 of file mmap.h.

◆ begin() [2/2]

template<typename VALUE_TYPE = std::byte>
iterator ghassanpl::mmap_sink< VALUE_TYPE >::begin ( )
inlinenoexcept

Definition at line 368 of file mmap.h.

◆ cbegin()

template<typename VALUE_TYPE >
const_iterator ghassanpl::basic_mmap_base< VALUE_TYPE >::cbegin ( ) const
inlinenoexceptinherited

Definition at line 140 of file mmap.h.

◆ cend()

template<typename VALUE_TYPE >
const_iterator ghassanpl::basic_mmap_base< VALUE_TYPE >::cend ( ) const
inlinenoexceptinherited

Definition at line 143 of file mmap.h.

◆ conditional_sync()

template<typename VALUE_TYPE = std::byte>
void ghassanpl::mmap_sink< VALUE_TYPE >::conditional_sync ( )
inlineprotected

Definition at line 394 of file mmap.h.

◆ crbegin()

template<typename VALUE_TYPE >
const_reverse_iterator ghassanpl::basic_mmap_base< VALUE_TYPE >::crbegin ( ) const
inlinenoexceptinherited

Definition at line 150 of file mmap.h.

◆ crend()

template<typename VALUE_TYPE >
const_reverse_iterator ghassanpl::basic_mmap_base< VALUE_TYPE >::crend ( ) const
inlinenoexceptinherited

Definition at line 159 of file mmap.h.

◆ data() [1/2]

template<typename VALUE_TYPE >
const_pointer ghassanpl::basic_mmap_base< VALUE_TYPE >::data ( ) const
inlinenoexceptinherited

Definition at line 137 of file mmap.h.

◆ data() [2/2]

template<typename VALUE_TYPE = std::byte>
pointer ghassanpl::mmap_sink< VALUE_TYPE >::data ( )
inlinenoexcept

Definition at line 365 of file mmap.h.

◆ empty()

template<typename VALUE_TYPE >
bool ghassanpl::basic_mmap_base< VALUE_TYPE >::empty ( ) const
inlinenoexceptinherited

Definition at line 114 of file mmap.h.

◆ end() [1/2]

template<typename VALUE_TYPE >
const_iterator ghassanpl::basic_mmap_base< VALUE_TYPE >::end ( ) const
inlinenoexceptinherited

Definition at line 142 of file mmap.h.

◆ end() [2/2]

template<typename VALUE_TYPE = std::byte>
iterator ghassanpl::mmap_sink< VALUE_TYPE >::end ( )
inlinenoexcept

Definition at line 371 of file mmap.h.

◆ file_handle()

template<typename VALUE_TYPE >
handle_type ghassanpl::basic_mmap_base< VALUE_TYPE >::file_handle ( ) const
inlinenoexceptinherited

Definition at line 109 of file mmap.h.

◆ get_mapping_start() [1/2]

template<typename VALUE_TYPE >
const_pointer ghassanpl::basic_mmap_base< VALUE_TYPE >::get_mapping_start ( ) const
inlineprotectednoexceptinherited

Definition at line 199 of file mmap.h.

◆ get_mapping_start() [2/2]

template<typename VALUE_TYPE = std::byte>
pointer ghassanpl::mmap_sink< VALUE_TYPE >::get_mapping_start ( )
inlineprotectednoexcept

Definition at line 389 of file mmap.h.

◆ is_mapped()

template<typename VALUE_TYPE >
bool ghassanpl::basic_mmap_base< VALUE_TYPE >::is_mapped ( ) const
inlinenoexceptinherited

Definition at line 116 of file mmap.h.

◆ is_open()

template<typename VALUE_TYPE >
bool ghassanpl::basic_mmap_base< VALUE_TYPE >::is_open ( ) const
inlinenoexceptinherited

Definition at line 112 of file mmap.h.

◆ length()

template<typename VALUE_TYPE >
size_type ghassanpl::basic_mmap_base< VALUE_TYPE >::length ( ) const
inlinenoexceptinherited

Definition at line 129 of file mmap.h.

◆ map() [1/2]

template<typename CRTP , typename VALUE_TYPE = std::byte>
void ghassanpl::basic_mmap< CRTP, VALUE_TYPE >::map ( const std::filesystem::path &  path,
const size_type  offset,
const size_type  length,
std::error_code &  error 
)
inlineprotectednoexceptinherited

Definition at line 253 of file mmap.h.

◆ map() [2/2]

template<typename CRTP , typename VALUE_TYPE = std::byte>
void ghassanpl::basic_mmap< CRTP, VALUE_TYPE >::map ( const std::filesystem::path &  path,
std::error_code &  error 
)
inlineprotectednoexceptinherited

Definition at line 309 of file mmap.h.

◆ mapped_length()

template<typename VALUE_TYPE >
size_type ghassanpl::basic_mmap_base< VALUE_TYPE >::mapped_length ( ) const
inlinenoexceptinherited

Definition at line 130 of file mmap.h.

◆ mapping_handle()

template<typename VALUE_TYPE >
handle_type ghassanpl::basic_mmap_base< VALUE_TYPE >::mapping_handle ( ) const
inlinenoexceptinherited

Definition at line 110 of file mmap.h.

◆ mapping_offset()

template<typename VALUE_TYPE >
size_type ghassanpl::basic_mmap_base< VALUE_TYPE >::mapping_offset ( ) const
inlinenoexceptinherited

Definition at line 132 of file mmap.h.

◆ memory_map()

template<typename VALUE_TYPE >
mmap_sink< VALUE_TYPE >::mmap_context ghassanpl::mmap_sink< VALUE_TYPE >::memory_map ( const file_handle_type  file_handle,
const int64_t  offset,
const int64_t  length,
std::error_code &  error 
)
staticprotectednoexcept

Definition at line 145 of file mmap_impl.h.

◆ open_file()

template<typename VALUE_TYPE >
file_handle_type ghassanpl::mmap_sink< VALUE_TYPE >::open_file ( const std::filesystem::path &  path,
std::error_code &  error 
)
inlinestaticprotectednoexcept

Definition at line 125 of file mmap_impl.h.

◆ operator[]()

template<typename VALUE_TYPE = std::byte>
reference ghassanpl::mmap_sink< VALUE_TYPE >::operator[] ( const size_type  i) const
inlinenoexcept

Definition at line 360 of file mmap.h.

◆ rbegin() [1/2]

template<typename VALUE_TYPE >
const_reverse_iterator ghassanpl::basic_mmap_base< VALUE_TYPE >::rbegin ( ) const
inlinenoexceptinherited

Definition at line 145 of file mmap.h.

◆ rbegin() [2/2]

template<typename VALUE_TYPE = std::byte>
reverse_iterator ghassanpl::mmap_sink< VALUE_TYPE >::rbegin ( )
inlinenoexcept

Definition at line 374 of file mmap.h.

◆ rend() [1/2]

template<typename VALUE_TYPE >
const_reverse_iterator ghassanpl::basic_mmap_base< VALUE_TYPE >::rend ( ) const
inlinenoexceptinherited

Definition at line 155 of file mmap.h.

◆ rend() [2/2]

template<typename VALUE_TYPE = std::byte>
reverse_iterator ghassanpl::mmap_sink< VALUE_TYPE >::rend ( )
inlinenoexcept

Definition at line 377 of file mmap.h.

◆ size()

template<typename VALUE_TYPE >
size_type ghassanpl::basic_mmap_base< VALUE_TYPE >::size ( ) const
inlinenoexceptinherited

Definition at line 128 of file mmap.h.

◆ swap()

template<typename VALUE_TYPE >
void ghassanpl::basic_mmap_base< VALUE_TYPE >::swap ( basic_mmap_base< VALUE_TYPE > &  other)
inlinenoexceptinherited

Definition at line 166 of file mmap.h.

◆ sync()

template<typename VALUE_TYPE >
void ghassanpl::mmap_sink< VALUE_TYPE >::sync ( std::error_code &  error)
inlinenoexcept

Definition at line 94 of file mmap_impl.h.

◆ to_span()

template<typename VALUE_TYPE >
template<typename T = VALUE_TYPE>
std::span< T const > ghassanpl::basic_mmap_base< VALUE_TYPE >::to_span ( ) const
inlinenoexceptinherited

Definition at line 126 of file mmap.h.

◆ unmap()

template<typename VALUE_TYPE >
void ghassanpl::basic_mmap_base< VALUE_TYPE >::unmap
noexceptinherited

Definition at line 182 of file mmap_impl.h.

Friends And Related Symbol Documentation

◆ basic_mmap< mmap_sink< VALUE_TYPE >, VALUE_TYPE >

template<typename VALUE_TYPE = std::byte>
friend struct basic_mmap< mmap_sink< VALUE_TYPE >, VALUE_TYPE >
friend

Definition at line 379 of file mmap.h.

Member Data Documentation

◆ data_

template<typename VALUE_TYPE >
pointer ghassanpl::basic_mmap_base< VALUE_TYPE >::data_
protectedinherited

Definition at line 191 of file mmap.h.

◆ file_handle_

template<typename VALUE_TYPE >
handle_type ghassanpl::basic_mmap_base< VALUE_TYPE >::file_handle_
protectedinherited

Definition at line 196 of file mmap.h.

◆ file_mapping_handle_

template<typename VALUE_TYPE >
handle_type ghassanpl::basic_mmap_base< VALUE_TYPE >::file_mapping_handle_
protectedinherited

Definition at line 197 of file mmap.h.

◆ length_

template<typename VALUE_TYPE >
size_type ghassanpl::basic_mmap_base< VALUE_TYPE >::length_
protectedinherited

Definition at line 193 of file mmap.h.

◆ mapped_length_

template<typename VALUE_TYPE >
size_type ghassanpl::basic_mmap_base< VALUE_TYPE >::mapped_length_
protectedinherited

Definition at line 194 of file mmap.h.