File object class.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
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. |
Overload =
.
Operator =
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_object), | intent(inout) | :: | lhs | Left hand side. |
||
type(file_object), | intent(in) | :: | rhs | Right hand side. |
Close file.
Close file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_object), | intent(inout) | :: | self | File object. |
Return a pretty-formatted description of the file.
Return a pretty-formatted description of the file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_object), | intent(in) | :: | self | Files collection. |
||
character(len=*), | intent(in), | optional | :: | prefix | Prefixing string. |
Description.
Destroy file.
Destroy file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_object), | intent(inout) | :: | self | File object. |
Operator =
.
Operator =
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_object), | intent(inout) | :: | lhs | Left hand side. |
||
type(file_object), | intent(in) | :: | rhs | Right hand side. |
Initialize file.
Initialize File.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(file_object), | intent(inout) | :: | self | File object. |
||
character(len=*), | intent(in), | optional | :: | file_name | File name. |
Load file name from file.
Load file name from file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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. |
Open file.
Open file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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. |
Save file name into file.
Save file name into file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
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. |
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