libsim Versione 7.2.6
|
◆ currentbyte()get byte pointed by iterator Definizione alla linea 102 del file list_byte.F03. 103!> \brief class to use lists in fortran 2003.
104!!
105!! Linked data structure is a data structure which
106!! consists of a set of data records (nodes) linked together and organized by references .
107!!
108!! A doubly-linked list is a linked data structure that consists of a set
109!! of sequentially linked records called nodes. Each node contains two
110!! fields, called links, that are references to the previous and to the
111!! next node in the sequence of nodes. The beginning and ending nodes'
112!! previous and next links, respectively, point to some kind of
113!! terminator.
114!!
115!! The program example is the better starting point:
116!!\include example_list.F03
117!!\ingroup base
118!!
122 private
124!> Byte specific implementation of doubly-linked list
125!!
126!! extend list_abstract::list
128#ifdef DOXYGEN
129 integer::none ! doxigen workaround: if missed do not show procedure
130#endif
131 contains
132! procedure :: addByte !< add byte in list
133 procedure :: current => currentbyte !< get byte pointed by iterator
134 procedure :: display => displaybyte !< print the byte list
135! generic :: add => addByte
137
138contains
139
140!> Print the byte list
141subroutine displaybyte(this)
142class(byteList),intent(inout) :: this
143
144call this%rewind()
145do while(this%element())
146 print *,"index:",this%currentindex()," value:", this%current()
147 call this%next()
148end do
149end subroutine displaybyte
150
151!!$ subroutine addByte(this, value)
152!!$ class(byteList) :: this
153!!$ byte value
154!!$ class(*), allocatable :: v
155!!$
156!!$ allocate(v,source=value)
157!!$ call this%addvalue(v)
158!!$
159!!$ end subroutine addByte
160
161
162!> get byte pointed by iterator
163integer(kind=int_b) function currentbyte(this)
164class(byteList) :: this
165class(*), pointer :: v
166
167v => this%currentpoli()
168select type(v)
169type is (integer(kind=int_b))
170 currentbyte = v
171end select
172end function currentbyte
173
Definition of constants to be used for declaring variables of a desired type. Definition kinds.F90:245 |