libsim Versione 7.2.6
list_linkchar.F03
1!> \brief class to manage links for lists in fortran 2003.
2!!
3!! Linked data structure is a data structure which
4!! consists of a set of data records (nodes) linked together and organized by references.
5!! This module is used by other lists modules only for character.
6!!\ingroup base
7module list_linkchar
8 parameter(listcharmaxlen=10)
9
10 private
11 public :: link, listcharmaxlen
12!> Base type to manage links for lists
13 type link
14 private
15 character(len=listcharmaxlen) :: value = "" !< value stored in link
16 type(link), pointer :: next => null()!< next link in list
17 type(link), pointer :: prev => null()!< next link in list
18 contains
19 procedure :: getValue !< return value pointer
20 procedure :: nextLink !< return next pointer
21 procedure :: prevLink !< return next pointer
22 procedure :: setNextLink !< set next pointer
23 procedure :: setPrevLink !< set next pointer
24 end type link
25
26!> User-defined constructors => list_link::constructor
27 interface link
28 procedure constructor !< construct/initialize a link
29 end interface
30
31contains
32
33function nextlink(this)
34class(link) :: this
35class(link), pointer :: nextLink
36nextlink => this%next
37end function nextlink
38
39function prevlink(this)
40class(link) :: this
41class(link), pointer :: prevLink
42prevlink => this%prev
43end function prevlink
44
45subroutine setnextlink(this,next)
46class(link) :: this
47type(link), pointer :: next
48this%next => next
49end subroutine setnextlink
50
51subroutine setprevlink(this,prev)
52class(link) :: this
53type(link), pointer :: prev
54this%prev => prev
55end subroutine setprevlink
57function getvalue(this)
58class(link) :: this
59character(len=listcharmaxlen) :: getvalue
60getvalue = this%value
61end function getvalue
63!> Constructor
64function constructor(value)
65type(link),pointer :: constructor
66character (len=*) :: value !< value for list
67
68allocate(constructor)
69constructor%prev => null()
70constructor%next => null()
71constructor%value=value
72
73end function constructor
74
75end module list_linkchar
class to manage links for lists in fortran 2003.

Generated with Doxygen.