Appearance
finer_option_t
Option class definition.
Source: src/lib/finer_option_t.F90
Dependencies
Contents
- option
- integer_string
- real_string
- option
- free
- get_pairs
- get_string
- parse
- get_option
- get_a_option
- parse_comment
- parse_name
- parse_value
- print_option
- set_option
- set_a_option
- save_option
- assign_option
- assign_default
- convert
- split_complex
- count_values
- name_len
- values_len
- option_eq_string
- option_eq_character
- integer_string_I8P
- integer_string_I4P
- integer_string_I2P
- integer_string_I1P
- is_complex
- is_complex_list
- real_string_R8P
- real_string_R4P
- new_option
Derived Types
option
Option data of sections.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
oname | type(string) | Option name. | |
ovals | type(string) | Option values. | |
ocomm | type(string) | Eventual option inline comment. |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
count_values | pass(self) | Counting option value(s). |
free | pass(self) | Free dynamic memory. |
get | Get option value (scalar). | |
get_pairs | pass(self) | Return option name/values pairs. |
get_string | pass(self) | Get option value as an allocatable string. |
name_len | pass(self) | Return option name length. |
parse | pass(self) | Parse option data. |
print | pass(self) | Pretty print data. |
save | pass(self) | Save data. |
set | Set option value (scalar). | |
values_len | pass(self) | Return option values length. |
assignment(=) | Assignment overloading. | |
operator(==) | Equal operator overloading. | |
get_option | pass(self) | Get option value (scalar). |
get_a_option | pass(self) | Get option value (array). |
parse_comment | pass(self) | Parse option inline comment. |
parse_name | pass(self) | Parse option name. |
parse_value | pass(self) | Parse option values. |
set_option | pass(self) | Set option value (scalar). |
set_a_option | pass(self) | Set option value (array). |
assign_option | pass(lhs) | Assignment overloading. |
option_eq_string | pass(lhs) | Equal to string logical operator. |
option_eq_character | pass(lhs) | Equal to character logical operator. |
Interfaces
integer_string
Return the string representing an integer number, without the plus sign of positive numbers.
Module procedures: integer_string_I8P, integer_string_I4P, integer_string_I2P, integer_string_I1P
real_string
Return the shortest string representing a real number that is read back exactly.
Module procedures: real_string_R8P, real_string_R4P
option
Overload option name with a function returning a new (initiliazed) option instance.
Module procedures: new_option
Subroutines
free
Free dynamic memory.
Attributes: elemental
fortran
subroutine free(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(option) | inout | Option data. |
get_pairs
Return option name/values pairs.
Attributes: pure
fortran
subroutine get_pairs(self, pairs)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(option) | in | Option data. | |
pairs | character(len=:) | out | allocatable | Option name/values pairs. |
Call graph
get_string
Get option value as an allocatable string.
val is (re)allocated with the length of the option value. If the option has no value, val is left unchanged and an error is returned.
fortran
subroutine get_string(self, val, error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(option) | in | Option data. | |
val | character(len=:) | inout | allocatable | Value. |
error | integer(kind=I4P) | out | optional | Error code. |
Call graph
parse
Parse option data from a source string.
Attributes: elemental
fortran
subroutine parse(self, sep, source, error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(option) | inout | Option data. | |
sep | character(len=*) | in | Separator of option name/value. | |
source | type(string) | inout | String containing option data. | |
error | integer(kind=I4P) | out | Error code. |
Call graph
get_option
for getting option data value (scalar).
If the option value cannot be converted to the type of val, val is left unchanged and an error is returned.
fortran
subroutine get_option(self, val, error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(option) | in | Option data. | |
val | class(*) | inout | Value. | |
error | integer(kind=I4P) | out | optional | Error code. |
Call graph
get_a_option
Get option data values (array).
If val cannot hold all the values, or a value cannot be converted to the type of val, val is left unchanged and an error is returned.
fortran
subroutine get_a_option(self, val, delimiter, error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(option) | in | Option data. | |
val | class(*) | inout | Value. | |
delimiter | character(len=*) | in | optional | Delimiter used for separating values. |
error | integer(kind=I4P) | out | optional | Error code. |
Call graph
parse_comment
Parse option inline comment trimming it out from pure value string.
Attributes: elemental
fortran
subroutine parse_comment(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(option) | inout | Option data. |
Call graph
parse_name
Parse option name from a source string.
Attributes: elemental
fortran
subroutine parse_name(self, sep, source, error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(option) | inout | Option data. | |
sep | character(len=*) | in | Separator of option name/value. | |
source | type(string) | in | String containing option data. | |
error | integer(kind=I4P) | out | Error code. |
Call graph
parse_value
Parse option value from a source string.
Attributes: elemental
fortran
subroutine parse_value(self, sep, source, error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(option) | inout | Option data. | |
sep | character(len=*) | in | Separator of option name/value. | |
source | type(string) | in | String containing option data. | |
error | integer(kind=I4P) | out | Error code. |
Call graph
print_option
Print data with a pretty format.
fortran
subroutine print_option(self, unit, retain_comments, pref, iostat, iomsg)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(option) | in | Option data. | |
unit | integer(kind=I4P) | in | Logic unit. | |
retain_comments | logical | in | Flag for retaining eventual comments. | |
pref | character(len=*) | in | optional | Prefixing string. |
iostat | integer(kind=I4P) | out | optional | IO error. |
iomsg | character(len=*) | out | optional | IO error message. |
set_option
Set option data value (scalar).
If the type of val is not supported the option value is left unchanged and an error is returned.
Attributes: pure
fortran
subroutine set_option(self, val, error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(option) | inout | Option data. | |
val | class(*) | in | Value. | |
error | integer(kind=I4P) | out | optional | Error code. |
Call graph
set_a_option
Set option data value (array).
If the type of val is not supported the option value is left unchanged and an error is returned.
Attributes: pure
fortran
subroutine set_a_option(self, val, delimiter, error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(option) | inout | Option data. | |
val | class(*) | in | Value. | |
delimiter | character(len=*) | in | optional | Delimiter used for separating values. |
error | integer(kind=I4P) | out | optional | Error code. |
Call graph
save_option
Save data.
fortran
subroutine save_option(self, unit, retain_comments, iostat, iomsg)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(option) | in | Option data. | |
unit | integer(kind=I4P) | in | Logic unit. | |
retain_comments | logical | in | Flag for retaining eventual comments. | |
iostat | integer(kind=I4P) | out | optional | IO error. |
iomsg | character(len=*) | out | optional | IO error message. |
assign_option
Assignment between two options.
Attributes: elemental
fortran
subroutine assign_option(lhs, rhs)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(option) | inout | Left hand side. | |
rhs | type(option) | in | Rigth hand side. |
assign_default
Assign a default value to a value of one of the supported types.
A complex val accepts a complex, real or integer default of any supported kind. A real val accepts a real or integer default of any supported kind, an integer val accepts an integer default of any supported kind (that it can represent), a logical or character val accepts a default of the same type. For any other combination val is left unchanged and an error is returned.
fortran
subroutine assign_default(val, default, error)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
val | class(*) | inout | Value. | |
default | class(*) | in | Default value. | |
error | integer(kind=I4P) | out | Error code. |
Call graph
convert
Convert a string into a value of one of the supported types.
If the string cannot be converted, or the type of val is not supported, val is left unchanged and an error is returned.
fortran
subroutine convert(source, val, error, check_only)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
source | character(len=*) | in | String to be converted. | |
val | class(*) | inout | Value. | |
error | integer(kind=I4P) | out | Error code. | |
check_only | logical | in | optional | Check the conversion without modifying val. |
Call graph
split_complex
Split a list of complex values in the Fortran notation, e.g. (1.0, 2.0) (3.0, 4.0), into its values.
Whatever is between the values is ignored: the delimiter can be also inside the values.
Attributes: pure
fortran
subroutine split_complex(source, tokens)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
source | character(len=*) | in | String to be split. | |
tokens | type(string) | out | allocatable | Complex values. |
Call graph
Functions
count_values
Get the number of values of option data.
Attributes: elemental
Returns: integer(kind=I4P)
fortran
function count_values(self, delimiter) result(Nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(option) | in | Option data. | |
delimiter | character(len=*) | in | optional | Delimiter used for separating values. |
Call graph
name_len
Return option name length.
Attributes: elemental
Returns: integer
fortran
function name_len(self) result(length)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(option) | in | Option data. |
Call graph
values_len
Return option values length.
Attributes: elemental
Returns: integer
fortran
function values_len(self) result(length)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(option) | in | Option data. |
Call graph
option_eq_string
Equal to string logical operator.
Attributes: elemental
Returns: logical
fortran
function option_eq_string(lhs, rhs) result(is_it)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(option) | in | Left hand side. | |
rhs | type(string) | in | Right hand side. |
option_eq_character
Equal to character logical operator.
Attributes: elemental
Returns: logical
fortran
function option_eq_character(lhs, rhs) result(is_it)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
lhs | class(option) | in | Left hand side. | |
rhs | character(kind=CK, len=*) | in | Right hand side. |
integer_string_I8P
Return the string representing an integer number (I8P), without the plus sign of positive numbers.
Attributes: pure
Returns: character(len=:)
fortran
function integer_string_I8P(n) result(string)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
n | integer(kind=I8P) | in | Number. |
integer_string_I4P
Return the string representing an integer number (I4P), without the plus sign of positive numbers.
Attributes: pure
Returns: character(len=:)
fortran
function integer_string_I4P(n) result(string)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
n | integer(kind=I4P) | in | Number. |
integer_string_I2P
Return the string representing an integer number (I2P), without the plus sign of positive numbers.
Attributes: pure
Returns: character(len=:)
fortran
function integer_string_I2P(n) result(string)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
n | integer(kind=I2P) | in | Number. |
integer_string_I1P
Return the string representing an integer number (I1P), without the plus sign of positive numbers.
Attributes: pure
Returns: character(len=:)
fortran
function integer_string_I1P(n) result(string)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
n | integer(kind=I1P) | in | Number. |
is_complex
Return true if the values are of complex type.
Attributes: pure
Returns: logical
fortran
function is_complex(val)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
val | class(*) | in | Values. |
Call graph
is_complex_list
Return true if the string is a list of complex values in the Fortran notation, e.g. (1.0, 2.0) (3.0, 4.0).
Attributes: pure
Returns: logical
fortran
function is_complex_list(source)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
source | character(len=*) | in | String to be checked. |
Call graph
real_string_R8P
Return the shortest string representing a real number (R8P) that is read back exactly.
It is the compact string of PENF without the plus sign of the not negative numbers.
Attributes: pure
Returns: character(len=:)
fortran
function real_string_R8P(n) result(string)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
n | real(kind=R8P) | in | Number. |
real_string_R4P
Return the shortest string representing a real number (R4P) that is read back exactly.
It is the compact string of PENF without the plus sign of the not negative numbers.
Attributes: pure
Returns: character(len=:)
fortran
function real_string_R4P(n) result(string)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
n | real(kind=R4P) | in | Number. |
new_option
Return a new (initiliazed) option instance.
Attributes: elemental
Returns: type(option)
fortran
function new_option(option_name, option_values, option_comment)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
option_name | character(len=*) | in | optional | Option name. |
option_values | character(len=*) | in | optional | Option values. |
option_comment | character(len=*) | in | optional | Option comment. |