GBTOlib: library for evaluation of molecular integrals in mixed Gaussian / B-spline basis 111
Loading...
Searching...
No Matches
file_mapping_gbl::file_mapping Type Reference

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.

Detailed Description

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.

Constructor & Destructor Documentation

◆ destruct_file_mapping()

final file_mapping_gbl::file_mapping::destruct_file_mapping ( type(file_mapping), intent(inout) this)
final

Destructor of the type "file_mapping".

Author
J Benda
Date
2021

Called when an instance of "file_mapping" is being destructed.

Here is the call graph for this function:

Member Function/Subroutine Documentation

◆ finalize()

procedure file_mapping_gbl::file_mapping::finalize ( class(file_mapping), intent(inout) this)

Finalize file virtual memory mapping.

Author
J Benda
Date
2020

Cancel the file mapping. This simply calls the POSIX munmap function.

◆ init()

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.

Author
J Benda
Date
2020 - 2025

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.

Parameters
[in]thisA file mapping object.
[in]filenameName of file to open (or prefix if unique_name is given).
[in]offsetPosition in file where to start mapped segment.
[in]lengthLength of the mapped segment.
[in]read_writeWhether to enable writing.
[in]unique_nameWhether to suffix filename with characters in order to make a unique file name.

Member Data Documentation

◆ addr

type(c_ptr) file_mapping_gbl::file_mapping::addr = c_null_ptr

Internal page-aligned pointer needed for finalization.

◆ length

integer(c_size_t) file_mapping_gbl::file_mapping::length = 0

Length of the mapped window.

◆ ptr

type(c_ptr) file_mapping_gbl::file_mapping::ptr = c_null_ptr

Pointer pointing to the requested location in file.


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