unidic Derived Type

type, public :: unidic

the class to hold key-index pairs, keys are strings, indices are unique ints


Contents


Finalization Procedures

final :: clean_dic

clean the object to avoid memory leak

  • private subroutine clean_dic(U)

    Arguments

    Type IntentOptional AttributesName
    type(unidic), intent(inout) :: U

Type-Bound Procedures

procedure, public :: num

the number of items in a unidic

  • private function num(U) result(res)

    Arguments

    Type IntentOptional AttributesName
    class(unidic), intent(in) :: U

    Return Value integer

procedure, public :: add

add a key to a unidic, return its index

  • private subroutine add(U, key, val)

    Arguments

    Type IntentOptional AttributesName
    class(unidic), intent(inout) :: U
    character(len=*), intent(in) :: key
    integer, intent(out) :: val

procedure, public :: del

delete a key in a unidic, return its index

  • private subroutine del(U, key)

    Arguments

    Type IntentOptional AttributesName
    class(unidic), intent(inout) :: U
    character(len=*), intent(in) :: key

procedure, public :: val

find a key in a unidic, return its index

  • private function val(U, key)

    Arguments

    Type IntentOptional AttributesName
    class(unidic), intent(in) :: U
    character(len=*), intent(in) :: key

    Return Value integer

procedure, public :: show

show a unidic

  • private subroutine show(U)

    Arguments

    Type IntentOptional AttributesName
    class(unidic), intent(inout) :: U

procedure, public :: rename

rename a key in a unidic

  • private subroutine rename(U, key1, key2)

    Arguments

    Type IntentOptional AttributesName
    class(unidic), intent(inout) :: U
    character(len=*), intent(in) :: key1
    character(len=*), intent(in) :: key2

procedure, public :: clean

clean a unidic

  • private subroutine clean(U)

    Arguments

    Type IntentOptional AttributesName
    class(unidic), intent(inout) :: U

procedure, public :: print

print a unidic to a file

  • private subroutine print(U, f_unit)

    Arguments

    Type IntentOptional AttributesName
    class(unidic), intent(inout) :: U
    integer, intent(in) :: f_unit

procedure, public :: read

read a unidic from a file

  • private subroutine read(U, f_unit)

    Arguments

    Type IntentOptional AttributesName
    class(unidic), intent(inout) :: U
    integer, intent(in) :: f_unit

procedure, public :: iterate

iterate a unidic. Use it in this way: do while(U%iterate(key,val))

  • private function iterate(U, key, val) result(res)

    Arguments

    Type IntentOptional AttributesName
    class(unidic), intent(inout) :: U
    character(len=max_char_length), intent(out) :: key
    integer, intent(out) :: val

    Return Value logical

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

assignment of a unidic

  • private subroutine copy(U_out, U_in)

    Arguments

    Type IntentOptional AttributesName
    class(unidic), intent(inout) :: U_out
    class(unidic), intent(in) :: U_in