Home | Libraries | People | FAQ | More |
boost::interprocess::file_mapping
// In header: <boost/interprocess/file_mapping.hpp> class file_mapping { public: // construct/copy/destruct file_mapping() noexcept; file_mapping(const char *, mode_t); file_mapping(const wchar_t *, mode_t); file_mapping(file_mapping &&) noexcept; file_mapping & operator=(file_mapping &&) noexcept; ~file_mapping(); // public member functions void swap(file_mapping &) noexcept; mode_t get_mode() const noexcept; mapping_handle_t get_mapping_handle() const noexcept; const char * get_name() const noexcept; // public static functions static bool remove(const char *); static bool remove(const wchar_t *); };
A class that wraps a file-mapping that can be used to create mapped regions from the mapped files
file_mapping
public
construct/copy/destructfile_mapping() noexcept;
Constructs an empty file mapping. Does not throw
file_mapping(const char * filename, mode_t mode);
Opens a file mapping of file "filename", starting in offset "file_offset", and the mapping's size will be "size". The mapping can be opened for read-only "read_only" or read-write "read_write" modes. Throws interprocess_exception
on error.
file_mapping(const wchar_t * filename, mode_t mode);
Opens a file mapping of file "filename", starting in offset "file_offset", and the mapping's size will be "size". The mapping can be opened for read-only "read_only" or read-write "read_write" modes. Throws interprocess_exception
on error.
Note: This function is only available on operating systems with native wchar_t APIs (e.g. Windows).
file_mapping(file_mapping && moved) noexcept;
Moves the ownership of "moved"'s file mapping object to *this. After the call, "moved" does not represent any file mapping object. Does not throw
file_mapping & operator=(file_mapping && moved) noexcept;
Moves the ownership of "moved"'s file mapping to *this. After the call, "moved" does not represent any file mapping. Does not throw
~file_mapping();
Destroys the file mapping. All mapped regions created from this are still valid. Does not throw
file_mapping
public member functionsvoid swap(file_mapping & other) noexcept;
Swaps to file_mappings. Does not throw.
mode_t get_mode() const noexcept;
Returns access mode used in the constructor
mapping_handle_t get_mapping_handle() const noexcept;
Obtains the mapping handle to be used with mapped_region
const char * get_name() const noexcept;
Returns the name of the file used in the constructor.
file_mapping
public static functionsstatic bool remove(const char * filename);
Removes the file named "filename" even if it's been memory mapped. Returns true on success. The function might fail in some operating systems if the file is being used other processes and no deletion permission was shared.
static bool remove(const wchar_t * filename);
Removes the file named "filename" even if it's been memory mapped. Returns true on success. The function might fail in some operating systems if the file is being used other processes and no deletion permission was shared.
Note: This function is only available on operating systems with native wchar_t APIs (e.g. Windows).