Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Class file_mapping



class file_mapping {
  // construct/copy/destruct
  file_mapping(const char *, mode_t);
  file_mapping& operator=(unspecified);

  // public member functions
  void swap(file_mapping &) ;
  mode_t get_mode() const;
  mapping_handle_t get_mapping_handle() const;
  const char * get_name() const;


A class that wraps a file-mapping that can be used to create mapped regions from the mapped files

file_mapping public construct/copy/destruct

  1. file_mapping();

    Constructs an empty file mapping. Does not throw

  2. 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.

  3. file_mapping(unspecified moved);

    Moves the ownership of "moved"'s shared memory object to *this. After the call, "moved" does not represent any shared memory object. Does not throw

  4. file_mapping& operator=(unspecified moved);

    Moves the ownership of "moved"'s shared memory to *this. After the call, "moved" does not represent any shared memory. Does not throw

  5. ~file_mapping();

    Destroys the file mapping. All mapped regions created from this are still valid. Does not throw

file_mapping public member functions

  1. void swap(file_mapping & other) ;

    Swaps to file_mappings. Does not throw.

  2. mode_t get_mode() const;

    Returns access mode used in the constructor

  3. mapping_handle_t get_mapping_handle() const;

    Obtains the mapping handle to be used with mapped_region

  4. const char * get_name() const;

    Returns the name of the file used in the constructor.