Create a hash table from the contents of the JSON file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(json_file), | intent(inout) | :: | me | |||
| logical(kind=LK), | intent(out) | :: | status_ok |
true if no problems. |
||
| integer(kind=IK), | intent(in), | optional | :: | initial_capacity |
initial capacity of the hash table (number of buckets). If not provided, it will be set based on the number of members divided by the load factor to minimize the number of resizes needed as members are inserted |
subroutine initialize_hash(me, status_ok, initial_capacity) class(json_file), intent(inout) :: me logical(LK), intent(out) :: status_ok !! true if no problems. integer(IK), intent(in), optional :: initial_capacity !! initial capacity of the hash table (number of buckets). !! If not provided, it will be set based on the number of members !! divided by the load factor to minimize !! the number of resizes needed as members are inserted type(json_core) :: core type(json_value), pointer :: value ! get the JSON core from the file and the pointer to the root value: call me%get_core(core) call me%get(value) ! call the low-level routine: call me%hash%create(core, value, status_ok, initial_capacity) me%hash_enabled = status_ok end subroutine initialize_hash