|
GBTOlib: library for evaluation of molecular integrals in mixed Gaussian / B-spline basis 111
|
An auxiliary derived type which holds the pointer to the mapped data file window and performs the mapping and unmapping on call to init or final. More...
Public Member Functions | |
| procedure | init (this, filename, offset, length, read_write, unique_name, create_new) |
| Initialize file virtual memory mapping. | |
| procedure | finalize (this) |
| Finalize file virtual memory mapping. | |
| final | destruct_file_mapping (this) |
| Destructor of the type "file_mapping". | |
Public Attributes | |
| type(c_ptr) | addr = c_null_ptr |
| Internal page-aligned pointer needed for finalization. | |
| type(c_ptr) | ptr = c_null_ptr |
| Pointer pointing to the requested location in file. | |
| integer(c_size_t) | length = 0 |
| Length of the mapped window. | |
An auxiliary derived type which holds the pointer to the mapped data file window and performs the mapping and unmapping on call to init or final.
|
final |
Destructor of the type "file_mapping".
Called when an instance of "file_mapping" is being destructed.

| procedure file_mapping_gbl::file_mapping::finalize | ( | class(file_mapping), intent(inout) | this | ) |
Finalize file virtual memory mapping.
Cancel the file mapping. This simply calls the POSIX munmap function.
| procedure file_mapping_gbl::file_mapping::init | ( | class(file_mapping), intent(inout) | this, |
| character(len=*), intent(in) | filename, | ||
| integer(int64), intent(in) | offset, | ||
| integer(int64), intent(in) | length, | ||
| logical, intent(in), optional | read_write, | ||
| logical, intent(in), optional | unique_name, | ||
| logical, intent(in), optional | create_new ) |
Initialize file virtual memory mapping.
Set up a data file mapping window. The file name, byte offset and byte length of the window within the file needs to be given. Internally, this opens the file using the POSIX function open (or OpenFileMapping in Windows), requests the mapping starting from the virtual memory page boundary just below the requested offset as needed by mmap, and constructs the pointer to the actually wanted window, which starts at the specified offset.
If create_new is given and set to .true., then the file is created first before mapping from it. If read_write is given and set to .true., the mapped view will be writable. If unique_name is given and set to .true., the provided file name is interpreted only as a prefix for a file path, which will be suffixed to generate a unique file path. (This makes sense only together with create_new.) In this last case the file will be considered temporary and removed once the file mapping ends.
| [in] | this | A file mapping object. |
| [in] | filename | Name of file to open (or prefix if unique_name is given). |
| [in] | offset | Position in file where to start mapped segment. |
| [in] | length | Length of the mapped segment. |
| [in] | read_write | Whether to enable writing. |
| [in] | unique_name | Whether to suffix filename with characters in order to make a unique file name. |
| type(c_ptr) file_mapping_gbl::file_mapping::addr = c_null_ptr |
Internal page-aligned pointer needed for finalization.
| integer(c_size_t) file_mapping_gbl::file_mapping::length = 0 |
Length of the mapped window.
| type(c_ptr) file_mapping_gbl::file_mapping::ptr = c_null_ptr |
Pointer pointing to the requested location in file.