Implements a node which contains a pointer to two other (the next and previous) nodes, allowing a chain to be formed. This can be used to, for example, build a doubly-linked lists.
It is not anticipated that the bidir_node type, or any types extending it, will be handled directly by end users of FIAT; they are meant for internal use within this package.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
class(bidir_node), | private, | pointer | :: | prev | => | null() |
procedure, public :: has_prev | |
procedure, public :: get_prev | |
procedure, public :: set_prev | |
procedure, public :: unset_prev |
A node which, in addition to holding a value, points at two other (the previous and next) bidir_node objects or objects of a descendent type. This type can be built up into a chain, allowing a doubly-linked list to be formed.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(bidir_node), | intent(in) | :: | this |
Returns whether or not this node points to a previous one, forming a chain in the backwards direction.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(bidir_node), | intent(in) | :: | this |
Returns a pointer to the previous node in the chain. If this node does not point at a previous one one, then a null pointer is returned.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(bidir_node), | intent(inout) | :: | this | |||
class(bidir_node), | intent(in), | pointer | :: | new_prev | The node which will now be previous in the chain. |
|
logical, | intent(in), | optional | :: | deallocate_old | Whether to deallocate (rather than just nullify) any existing
previous nodes in the chain. Defaults to |
Sets the pointer to the previous node in the chain. If this node
already points to a previous one, the pointer will, by default, be
nullified. This may result in a memory leak. Optionally, by
setting deallocate_old=.true.
, the previous node (and all nodes
it points to) can be deallocated. This may result in a segfault if
another part of the program tries to access the former previous
node. The new previous node will not automatically be set to have
this one as the next, with the same rules applied to deallocation.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(bidir_node), | intent(inout) | :: | this | |||
logical, | intent(in), | optional | :: | deallocate_old | Whether to deallocate (rather than just nullify) any existing
p nodes in the chain. Defaults to |
Unsets the pointer to the previous node in the chain, severing it.
By default, the pointer is only nullified. This may result in a
memory leak. Optionally, by setting deallocate_old=.true.
, the
previous node (and all previous nodes it points to) can be
deallocated. This may result in a segfault if another part of the
program tries to access the former previous node.