libsim Versione 7.2.6

◆ constructor()

type(link) function, pointer constructor ( class(*), intent(in) value)
private

Constructor.

Parametri
[in]valuevalue for list

Definizione alla linea 103 del file list_link.F03.

104!> \brief class to manage links for lists in fortran 2003.
105!!
106!! Linked data structure is a data structure which
107!! consists of a set of data records (nodes) linked together and organized by references.
108!! This module is used by other lists modules.
109!!\ingroup base
110module list_link
111 private
112 public :: link
113!> Base type to manage links for lists
114 type link
115 private
116 class(*), pointer :: value => null() !< value stored in link
117 type(link), pointer :: next => null()!< next link in list
118 type(link), pointer :: prev => null()!< next link in list
119 contains
120 procedure :: getValue !< return value pointer
121 procedure :: nextLink !< return next pointer
122 procedure :: prevLink !< return next pointer
123 procedure :: setNextLink !< set next pointer
124 procedure :: setPrevLink !< set next pointer
125 end type link
126
127!> User-defined constructors => list_link::constructor
128 interface link
129 procedure constructor !< construct/initialize a link
130 end interface
131
132contains
133
134function nextlink(this)
135class(link) :: this
136class(link), pointer :: nextLink
137nextlink => this%next
138end function nextlink
139
140function prevlink(this)
141class(link) :: this
142class(link), pointer :: prevLink
143prevlink => this%prev
144end function prevlink
145
146subroutine setnextlink(this,next)
147class(link) :: this
148type(link), pointer :: next
149this%next => next
150end subroutine setnextlink
151
152subroutine setprevlink(this,prev)
153class(link) :: this
154type(link), pointer :: prev
155this%prev => prev
156end subroutine setprevlink
157
158function getvalue(this)
159class(link),intent(in) :: this
160class(*), pointer :: getValue
161getvalue => this%value
162end function getvalue
163
164!> Constructor
165function constructor(value)
166type(link),pointer :: constructor
167class(*),intent(in) :: value !< value for list
168allocate(constructor)
169constructor%prev => null()
170constructor%next => null()
171allocate(constructor%value, source=value)
172end function constructor
173
174end module list_link

Generated with Doxygen.