It abstracts away all backend details and provides a type-safe interface
for all I/O tasks.
Key features:
- Type-safe sessions: specialised reader_session_t and writer_session_t
types for reading and writing operations, respectively.
- Automatic backend selection: based on compile-time options
- Resource cleanup: memory is automatically freed when sessions
go out of scope (using final subroutines).
- Simplified workflow - user only needs to manage a simple
open -> read/write -> close workflow, with no need for manual file handle
management or explicit cleanup calls.
@example
A typical usage pattern for reading data and writing data:
@code{.f90}
use m_io_session, only: writer_session_t, reader_session_t
! For writing data
call writer%open("output.bp")
call writer%write_data("temperature", temp_field)
call writer%close()
! Note: writer is automatically cleaned up when it goes out of scope
! For reading data
call reader%open("input.bp")
call reader%read_data("temperature", temp_field)
call reader%close()
! Note: reader is automatically cleaned up when it goes out of scope
@endcode
modules like m_io_base and m_io_backend are internal components and should
never be used directly in user code.
Public session types for user interaction
Nodes of different colours represent the following:
Solid arrows point from a submodule to the (sub)module which it is
descended from. Dashed arrows point from a module or program unit to
modules which it uses.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Nodes of different colours represent the following:
Solid arrows point from a submodule to the (sub)module which it is
descended from. Dashed arrows point from a module or program unit to
modules which it uses.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
PRIMARY TYPE FOR READING DATA - Use this for all file reading operations
This is the only interface users should use for reading data.
Provides type-safe reading operations with automatic backend selection.
PRIMARY TYPE FOR WRITING DATA - Use this for all file writing operations
This is the only interface users should use for writing data.
Provides type-safe writing operations with automatic backend selection.