file_object Derived Type

type, public :: file_object

type~~file_object~~InheritsGraph type~file_object file_object type~error_object error_object type~error_object->type~file_object error
Help


File object class.

Inherited By

type~~file_object~~InheritedByGraph type~file_object file_object type~files_collection_object files_collection_object type~file_object->type~files_collection_object boundary_conditions, grid, initial_conditions, logging, solution type~file_grid_object file_grid_object type~file_object->type~file_grid_object type~simulation_object simulation_object type~file_grid_object->type~simulation_object file_grid
Help

Source Code


Components

TypeVisibility AttributesNameInitial
type(error_object), public :: error

Errors handler.

character(len=:), public, allocatable:: file_name

File name.

integer(kind=I4P), public :: file_unit =0

File unit.

logical, public :: is_connected =.false.

Sentinel to check if file is connected.

logical, public :: is_initialized =.false.

Sentinel to check if file is initialized.


Type-Bound Procedures

generic, public :: assignment(=) => file_assign_file

Overload =.

  • private pure subroutine file_assign_file(lhs, rhs)

    Operator =.

    Arguments

    Type IntentOptional AttributesName
    class(file_object), intent(inout) :: lhs

    Left hand side.

    type(file_object), intent(in) :: rhs

    Right hand side.

procedure, public, pass(self) :: close

Close file.

  • private subroutine close(self)

    Close file.

    Arguments

    Type IntentOptional AttributesName
    class(file_object), intent(inout) :: self

    File object.

procedure, public, pass(self) :: description

Return a pretty-formatted description of the file.

  • private pure function description(self, prefix) result(desc)

    Return a pretty-formatted description of the file.

    Arguments

    Type IntentOptional AttributesName
    class(file_object), intent(in) :: self

    Files collection.

    character(len=*), intent(in), optional :: prefix

    Prefixing string.

    Return Value character(len=:), allocatable

    Description.

procedure, public, pass(self) :: destroy

Destroy file.

  • private elemental subroutine destroy(self)

    Destroy file.

    Arguments

    Type IntentOptional AttributesName
    class(file_object), intent(inout) :: self

    File object.

procedure, public, pass(lhs) :: file_assign_file

Operator =.

  • private pure subroutine file_assign_file(lhs, rhs)

    Operator =.

    Arguments

    Type IntentOptional AttributesName
    class(file_object), intent(inout) :: lhs

    Left hand side.

    type(file_object), intent(in) :: rhs

    Right hand side.

procedure, public, pass(self) :: initialize

Initialize file.

  • private elemental subroutine initialize(self, file_name)

    Initialize File.

    Arguments

    Type IntentOptional AttributesName
    class(file_object), intent(inout) :: self

    File object.

    character(len=*), intent(in), optional :: file_name

    File name.

procedure, public, pass(self) :: load_file_name_from_file

Load file name from file.

  • private subroutine load_file_name_from_file(self, fini, section_name, option_name, go_on_fail)

    Load file name from file.

    Arguments

    Type IntentOptional AttributesName
    class(file_object), intent(inout) :: self

    File object.

    type(file_ini), intent(in) :: fini

    Simulation parameters ini file handler.

    character(len=*), intent(in) :: section_name

    Option name into the ini file.

    character(len=*), intent(in) :: option_name

    Option name into the ini file.

    logical, intent(in), optional :: go_on_fail

    Go on if load fails.

procedure, public, pass(self) :: open

Open file.

  • private subroutine open(self, file_name, format, action, access)

    Open file.

    Arguments

    Type IntentOptional AttributesName
    class(file_object), intent(inout) :: self

    File object.

    character(len=*), intent(in), optional :: file_name

    File name.

    character(len=*), intent(in), optional :: format

    File format.

    character(len=*), intent(in), optional :: action

    File action.

    character(len=*), intent(in), optional :: access

    File access.

procedure, public, pass(self) :: save_file_name_into_file

Save file name into file.

  • private subroutine save_file_name_into_file(self, fini, section_name, option_name)

    Save file name into file.

    Arguments

    Type IntentOptional AttributesName
    class(file_object), intent(inout) :: self

    File object.

    type(file_ini), intent(inout) :: fini

    Simulation parameters ini file handler.

    character(len=*), intent(in) :: section_name

    Option name into the ini file.

    character(len=*), intent(in) :: option_name

    Option name into the ini file.

Source Code

type :: file_object
   !< File object class.
   type(error_object)            :: error                  !< Errors handler.
   character(len=:), allocatable :: file_name              !< File name.
   integer(I4P)                  :: file_unit=0            !< File unit.
   logical                       :: is_initialized=.false. !< Sentinel to check if file is initialized.
   logical                       :: is_connected=.false.   !< Sentinel to check if file is connected.
   contains
      ! public methods
      procedure, pass(self) :: close                    !< Close file.
      procedure, pass(self) :: description              !< Return a pretty-formatted description of the file.
      procedure, pass(self) :: destroy                  !< Destroy file.
      procedure, pass(self) :: initialize               !< Initialize file.
      procedure, pass(self) :: load_file_name_from_file !< Load file name from file.
      procedure, pass(self) :: open                     !< Open file.
      procedure, pass(self) :: save_file_name_into_file !< Save file name into file.
      ! operators
      generic :: assignment(=) => file_assign_file !< Overload `=`.
      ! private methods
      procedure, pass(lhs) :: file_assign_file !< Operator `=`.
endtype file_object