-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimple_counters.ads
50 lines (42 loc) · 1.63 KB
/
simple_counters.ads
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
-- ---------------------------------------------------------------------
-- This software is provided as is in the hope that it might be found
-- useful.
-- You may use and modify it freely provided you keep this copyright
-- notice unchanged and mark modifications appropriately.
--
-- Bug reports and proposals for improvements are welcome. Please send
-- them to the eMail address below.
--
-- Christoph Karl Walter Grein
-- Hauptstr. 42
-- D-86926 Greifenberg
-- Germany
--
-- eMail: [email protected]
-- Internet: http://www.christ-usch-grein.homepage.t-online.de/
--
-- Copyright (c) 2018 Christoph Karl Walter Grein
-- ---------------------------------------------------------------------
package Simple_Counters is
--====================================================================
-- Author Christoph Grein
-- Version 1.0
-- Date 8 February 2018
--====================================================================
-- A counter for sequential use.
-- The counter starts with value 1. It must not become negative or
-- Constraint_Error will be raised.
--====================================================================
-- History
-- Author Version Date Reason for change
-- C.G. 1.0 08.02.2018 Created
--====================================================================
type Counter is limited private;
procedure Increase (This: in out Counter) with Inline;
procedure Decrease (This: in out Counter; is_Zero: out Boolean) with Inline;
is_Tasksafe: constant Boolean := False;
private
type Counter is record
Count: Natural := 1;
end record;
end Simple_Counters;