26 class(*),
pointer ::
value => null()
27 type(list_node_t),
pointer :: next_node => null()
38 procedure list_node_constructor
47 class(*),
target ::
value
48 class(list_node_t),
pointer :: next
49 logical,
intent(in) :: clone
50 class(list_node_t),
pointer :: constructor
55 constructor%next_node => next
56 constructor%clone = clone
57 if (constructor%clone)
then
58 allocate(constructor%value, source=
value)
60 constructor%value =>
value
69 class(list_node_t),
target :: this
70 class(list_node_t),
pointer :: next
71 class(list_node_t),
pointer :: list_node_copy
80 class(list_node_t),
intent(in) :: this
81 class(list_node_t),
pointer :: next
83 next => this%next_node
89 class(list_node_t),
intent(inout) :: this
90 class(list_node_t),
pointer :: next_node
92 this%next_node => next_node
99 class(list_node_t),
intent(in) :: this
100 class(*),
pointer :: get
108 class(list_node_t),
intent(in) :: this
109 class(*),
target :: value
114 select type (ptr => this%value)
118 is_equal =
value == ptr
120 type is (real(real64))
122 type is (real(real64))
125 type is (
complex(real64))
127 type is (
complex(real64))
130 type is (
character(len=*))
132 type is (
character(len=*))
133 is_equal =
value == ptr
138 is_equal =
value .eqv. ptr
144 if (.not. is_equal)
then
145 is_equal =
associated(this%value,
value)
153 if (
associated(this%next_node))
then
154 nullify(this%next_node)
156 if (
associated(this%value))
then
158 deallocate(this%value)
This module implements a node of a polymorphic linked list.
class(list_node_t) function, pointer list_node_constructor(value, next, clone)
create a new node
class(list_node_t) function, pointer list_node_copy(this, next)
copy a node
subroutine list_node_finalize(this)
class(list_node_t) function, pointer list_node_next(this)
get next node
subroutine list_node_set_next(this, next_node)
logical function list_node_is_equal(this, value)
class(*) function, pointer list_node_get(this)
get data of node
This module is intended to contain "only mathematical" functions and procedures.
class for a node in a polymorphic linked list