WPILibC++  2020.3.2-60-g3011ebe
wpi::sys::fs::mapped_file_region Class Reference

This class represents a memory mapped file. More...

#include <FileSystem.h>

Public Types

enum  mapmode { readonly, readwrite, priv }
 

Public Member Functions

 mapped_file_region (mapped_file_region &)=delete
 
mapped_file_regionoperator= (mapped_file_region &)=delete
 
 mapped_file_region (int fd, mapmode mode, size_t length, uint64_t offset, std::error_code &ec)
 
size_t size () const
 
char * data () const
 
const char * const_data () const
 Get a const view of the data. More...
 

Static Public Member Functions

static int alignment ()
 

Detailed Description

This class represents a memory mapped file.

It is based on boost::iostreams::mapped_file.

Member Enumeration Documentation

◆ mapmode

Enumerator
readonly 

May only access map via const_data as read only.

readwrite 

May access map via data and modify it. Written to path.

priv 

May modify via data, but changes are lost on destruction.

Constructor & Destructor Documentation

◆ mapped_file_region()

wpi::sys::fs::mapped_file_region::mapped_file_region ( int  fd,
mapmode  mode,
size_t  length,
uint64_t  offset,
std::error_code &  ec 
)
Parameters
fdAn open file descriptor to map. mapped_file_region takes ownership if closefd is true. It must have been opended in the correct mode.

Member Function Documentation

◆ alignment()

static int wpi::sys::fs::mapped_file_region::alignment ( )
static
Returns
The minimum alignment offset must be.

◆ const_data()

const char* wpi::sys::fs::mapped_file_region::const_data ( ) const

Get a const view of the data.

Modifying this memory has undefined behavior.


The documentation for this class was generated from the following file: