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