Implements singly-linked list (sll) node with generic data container
Node type for hash table singly linked list
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| class(fhash_key_t), | public, | allocatable | :: | key | |||
| type(fhash_container_t), | public | :: | value | ||||
| type(fhash_node_t), | public, | pointer | :: | next | => | NULL() |
Determine depth of SLL
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(fhash_node_t), | intent(in), | target | :: | node |
Node to check depth |
Append node to SLL
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(fhash_node_t), | intent(inout) | :: | node |
Node to which to add data |
||
| class(fhash_key_t), | intent(in) | :: | key |
Key to add |
||
| class(*), | intent(in), | target | :: | value |
Value to add |
|
| logical, | intent(in), | optional | :: | pointer |
Store only a point if .true. |
Set container value in node
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(fhash_node_t), | intent(inout) | :: | node |
Node to which to add data |
||
| class(*), | intent(in), | target | :: | value |
Value to set |
|
| logical, | intent(in), | optional | :: | pointer |
Store only a pointer if .true. |
Search for a node with a specific key. Returns a pointer to the 'data' component of the corresponding node. Pointer is not associated if node cannot be found
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(fhash_node_t), | intent(in), | target | :: | node |
Node to search in |
|
| class(fhash_key_t) | :: | key |
Key to look for |
|||
| type(fhash_container_t), | intent(out), | pointer | :: | data |
Pointer to value container if found. (Unassociated if the key is not found in node) |
|
| logical, | intent(out), | optional | :: | found |
Return a node at a specific depth in the sll
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(fhash_node_t), | intent(in), | target | :: | node |
Node to search in |
|
| integer, | intent(in) | :: | depth |
Node depth to access |
||
| class(fhash_key_t), | intent(out), | allocatable | :: | key |
Key of found item (Unallocated if no node is found at specified depth) |
|
| type(fhash_container_t), | intent(out), | pointer | :: | data |
Pointer to value container if found. (Unassociated if no node is found at specified depth) |
|
| logical, | intent(out), | optional | :: | found |
Search for a node with a specific key and remove
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(fhash_node_t), | intent(inout) | :: | node |
Node to remove from |
||
| class(fhash_key_t) | :: | key |
Key to remove |
|||
| logical, | intent(out), | optional | :: | found |
Indicates if the key was found in node and removed |
|
| type(fhash_node_t), | intent(inout), | optional | :: | parent_node |
Used internally |
Deallocate node components and those of its children
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(fhash_node_t), | intent(inout) | :: | node |
Node to search in |