-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathiterator.f03
42 lines (36 loc) · 884 Bytes
/
iterator.f03
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
module iterator_mod
implicit none
private
public :: Iterator, RealIterator
!
! Top level class containing common characteristics
! of all iterators.
!
type, abstract :: Iterator
private
contains
procedure(hasNext_def), deferred :: hasNext
end type Iterator
abstract interface
function hasNext_def(self)
import Iterator
class(Iterator), intent(in) :: self
logical :: hasNext_def
end function hasNext_def
end interface
!
! An iterator which returns REAL values.
!
type, extends(Iterator), abstract :: RealIterator
private
contains
procedure(nextReal_def), deferred :: next
end type RealIterator
abstract interface
function nextReal_def(self)
import RealIterator
class(RealIterator), intent(inout) :: self
real :: next_def
end function nextReal_def
end interface
end module