nml_enum_key_t Derived Type

type, public, extends(nml_string_key_t) :: nml_enum_key_t

Enum key: a string restricted to an allowed list, validated case-insensitively and assigned its canonical spelling.


Inherits

type~~nml_enum_key_t~~InheritsGraph type~nml_enum_key_t nml_enum_key_t type~nml_string_key_t nml_string_key_t type~nml_enum_key_t->type~nml_string_key_t type~nml_key_t nml_key_t type~nml_string_key_t->type~nml_key_t

Components

Type Visibility Attributes Name Initial
character(len=:), public, allocatable :: allowed(:)
character(len=:), public, allocatable :: dead_reason

Unallocated/empty = live. Non-empty = this knob is registered (accepted, type/range-validated) but does NOT reach any ocean-path behaviour – e.g. &vcoord_nml zstar_stretching is captured on cfg but never copied onto ocean_state%vcoord (rdb_ocean_vcoord.F90:179,182). Carried into the JSON emitter (render_json) so a generated caller-side layer can warn on assignment instead of presenting a dead knob as live.

character(len=:), public, allocatable :: default
character(len=:), public, allocatable :: doc

Human-readable description (FORD-style synthesis doc).

logical, public :: found = .false.

Parse-state: set true when the key is seen in the file.

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

Key name (matched case-insensitively).

logical, public :: required = .false.

If true, the key must appear whenever its group appears.

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

Spellings that USED to be legal and no longer are (renamed or withdrawn). A namelist still carrying one must not fall through to the bare “not in allowed set {…}” message — that tells the reader the value is wrong but not what replaced it. Matching one of these fails loud with retired_hint instead.

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

What to say when a retired spelling is used. Name the replacement; this string IS the migration instruction.

character(len=:), public, pointer :: tgt => null()
character(len=:), public, allocatable :: units

Optional units string, default ‘’.


Type-Bound Procedures

procedure, public :: default_string => string_default_string

  • private function string_default_string(this) result(str)

    Arguments

    Type IntentOptional Attributes Name
    class(nml_string_key_t), intent(in) :: this

    Return Value character(len=:), allocatable

procedure, public :: is_default => string_is_default

  • private function string_is_default(this) result(yes)

    Arguments

    Type IntentOptional Attributes Name
    class(nml_string_key_t), intent(in) :: this

    Return Value logical

procedure, public :: parse_tokens => enum_parse

  • private subroutine enum_parse(this, values, err_msg)

    Arguments

    Type IntentOptional Attributes Name
    class(nml_enum_key_t), intent(inout) :: this
    character(len=*), intent(in) :: values(:)
    character(len=:), intent(out), allocatable :: err_msg

procedure, public :: value_string => string_value_string

  • private function string_value_string(this) result(str)

    Arguments

    Type IntentOptional Attributes Name
    class(nml_string_key_t), intent(in) :: this

    Return Value character(len=:), allocatable

Source Code

   type, extends(nml_string_key_t) :: nml_enum_key_t
      !! Enum key: a string restricted to an allowed list, validated
      !! case-insensitively and assigned its canonical spelling.
      character(len=:), allocatable :: allowed(:)
      character(len=:), allocatable :: retired(:)
         !! Spellings that USED to be legal and no longer are (renamed or
         !! withdrawn).  A namelist still carrying one must not fall
         !! through to the bare "not in allowed set {…}" message — that
         !! tells the reader the value is wrong but not what replaced it.
         !! Matching one of these fails loud with `retired_hint` instead.
      character(len=:), allocatable :: retired_hint
         !! What to say when a retired spelling is used.  Name the
         !! replacement; this string IS the migration instruction.
   contains
      procedure :: parse_tokens => enum_parse
   end type nml_enum_key_t