3
//=============================================================================
5
* @file TAO_Time_Service_Clerk.h
7
* TAO_Time_Service_Clerk.h,v 1.15 2003/07/21 23:51:33 dhinton Exp
9
* This class implements the CosTime::TimeService IDL interface.
12
* @author Vishal Kachroo <vishal@cs.wustl.edu>
14
//=============================================================================
17
#ifndef TAO_TIME_SERVICE_CLERK_H
18
#define TAO_TIME_SERVICE_CLERK_H
19
#include /**/ "ace/pre.h"
21
#include "ace/Reactor.h"
22
#include "orbsvcs/Naming/Naming_Utils.h"
24
#include "orbsvcs/TimeServiceS.h"
25
#include "Timer_Helper.h"
26
#include "time_export.h"
29
* @class TAO_Time_Service_Clerk
31
* @brief TimeService Object Implementation.
33
* The Object implementation implements methods to retrieve
34
* GLOBAL time as well as secure GLOBAL time. The times are
35
* retrieved as UTOs. The object also allows creation of a TIO
36
* for a given time interval. In general, the TimeService clerk
37
* manages the UTOs and the TIOs. The notion of time returned
38
* here is the globally synchronized time.
40
class TAO_Time_Export TAO_Time_Service_Clerk : public POA_CosTime::TimeService
44
/// Helper class to help in the updation of time.
45
friend class Timer_Helper;
47
/// Unbounded set of IORs.
48
typedef ACE_Array_Base<CosTime::TimeService_var> IORS;
50
// = Initialization and termination methods.
52
TAO_Time_Service_Clerk (int timer_value,
53
int timer_value_usecs,
57
~TAO_Time_Service_Clerk (void);
59
/// This operation returns the global time and an estimate of
60
/// inaccuracy in a UTO.
61
virtual CosTime::UTO_ptr universal_time (ACE_ENV_SINGLE_ARG_DECL)
62
ACE_THROW_SPEC ((CORBA::SystemException,
63
CosTime::TimeUnavailable));
66
* This operation returns the global time in a UTO only if the time
67
* can be guaranteed to have been obtained securely. Currently this
68
* operation is not implemented and throws a CORBA::NO_IMPLEMENT
69
* exception, if called.
71
virtual CosTime::UTO_ptr secure_universal_time (ACE_ENV_SINGLE_ARG_DECL)
72
ACE_THROW_SPEC ((CORBA::SystemException,
73
CosTime::TimeUnavailable));
75
/// This creates a new UTO based on the given parameters.
76
virtual CosTime::UTO_ptr new_universal_time (TimeBase::TimeT time,
77
TimeBase::InaccuracyT inaccuracy,
80
ACE_THROW_SPEC ((CORBA::SystemException));
82
/// This creates a new UTO given a time in the UtcT form.
83
virtual CosTime::UTO_ptr uto_from_utc (const TimeBase::UtcT &utc
85
ACE_THROW_SPEC ((CORBA::SystemException));
87
/// This creates a new TIO with the given parameters.
88
virtual CosTime::TIO_ptr new_interval (TimeBase::TimeT lower,
91
ACE_THROW_SPEC ((CORBA::SystemException));
93
/// Return the globally synchronized time.
94
virtual CORBA::ULongLong get_time (void);
96
/// This method is called by the driver program to set the Naming
98
void name_server (TAO_Naming_Server &server);
100
/// Returns the time displacement factor.
101
CORBA::Short time_displacement_factor (void);
104
void time_displacement_factor (CORBA::Short);
106
/// Get method for inaccuracy.
107
TimeBase::InaccuracyT inaccuracy (void);
109
/// Set method for inaccuracy.
110
void inaccuracy (TimeBase::InaccuracyT inaccuracy);
112
/// Clerk's notion of time.
113
CORBA::ULongLong time_;
117
/// Time displacement factor in minutes.
118
CORBA::Short time_displacement_factor_;
120
/// Inaccuracy in the time.
121
TimeBase::InaccuracyT inaccuracy_;
123
/// Set of server Time Server IORs.
126
/// Time when last global synchronization was done.
127
CORBA::ULongLong update_timestamp_;
130
* This is a friend class that inherits from the Event Handler
131
* class. The handle_timeout method of this class is scheduled for
132
* periodic invocation by the reactor. This method, in turn, updates
133
* the clerks notion of time. Using this class obviates the need for
134
* the clerk to multiple inherit from the servant base as well as
137
Timer_Helper helper_;
140
#include /**/ "ace/post.h"
141
#endif /* TIME_SERVICE_CLERK_H */