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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
--Copyright: Matra Datavision 1993
-- File: Quantity_Period.cdl
-- Created: January 4th, 1993
-- Author: J.P. BOUDIER - J.P. TIRAULT
--
class Period from Quantity
---Purpose: Manages date intervals. For example, a Period object
-- gives the interval between two dates.
-- A period is expressed in seconds and microseconds.
inherits Storable from Standard
raises PeriodDefinitionError
is
Create ( dd, hh, mn, ss : Integer ; mis , mics : Integer = 0)
returns Period
raises PeriodDefinitionError;
---Purpose: Creates a Period
-- With: 0 <= dd
-- 0 <= hh
-- 0 <= mn
-- 0 <= ss
-- 0 <= mis
-- 0 <= mics
Create ( ss : Integer; mics : Integer = 0 )
returns Period
raises PeriodDefinitionError;
---Purpose: Creates a Period with a number of seconds and microseconds.
-- Exceptions
-- Quantity_PeriodDefinitionError:
-- - if the number of seconds expressed either by:
-- - dd days, hh hours, mn minutes and ss seconds, or
-- - Ss
-- is less than 0.
-- - if the number of microseconds expressed either by:
-- - mis milliseconds and mics microseconds, or
-- - Mics
-- is less than 0.
Values (me ; dd, hh, mn, ss, mis, mics : out Integer) is static;
---Purpose: Decomposes this period into a number of days,hours,
-- minutes,seconds,milliseconds and microseconds
-- Example of return values:
-- 2 days, 15 hours, 0 minute , 0 second
-- 0 millisecond and 0 microsecond
Values (me; ss , mics : out Integer) is static;
---Purpose: Returns the number of seconds in Ss and the
-- number of remainding microseconds in Mics of this period.
-- Example of return values: 3600 seconds and 0 microseconds
SetValues (me : out; dd,hh, mn, ss : Integer; mis, mics : Integer = 0)
is static;
---Purpose: Assigns to this period the time interval defined
-- - with dd days, hh hours, mn minutes, ss
-- seconds, mis (defaulted to 0) milliseconds and
-- mics (defaulted to 0) microseconds; or
SetValues (me : out; ss : Integer ; mics : Integer = 0 ) is static ;
---Purpose: Assigns to this period the time interval defined
-- - with Ss seconds and Mics (defaulted to 0) microseconds.
-- Exceptions
-- Quantity_PeriodDefinitionError:
-- - if the number of seconds expressed either by:
-- - dd days, hh hours, mn minutes and ss seconds, or
-- - Ss
-- is less than 0.
-- - if the number of microseconds expressed either by:
-- - mis milliseconds and mics microseconds, or
-- - Mics
-- is less than 0.
Subtract (me ; anOther : Period) returns Period is static;
---Purpose: Subtracts one Period from another and returns the difference.
---C++: alias operator -
Add (me ; anOther : Period) returns Period is static;
---Purpose: Adds one Period to another one.
---C++: alias operator +
IsEqual (me ; anOther : Period) returns Boolean is static ;
---Purpose: Returns TRUE if both <me> and <other> are equal.
---C++: alias operator ==
IsShorter (me ; anOther : Period) returns Boolean is static;
---Purpose: Returns TRUE if <me> is shorter than <other>.
---C++: alias operator <
IsLonger (me ; anOther : Period) returns Boolean is static;
---Purpose: Returns TRUE if <me> is longer then <other>.
---C++: alias operator >
IsValid (myclass ; dd, hh, mn, ss : Integer ; mis , mics : Integer = 0)
returns Boolean;
---Purpose: Checks the validity of a Period in form (dd,hh,mn,ss,mil,mic)
-- With: 0 <= dd
-- 0 <= hh
-- 0 <= mn
-- 0 <= ss
-- 0 <= mis
-- 0 <= mics
IsValid (myclass ; ss : Integer ; mics : Integer = 0)
returns Boolean;
---Purpose: Checks the validity of a Period in form (ss,mic)
-- With: 0 <= ss
-- 0 <= mics
fields
mySec : Integer;
myUSec : Integer;
end Period from Quantity;
|