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