17 procedure, pass(this) ::
init
19 procedure, pass(this) ::
push
20 procedure, pass(this) ::
pop
21 procedure, pass(this) ::
top
22 procedure, pass(this) ::
size
27 subroutine init(this, capacity)
29 integer(I4B),
intent(in),
optional :: capacity
32 if (
present(capacity))
then
33 call this%stack%init(capacity)
35 call this%stack%init()
40 subroutine push(this, newValue)
42 integer(I4B) :: newValue
44 call this%stack%push_back(newvalue)
51 if (this%stack%size == 0)
then
52 write (*, *)
'STLStackInt exception: cannot pop an empty stack'
55 this%stack%size = this%stack%size - 1
59 function top(this)
result(top_value)
61 integer(I4B) :: top_value
63 if (this%stack%size == 0)
then
64 write (*, *)
'STLStackInt exception: cannot get top of an empty stack'
67 top_value = this%stack%at(this%stack%size)
71 function size(this)
result(size_value)
73 integer(I4B) :: size_value
75 size_value = this%stack%size
82 call this%stack%destroy()
This module defines variable data types.
This module contains simulation methods.
subroutine, public ustop(stopmess, ioutlocal)
Stop the simulation.
subroutine push(this, newValue)
integer(i4b) function size(this)
integer(i4b) function top(this)
A derived type representing a stack of integers.