libsim Versione 7.2.6
|
◆ toarray_charl()
/brief Return an array of char from
Definizione alla linea 113 del file list_character.F03. 114!> \brief class to use character lists in fortran 2003 WARNING !!!! CHAR LEN IS FIXED TO listcharmaxlen.
115!!
116!! Linked data structure is a data structure which
117!! consists of a set of data records (nodes) linked together and organized by references .
118!!
119!! A doubly-linked list is a linked data structure that consists of a set
120!! of sequentially linked records called nodes. Each node contains two
121!! fields, called links, that are references to the previous and to the
122!! next node in the sequence of nodes. The beginning and ending nodes'
123!! previous and next links, respectively, point to some kind of
124!! terminator.
125!!
126!! The program example is the better starting point:
127!!\include example_list.F03
128!!\ingroup base
129!!
133 private
135!> Character specific implementation of doubly-linked list
136!!
137!! extend list_abstract::list
139#ifdef DOXYGEN
140 integer::none ! doxigen workaround: if missed do not show procedure
141#endif
142 contains
143! procedure :: addCharacter !< add character in list
144 procedure :: current => currentcharacter !< get character pointed by iterator
145 procedure :: display => displaycharacter !< print the character list
146! generic :: add => addCharacter
148
149contains
150
151!> Print the character list
152subroutine displaycharacter(this)
153class(characterList) :: this
154
155call this%rewind()
156do while(this%element())
157
158 print *,"index:",this%currentindex()," value:", trim(this%current())
159 call this%next()
160end do
161end subroutine displaycharacter
162
163!!$ subroutine addCharacter(this, value)
164!!$ class(characterList) :: this
165!!$ character value
166!!$ class(*), allocatable :: v
167!!$
168!!$ allocate(v,source=value)
169!!$ call this%addvalue(v)
170!!$
171!!$ end subroutine addCharacter
172
173
174!> get character pointed by iterator
175function currentcharacter(this)
176character(len=listcharmaxlen) :: currentCharacter
177class(characterList) :: this
178
179currentcharacter = this%currentpoli()
180
181end function currentcharacter
182
183
184!> /brief Return an array of char from
185function toarray_charl(this)
186character(len=listcharmaxlen),allocatable :: toarray_charl(:) !< array
187type(characterlist) :: this !< list of char
188
189integer :: i
190
191allocate (toarray_charl(this%countelements()))
192
193call this%rewind()
194i=0
195do while(this%element())
196 i=i+1
197 toarray_charl(i) =this%current()
198 call this%next()
199end do
200end function toarray_charl
201
202
203
like abstract class to use character lists in fortran 2003 (gnu gcc 4.8 do not work with character(le... Definition list_abstractforchar.F03:48 class to use character lists in fortran 2003 WARNING ! Definition list_character.F03:58 Abstract implementation of doubly-linked list. Definition list_abstractforchar.F03:57 Character specific implementation of doubly-linked list. Definition list_character.F03:66 |