mio 1.1.0
Loading...
Searching...
No Matches
mio Namespace Reference

Namespaces

namespace  detail
 

Classes

struct  basic_mmap
 
class  basic_shared_mmap
 

Typedefs

using file_handle_type = int
 
template<typename ByteT >
using basic_mmap_source = basic_mmap< access_mode::read, ByteT >
 
template<typename ByteT >
using basic_mmap_sink = basic_mmap< access_mode::write, ByteT >
 
using mmap_source = basic_mmap_source< char >
 
using ummap_source = basic_mmap_source< unsigned char >
 
using mmap_sink = basic_mmap_sink< char >
 
using ummap_sink = basic_mmap_sink< unsigned char >
 
template<typename ByteT >
using basic_shared_mmap_source = basic_shared_mmap< access_mode::read, ByteT >
 
template<typename ByteT >
using basic_shared_mmap_sink = basic_shared_mmap< access_mode::write, ByteT >
 
using shared_mmap_source = basic_shared_mmap_source< char >
 
using shared_ummap_source = basic_shared_mmap_source< unsigned char >
 
using shared_mmap_sink = basic_shared_mmap_sink< char >
 
using shared_ummap_sink = basic_shared_mmap_sink< unsigned char >
 

Enumerations

enum  { map_entire_file = 0 }
 
enum class  access_mode {
  read ,
  write
}
 

Functions

template<access_mode AccessMode, typename ByteT >
bool operator== (const basic_mmap< AccessMode, ByteT > &a, const basic_mmap< AccessMode, ByteT > &b)
 
template<access_mode AccessMode, typename ByteT >
bool operator!= (const basic_mmap< AccessMode, ByteT > &a, const basic_mmap< AccessMode, ByteT > &b)
 
template<access_mode AccessMode, typename ByteT >
bool operator< (const basic_mmap< AccessMode, ByteT > &a, const basic_mmap< AccessMode, ByteT > &b)
 
template<access_mode AccessMode, typename ByteT >
bool operator<= (const basic_mmap< AccessMode, ByteT > &a, const basic_mmap< AccessMode, ByteT > &b)
 
template<access_mode AccessMode, typename ByteT >
bool operator> (const basic_mmap< AccessMode, ByteT > &a, const basic_mmap< AccessMode, ByteT > &b)
 
template<access_mode AccessMode, typename ByteT >
bool operator>= (const basic_mmap< AccessMode, ByteT > &a, const basic_mmap< AccessMode, ByteT > &b)
 
template<typename MMap , typename MappingToken >
MMap make_mmap (const MappingToken &token, int64_t offset, int64_t length, std::error_code &error)
 
template<typename MappingToken >
mmap_source make_mmap_source (const MappingToken &token, mmap_source::size_type offset, mmap_source::size_type length, std::error_code &error)
 
template<typename MappingToken >
mmap_source make_mmap_source (const MappingToken &token, std::error_code &error)
 
template<typename MappingToken >
mmap_sink make_mmap_sink (const MappingToken &token, mmap_sink::size_type offset, mmap_sink::size_type length, std::error_code &error)
 
template<typename MappingToken >
mmap_sink make_mmap_sink (const MappingToken &token, std::error_code &error)
 
size_t page_size ()
 
size_t make_offset_page_aligned (size_t offset) noexcept
 

Typedef Documentation

◆ basic_mmap_sink

template<typename ByteT >
using mio::basic_mmap_sink = typedef basic_mmap<access_mode::write, ByteT>

This is the basis for all read-write mmap objects and should be preferred over directly using basic_mmap.

◆ basic_mmap_source

template<typename ByteT >
using mio::basic_mmap_source = typedef basic_mmap<access_mode::read, ByteT>

This is the basis for all read-only mmap objects and should be preferred over directly using basic_mmap.

◆ basic_shared_mmap_sink

template<typename ByteT >
using mio::basic_shared_mmap_sink = typedef basic_shared_mmap<access_mode::write, ByteT>

This is the basis for all read-write mmap objects and should be preferred over directly using basic_shared_mmap.

◆ basic_shared_mmap_source

template<typename ByteT >
using mio::basic_shared_mmap_source = typedef basic_shared_mmap<access_mode::read, ByteT>

This is the basis for all read-only mmap objects and should be preferred over directly using basic_shared_mmap.

◆ file_handle_type

using mio::file_handle_type = typedef int

◆ mmap_sink

using mio::mmap_sink = typedef basic_mmap_sink<char>

◆ mmap_source

using mio::mmap_source = typedef basic_mmap_source<char>

These aliases cover the most common use cases, both representing a raw byte stream (either with a char or an unsigned char/uint8_t).

◆ shared_mmap_sink

◆ shared_mmap_source

These aliases cover the most common use cases, both representing a raw byte stream (either with a char or an unsigned char/uint8_t).

◆ shared_ummap_sink

using mio::shared_ummap_sink = typedef basic_shared_mmap_sink<unsigned char>

◆ shared_ummap_source

using mio::shared_ummap_source = typedef basic_shared_mmap_source<unsigned char>

◆ ummap_sink

using mio::ummap_sink = typedef basic_mmap_sink<unsigned char>

◆ ummap_source

using mio::ummap_source = typedef basic_mmap_source<unsigned char>

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
map_entire_file 

◆ access_mode

enum class mio::access_mode
strong

This is used by basic_mmap to determine whether to create a read-only or a read-write memory mapping.

Enumerator
read 
write 

Function Documentation

◆ make_mmap()

template<typename MMap , typename MappingToken >
MMap mio::make_mmap ( const MappingToken &  token,
int64_t  offset,
int64_t  length,
std::error_code &  error 
)

Convenience factory method that constructs a mapping for any basic_mmap or basic_mmap type.

◆ make_mmap_sink() [1/2]

template<typename MappingToken >
mmap_sink mio::make_mmap_sink ( const MappingToken &  token,
mmap_sink::size_type  offset,
mmap_sink::size_type  length,
std::error_code &  error 
)

Convenience factory method.

MappingToken may be a String (std::string, std::string_view, const char*, std::filesystem::path, std::vector<char>, or similar), or a mmap_sink::handle_type.

◆ make_mmap_sink() [2/2]

template<typename MappingToken >
mmap_sink mio::make_mmap_sink ( const MappingToken &  token,
std::error_code &  error 
)

◆ make_mmap_source() [1/2]

template<typename MappingToken >
mmap_source mio::make_mmap_source ( const MappingToken &  token,
mmap_source::size_type  offset,
mmap_source::size_type  length,
std::error_code &  error 
)

Convenience factory method.

MappingToken may be a String (std::string, std::string_view, const char*, std::filesystem::path, std::vector<char>, or similar), or a mmap_source::handle_type.

◆ make_mmap_source() [2/2]

template<typename MappingToken >
mmap_source mio::make_mmap_source ( const MappingToken &  token,
std::error_code &  error 
)

◆ make_offset_page_aligned()

size_t mio::make_offset_page_aligned ( size_t  offset)
inlinenoexcept

Alligns offset to the operating's system page size such that it subtracts the difference until the nearest page boundary before offset, or does nothing if offset is already page aligned.

◆ operator!=()

template<access_mode AccessMode, typename ByteT >
bool mio::operator!= ( const basic_mmap< AccessMode, ByteT > &  a,
const basic_mmap< AccessMode, ByteT > &  b 
)

◆ operator<()

template<access_mode AccessMode, typename ByteT >
bool mio::operator< ( const basic_mmap< AccessMode, ByteT > &  a,
const basic_mmap< AccessMode, ByteT > &  b 
)

◆ operator<=()

template<access_mode AccessMode, typename ByteT >
bool mio::operator<= ( const basic_mmap< AccessMode, ByteT > &  a,
const basic_mmap< AccessMode, ByteT > &  b 
)

◆ operator==()

template<access_mode AccessMode, typename ByteT >
bool mio::operator== ( const basic_mmap< AccessMode, ByteT > &  a,
const basic_mmap< AccessMode, ByteT > &  b 
)

◆ operator>()

template<access_mode AccessMode, typename ByteT >
bool mio::operator> ( const basic_mmap< AccessMode, ByteT > &  a,
const basic_mmap< AccessMode, ByteT > &  b 
)

◆ operator>=()

template<access_mode AccessMode, typename ByteT >
bool mio::operator>= ( const basic_mmap< AccessMode, ByteT > &  a,
const basic_mmap< AccessMode, ByteT > &  b 
)

◆ page_size()

size_t mio::page_size ( )
inline

Determines the operating system's page allocation granularity. On the first call to this function, it invokes the operating system specific syscall to determine the page size, caches the value, and returns it. Any subsequent call to this function serves the cached value, so no further syscalls are made.