-
Notifications
You must be signed in to change notification settings - Fork 1
/
map_interface.f90
70 lines (55 loc) · 1.7 KB
/
map_interface.f90
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
module map_interface
use object_class, only: object
implicit none
private
public :: map
type, extends(object), abstract :: map
contains
procedure(size) , deferred :: size
procedure(is_empty) , deferred :: is_empty
procedure(contains_key) , deferred :: contains_key
procedure(contains_value) , deferred :: contains_value
procedure(get) , deferred :: get
procedure(put) , deferred :: put
procedure(remove) , deferred :: remove
end type map
interface
type(integer) function size(this)
import map
class(map) :: this
end function size
type(logical) function is_empty(this)
import map
class(map) :: this
end function is_empty
type(logical) function contains_key(this, key)
import map
class(map) :: this
class(*), allocatable :: key
end function contains_key
type(logical) function contains_value(this, value)
import map
class(map) :: this
class(*), allocatable :: value
end function contains_value
function get(this, key) result(val)
import map
class(map) :: this
class(*), allocatable :: key
class(*), allocatable :: val
end function get
subroutine put(this, key, val)
import map
class(map) :: this
class(*), allocatable :: key
class(*), allocatable :: val
end subroutine put
function remove(this, key) result(val)
import map
class(map) :: this
class(*), allocatable :: key
class(*), allocatable :: val
end function remove
end interface
contains
end module map_interface