fhash_tbl_t Derived Type

type, public :: fhash_tbl_t


Contents


Components

Type Visibility Attributes Name Initial
type(fhash_node_t), public, allocatable :: buckets(:)

Finalization Procedures

final :: fhash_tbl_cleanup

  • private subroutine fhash_tbl_cleanup(tbl)

    Finalizer for fhash_tbl_t

    Arguments

    Type IntentOptional Attributes Name
    type(fhash_tbl_t), intent(inout) :: tbl

    Table object to allocate


Type-Bound Procedures

procedure, public, :: allocate => fhash_tbl_allocate

  • private subroutine fhash_tbl_allocate(tbl, size)

    Allocate hash table

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(inout) :: tbl

    Table object to allocate

    integer, intent(in), optional :: size

    Number of buckets in hash table If ommited, tbl is allocated with FHASH_DEFAULT_ALLOCATION

procedure, public, :: unset => fhash_tbl_unset

  • private subroutine fhash_tbl_unset(tbl, key, stat)

    Unset a value in the table

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(inout) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to remove

    integer, intent(out), optional :: stat

    Status flag. Zero if successful. Unsuccessful: FHASH_EMPTY_TABLE | FHASH_KEY_NOT_FOUND

procedure, public, :: check_key => fhash_tbl_check_key

  • private subroutine fhash_tbl_check_key(tbl, key, stat)

    Check if key exists in table

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    integer, intent(out) :: stat

    Status flag. Zero if key is found. Unsuccessful: FHASH_EMPTY_TABLE | FHASH_KEY_NOT_FOUND

procedure, public, :: stats => fhash_tbl_stats

  • private subroutine fhash_tbl_stats(tbl, num_buckets, num_items, num_collisions, max_depth)

    Get stats about the hash table

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    integer, intent(out), optional :: num_buckets

    Number of buckets allocated in table

    integer, intent(out), optional :: num_items

    Number of key-value pairs stored in table

    integer, intent(out), optional :: num_collisions

    Number of hash collisions

    integer, intent(out), optional :: max_depth

    Maximum depth of bucket in table

procedure, public, :: fhash_tbl_set_scalar

  • private subroutine fhash_tbl_set_scalar(tbl, key, value, pointer)

    Set/update a polymorphic scalar value in the table

    tbl is allocated with default size if not already allocated

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(inout) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to set/update

    class(*), intent(in), target :: value

    Value for key

    logical, intent(in), optional :: pointer

    If .true., store a pointer to value instead of copying

generic, public, :: set => fhash_tbl_set_scalar

  • private subroutine fhash_tbl_set_scalar(tbl, key, value, pointer)

    Set/update a polymorphic scalar value in the table

    tbl is allocated with default size if not already allocated

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(inout) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to set/update

    class(*), intent(in), target :: value

    Value for key

    logical, intent(in), optional :: pointer

    If .true., store a pointer to value instead of copying

procedure, public, :: fhash_tbl_set_scalar_ptr

  • private subroutine fhash_tbl_set_scalar_ptr(tbl, key, value)

    Get wrapper routine for generic 'set_ptr'

    tbl is allocated with default size if not already allocated

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(inout) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to set/update

    class(*), intent(in), target :: value

    Value for key

generic, public, :: set_ptr => fhash_tbl_set_scalar_ptr

  • private subroutine fhash_tbl_set_scalar_ptr(tbl, key, value)

    Get wrapper routine for generic 'set_ptr'

    tbl is allocated with default size if not already allocated

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(inout) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to set/update

    class(*), intent(in), target :: value

    Value for key

procedure, public, :: fhash_tbl_get_int64

  • private subroutine fhash_tbl_get_int64(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar int64 value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    integer(kind=int64), intent(out) :: value

    Output value

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

procedure, public, :: fhash_tbl_get_int32

  • private subroutine fhash_tbl_get_int32(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar int32 value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    integer(kind=int32), intent(out) :: value

    Output value

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

procedure, public, :: fhash_tbl_get_double

  • private subroutine fhash_tbl_get_double(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar double value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    real(kind=dp), intent(out) :: value

    Output value

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

procedure, public, :: fhash_tbl_get_float

  • private subroutine fhash_tbl_get_float(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar float value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    real(kind=sp), intent(out) :: value

    Output value

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

procedure, public, :: fhash_tbl_get_logical

  • private subroutine fhash_tbl_get_logical(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar logical value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    logical, intent(out) :: value

    Output value

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

procedure, public, :: fhash_tbl_get_char

  • private subroutine fhash_tbl_get_char(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar character value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    character(len=:), intent(out), allocatable :: value

    Output value

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

procedure, public, :: fhash_tbl_get_raw

  • private subroutine fhash_tbl_get_raw(tbl, key, value, stat)

    Get wrapper to directly retrieve underlying polymorhpic scalar value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    class(*), intent(out), allocatable :: value

    Output value

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

procedure, public, :: fhash_tbl_get_data

  • private subroutine fhash_tbl_get_data(tbl, key, data, stat)

    Retrieve data container from the hash table

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    type(fhash_container_t), pointer :: data

    Copy of value retrieved for key

    integer, intent(out), optional :: stat

    Status flag. Zero if successful. Unsuccessful: FHASH_EMPTY_TABLE | FHASH_KEY_NOT_FOUND

generic, public, :: get => fhash_tbl_get_int32, fhash_tbl_get_int64

  • private subroutine fhash_tbl_get_int32(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar int32 value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    integer(kind=int32), intent(out) :: value

    Output value

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

  • private subroutine fhash_tbl_get_int64(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar int64 value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    integer(kind=int64), intent(out) :: value

    Output value

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

generic, public, :: get => fhash_tbl_get_float, fhash_tbl_get_double

  • private subroutine fhash_tbl_get_float(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar float value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    real(kind=sp), intent(out) :: value

    Output value

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

  • private subroutine fhash_tbl_get_double(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar double value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    real(kind=dp), intent(out) :: value

    Output value

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

generic, public, :: get => fhash_tbl_get_char, fhash_tbl_get_logical

  • private subroutine fhash_tbl_get_char(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar character value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    character(len=:), intent(out), allocatable :: value

    Output value

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

  • private subroutine fhash_tbl_get_logical(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar logical value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    logical, intent(out) :: value

    Output value

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

generic, public, :: get => fhash_tbl_get_data

  • private subroutine fhash_tbl_get_data(tbl, key, data, stat)

    Retrieve data container from the hash table

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    type(fhash_container_t), pointer :: data

    Copy of value retrieved for key

    integer, intent(out), optional :: stat

    Status flag. Zero if successful. Unsuccessful: FHASH_EMPTY_TABLE | FHASH_KEY_NOT_FOUND

generic, public, :: get_raw => fhash_tbl_get_raw

  • private subroutine fhash_tbl_get_raw(tbl, key, value, stat)

    Get wrapper to directly retrieve underlying polymorhpic scalar value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    class(*), intent(out), allocatable :: value

    Output value

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

procedure, public, :: fhash_tbl_get_int64_ptr

  • private subroutine fhash_tbl_get_int64_ptr(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar int64 value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    integer(kind=int64), intent(out), pointer :: value

    Output value pointer

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

procedure, public, :: fhash_tbl_get_int32_ptr

  • private subroutine fhash_tbl_get_int32_ptr(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar int32 value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    integer(kind=int32), intent(out), pointer :: value

    Output value pointer

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

procedure, public, :: fhash_tbl_get_double_ptr

  • private subroutine fhash_tbl_get_double_ptr(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar double value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    real(kind=dp), intent(out), pointer :: value

    Output value pointer

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

procedure, public, :: fhash_tbl_get_float_ptr

  • private subroutine fhash_tbl_get_float_ptr(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar float value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    real(kind=sp), intent(out), pointer :: value

    Output value pointer

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

procedure, public, :: fhash_tbl_get_logical_ptr

  • private subroutine fhash_tbl_get_logical_ptr(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar logical value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    logical, intent(out), pointer :: value

    Output value pointer

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

procedure, public, :: fhash_tbl_get_char_ptr

  • private subroutine fhash_tbl_get_char_ptr(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar character value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    character(len=:), intent(out), pointer :: value

    Output value pointer

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

procedure, public, :: fhash_tbl_get_raw_ptr

  • private subroutine fhash_tbl_get_raw_ptr(tbl, key, value, stat)

    Get wrapper to directly retrieve underlying polymorhpic scalar value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    class(*), intent(out), pointer :: value

    Output value

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

generic, public, :: get_ptr => fhash_tbl_get_int32_ptr, fhash_tbl_get_int64_ptr

  • private subroutine fhash_tbl_get_int32_ptr(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar int32 value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    integer(kind=int32), intent(out), pointer :: value

    Output value pointer

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

  • private subroutine fhash_tbl_get_int64_ptr(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar int64 value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    integer(kind=int64), intent(out), pointer :: value

    Output value pointer

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

generic, public, :: get_ptr => fhash_tbl_get_float_ptr, fhash_tbl_get_double_ptr

  • private subroutine fhash_tbl_get_float_ptr(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar float value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    real(kind=sp), intent(out), pointer :: value

    Output value pointer

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

  • private subroutine fhash_tbl_get_double_ptr(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar double value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    real(kind=dp), intent(out), pointer :: value

    Output value pointer

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

generic, public, :: get_ptr => fhash_tbl_get_char_ptr, fhash_tbl_get_logical_ptr

  • private subroutine fhash_tbl_get_char_ptr(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar character value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    character(len=:), intent(out), pointer :: value

    Output value pointer

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

  • private subroutine fhash_tbl_get_logical_ptr(tbl, key, value, stat)

    Get wrapper to directly retrieve a scalar logical value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    logical, intent(out), pointer :: value

    Output value pointer

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.

generic, public, :: get_raw_ptr => fhash_tbl_get_raw_ptr

  • private subroutine fhash_tbl_get_raw_ptr(tbl, key, value, stat)

    Get wrapper to directly retrieve underlying polymorhpic scalar value

    Arguments

    Type IntentOptional Attributes Name
    class(fhash_tbl_t), intent(in) :: tbl

    Hash table object

    class(fhash_key_t), intent(in) :: key

    Key to retrieve

    class(*), intent(out), pointer :: value

    Output value

    integer, intent(out), optional :: stat

    Status flag. Zero if successful.