summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/TimeService.idl
blob: 8d27ca3d7beb27d93467f37edc134a3ffd498bcd (plain)
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
// -*- C++ -*-
// $Id$

#ifndef TAO_TIME_IDL
#define TAO_TIME_IDL

#include "CosTimeBase.idl"

#pragma prefix "omg.org"

module CosTime
{
  // = TITLE
  //  CosTime Module
  //
  // = DESCRIPTION
  // This module has all the interfaces, and associated enum
  // and exception declarations for the time service.

  enum TimeComparison
  {
    // = TITLE
    // TimeComparison defines the possible values that can be
    // returned as a result of comparing two UTOs.

    TCEqualTo,
    TCLessThan,
    TCGreaterThan,
    TCIndeterminate
  };

  enum ComparisonType
  {
    // = TITLE
    // ComparisonType defines the possible ways in which the times can
    // be compared.

    IntervalC,
    MidC
  };

  enum OverlapType
  {
    // = TITLE
    // OverlapType specifies the type of overlap between two time
    // intervals.

    OTContainer,
    OTContained,
    OTOverlap,
    OTNoOverlap
  };

  exception TimeUnavailable
    {
      // = TITLE
      // TimeUnavailable exception is raised by the Timeservice when
      // it cannot successfully return time.
    };

  interface TIO; // forward declaration.

  interface UTO
    {
      // = TITLE
      // The interface UTO is an encapsulation of time.
      //
      // = DESCRIPTION
      //   This interface provides the following
      //   operations on basic time :
      //	- Construction of a UTO from piece parts, and extraction of the
      //          piece parts from a UTO. The piece parts are the readonly
      //          attributes :
      //                      time
      //                      inaccuracy
      //                      time displacement factor
      //                      structure with all the above.
      //
      //        - Comparison of time.
      //
      //        - Conversion from relative to absolute time, and conversion to
      //          an interval (TIO)

      readonly attribute TimeBase::TimeT time;
      // absolute tine value.

      readonly attribute TimeBase::InaccuracyT inaccuracy;
      // inaccuracy in the time.

      readonly attribute TimeBase::TdfT tdf;
      // the time displacement factor.

      readonly attribute TimeBase::UtcT utc_time;
      // structure having the absolute time, the inaccuracy and the time
      // displacement factor.

      UTO absolute_time ();
      // This returns the absolute time by adding the base time to the
      // relative time in the object.

      TimeComparison compare_time (in ComparisonType comparison_type,
				   in UTO uto);
      // Compares the time contained in the object with the time in
      // the supplied uto according to the supplied comparison type.

      TIO time_to_interval (in UTO uto);
      // Returns a TIO representing the time interval between the time
      // in the object and the time in the UTO passed as a
      // parameter. The interval returned is the interval between the
      // mid-points of the two UTOs. Inaccuracies are ignored.  Note
      // the result of this operation is meaningless if the base times
      // of UTOs are different.

      TIO interval ();
      // Returns a TIO object representing the error interval around
      // the time value in the UTO.
    };

  interface TIO
    {
      // = TITLE
      // The TIO represents a time interval.
      //
      // = DESCRIPTION
      // This interface has operations to compare itself with a UTO or
      // another TIO. It also has an operation to create a UTO from
      // the value of it's time interval.

      readonly attribute TimeBase::IntervalT time_interval;
      // Consists of a lower and an upper bound for the time interval.

      CosTime::OverlapType spans (in UTO time,
				  out TIO overlap);
      // This operation compares the time in this interface with the time
      // in the supplied UTO and returns the overlap type as well as the
      // interval of overlap in the form of a TIO.

      CosTime::OverlapType overlaps (in TIO interval,
				     out TIO overlap);
      // This operation compares the time in this interface with the time
      // in the supplied TIO and returns the overlap type as well as the
      // interval of overlap in the form of a TIO.

      UTO time ();
      // Converts the time interval in this interface into a UTO object by
      // taking the midpoint of the interval as the time and the interval
      // as the error envelope around the time.

    };

  interface TimeService
    {
      // = TITLE
      // The time service manages the UTOs and the TIOs. This is the first
      // interface seen by the clients requesting time.

      UTO universal_time () raises (TimeUnavailable);
      // This operation returns the current time and an estimate of
      // inaccuracy in a UTO.

      UTO secure_universal_time () raises(TimeUnavailable);
      // This operation returns the current time in a UTO only if the
      // time can be guaranteed to have been obtained securely.

      UTO new_universal_time (in TimeBase::TimeT time,
			      in TimeBase::InaccuracyT inaccuracy,
			      in TimeBase::TdfT tdf);
      // This creates a new UTO based on the given parameters.

      UTO uto_from_utc (in TimeBase::UtcT utc);
      // This creates a new UTO given a time in the UtcT form.

      TIO new_interval (in TimeBase::TimeT lower,
			in TimeBase::TimeT upper );
      // This creates a new TIO with the given parameters.
    };
};

#endif /* TAO_TIME_IDL */