TAO_Time_Service_Clerk Class Reference

TimeService Object Implementation. More...

#include <TAO_Time_Service_Clerk.h>

Collaboration diagram for TAO_Time_Service_Clerk:

Collaboration graph
[legend]
List of all members.

Public Types

typedef ACE_Array_Base< CosTime::TimeService_var > IORS
 Unbounded set of IORs.


Public Member Functions

 TAO_Time_Service_Clerk (int timer_value, int timer_value_usecs, const IORS &server)
 Constructor.

 ~TAO_Time_Service_Clerk (void)
 Destructor.

virtual CosTime::UTO_ptr universal_time (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException, CosTime::TimeUnavailable)
virtual CosTime::UTO_ptr secure_universal_time (ACE_ENV_SINGLE_ARG_DECL) throw (CORBA::SystemException, CosTime::TimeUnavailable)
virtual CosTime::UTO_ptr new_universal_time (TimeBase::TimeT time, TimeBase::InaccuracyT inaccuracy, TimeBase::TdfT tdf ACE_ENV_ARG_DECL) throw (CORBA::SystemException)
 This creates a new UTO based on the given parameters.

virtual CosTime::UTO_ptr uto_from_utc (const TimeBase::UtcT &utc ACE_ENV_ARG_DECL) throw (CORBA::SystemException)
 This creates a new UTO given a time in the UtcT form.

virtual CosTime::TIO_ptr new_interval (TimeBase::TimeT lower, TimeBase::TimeT upper ACE_ENV_ARG_DECL) throw (CORBA::SystemException)
 This creates a new TIO with the given parameters.

virtual CORBA::ULongLong get_time (void)
 Return the globally synchronized time.

CORBA::Short time_displacement_factor (void)
 Returns the time displacement factor.

void time_displacement_factor (CORBA::Short)
 Set the TDF.

TimeBase::InaccuracyT inaccuracy (void)
 Get method for inaccuracy.

void inaccuracy (TimeBase::InaccuracyT inaccuracy)
 Set method for inaccuracy.


Public Attributes

CORBA::ULongLong time_
 Clerk's notion of time.


Private Attributes

CORBA::Short time_displacement_factor_
 Time displacement factor in minutes.

TimeBase::InaccuracyT inaccuracy_
 Inaccuracy in the time.

IORS server_
 Set of server Time Server IORs.

CORBA::ULongLong update_timestamp_
 Time when last global synchronization was done.

Timer_Helper helper_

Friends

class Timer_Helper
 Helper class to help in the updation of time.


Detailed Description

TimeService Object Implementation.

The Object implementation implements methods to retrieve GLOBAL time as well as secure GLOBAL time. The times are retrieved as UTOs. The object also allows creation of a TIO for a given time interval. In general, the TimeService clerk manages the UTOs and the TIOs. The notion of time returned here is the globally synchronized time.

Definition at line 42 of file TAO_Time_Service_Clerk.h.


Member Typedef Documentation

typedef ACE_Array_Base<CosTime::TimeService_var> TAO_Time_Service_Clerk::IORS
 

Unbounded set of IORs.

Definition at line 50 of file TAO_Time_Service_Clerk.h.

Referenced by TAO_Time_Service_Clerk().


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Time_Service_Clerk::TAO_Time_Service_Clerk int  timer_value,
int  timer_value_usecs,
const IORS server
 

Constructor.

Definition at line 14 of file TAO_Time_Service_Clerk.cpp.

References ACE_ERROR, ACE_Time_Value, helper_, IORS, LM_ERROR, TAO_ORB_Core::reactor(), ACE_Reactor::schedule_timer(), and TAO_ORB_Core_instance().

00017   : server_ (servers),
00018     helper_ (this)
00019 {
00020   // Schedule the helper to be invoked by the reactor
00021   // periodically.
00022 
00023   if (TAO_ORB_Core_instance ()->reactor ()->schedule_timer
00024       (&helper_,
00025        0,
00026        ACE_Time_Value::zero,
00027        ACE_Time_Value(timer_value,timer_value_usecs)) == -1)
00028     ACE_ERROR ((LM_ERROR,
00029                 "%p\n",
00030                 "schedule_timer ()"));
00031 }

TAO_Time_Service_Clerk::~TAO_Time_Service_Clerk void   ) 
 

Destructor.

Definition at line 35 of file TAO_Time_Service_Clerk.cpp.

00036 {
00037 }


Member Function Documentation

CORBA::ULongLong TAO_Time_Service_Clerk::get_time void   )  [virtual]
 

Return the globally synchronized time.

Definition at line 138 of file TAO_Time_Service_Clerk.cpp.

References ACE_OS::gettimeofday(), ACE_Time_Value::sec(), update_timestamp_, and ACE_Time_Value::usec().

00139 {
00140   // Globally sync. time is the latest global time plus the time
00141   // elapsed since last updation was done.
00142 
00143   const ACE_Time_Value timeofday = ACE_OS::gettimeofday ();
00144 
00145   return (CORBA::ULongLong) (static_cast<CORBA::ULongLong> (timeofday.sec ()) *
00146                              static_cast<ACE_UINT32> (10000000) +
00147                              static_cast<CORBA::ULongLong> (timeofday.usec () * 10))
00148     - this->update_timestamp_
00149     + this->time_;
00150 }

void TAO_Time_Service_Clerk::inaccuracy TimeBase::InaccuracyT  inaccuracy  ) 
 

Set method for inaccuracy.

Definition at line 176 of file TAO_Time_Service_Clerk.cpp.

References inaccuracy_.

00177 {
00178   this->inaccuracy_ = inaccuracy;
00179 }

TimeBase::InaccuracyT TAO_Time_Service_Clerk::inaccuracy void   ) 
 

Get method for inaccuracy.

Definition at line 169 of file TAO_Time_Service_Clerk.cpp.

References inaccuracy_.

Referenced by Timer_Helper::handle_timeout().

00170 {
00171   return this->inaccuracy_;
00172 }

CosTime::TIO_ptr TAO_Time_Service_Clerk::new_interval TimeBase::TimeT  lower,
TimeBase::TimeT upper  ACE_ENV_ARG_DECL
throw (CORBA::SystemException) [virtual]
 

This creates a new TIO with the given parameters.

Definition at line 122 of file TAO_Time_Service_Clerk.cpp.

References ACE_CHECK_RETURN, ACE_ENV_SINGLE_ARG_PARAMETER, and ACE_NEW_THROW_EX.

00126 {
00127   TAO_TIO *tio = 0;
00128 
00129   ACE_NEW_THROW_EX (tio,
00130                     TAO_TIO (lower,
00131                              upper),
00132                     CORBA::NO_MEMORY ());
00133   ACE_CHECK_RETURN (CosTime::TIO::_nil ());
00134   return tio->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
00135 }

CosTime::UTO_ptr TAO_Time_Service_Clerk::new_universal_time TimeBase::TimeT  time,
TimeBase::InaccuracyT  inaccuracy,
TimeBase::TdfT tdf  ACE_ENV_ARG_DECL
throw (CORBA::SystemException) [virtual]
 

This creates a new UTO based on the given parameters.

Definition at line 76 of file TAO_Time_Service_Clerk.cpp.

References ACE_CHECK_RETURN, ACE_ENV_SINGLE_ARG_PARAMETER, and ACE_NEW_THROW_EX.

00081 {
00082   TAO_UTO *uto = 0;
00083 
00084   ACE_NEW_THROW_EX (uto,
00085                     TAO_UTO (time,
00086                              inaccuracy,
00087                              tdf),
00088                     CORBA::NO_MEMORY ());
00089   ACE_CHECK_RETURN (CosTime::UTO::_nil ());
00090 
00091   return uto->_this (ACE_ENV_SINGLE_ARG_PARAMETER);
00092 }

virtual CosTime::UTO_ptr TAO_Time_Service_Clerk::secure_universal_time ACE_ENV_SINGLE_ARG_DECL   )  throw (CORBA::SystemException, CosTime::TimeUnavailable) [virtual]
 

This operation returns the global time in a UTO only if the time can be guaranteed to have been obtained securely. Currently this operation is not implemented and throws a CORBA::NO_IMPLEMENT exception, if called.

void TAO_Time_Service_Clerk::time_displacement_factor CORBA::Short   ) 
 

Set the TDF.

Definition at line 162 of file TAO_Time_Service_Clerk.cpp.

References time_displacement_factor_.

00163 {
00164   this->time_displacement_factor_ = tdf;
00165 }

CORBA::Short TAO_Time_Service_Clerk::time_displacement_factor void   ) 
 

Returns the time displacement factor.

Definition at line 155 of file TAO_Time_Service_Clerk.cpp.

References time_displacement_factor_.

Referenced by Timer_Helper::handle_timeout().

00156 {
00157   return time_displacement_factor_;
00158 }

virtual CosTime::UTO_ptr TAO_Time_Service_Clerk::universal_time ACE_ENV_SINGLE_ARG_DECL   )  throw (CORBA::SystemException, CosTime::TimeUnavailable) [virtual]
 

This operation returns the global time and an estimate of inaccuracy in a UTO.

virtual CosTime::UTO_ptr TAO_Time_Service_Clerk::uto_from_utc const TimeBase::UtcT &utc  ACE_ENV_ARG_DECL  )  throw (CORBA::SystemException) [virtual]
 

This creates a new UTO given a time in the UtcT form.


Friends And Related Function Documentation

friend class Timer_Helper [friend]
 

Helper class to help in the updation of time.

Definition at line 47 of file TAO_Time_Service_Clerk.h.


Member Data Documentation

Timer_Helper TAO_Time_Service_Clerk::helper_ [private]
 

This is a friend class that inherits from the Event Handler class. The handle_timeout method of this class is scheduled for periodic invocation by the reactor. This method, in turn, updates the clerks notion of time. Using this class obviates the need for the clerk to multiple inherit from the servant base as well as the event handler.

Definition at line 135 of file TAO_Time_Service_Clerk.h.

Referenced by TAO_Time_Service_Clerk().

TimeBase::InaccuracyT TAO_Time_Service_Clerk::inaccuracy_ [private]
 

Inaccuracy in the time.

Definition at line 119 of file TAO_Time_Service_Clerk.h.

Referenced by inaccuracy().

IORS TAO_Time_Service_Clerk::server_ [private]
 

Set of server Time Server IORs.

Definition at line 122 of file TAO_Time_Service_Clerk.h.

CORBA::ULongLong TAO_Time_Service_Clerk::time_
 

Clerk's notion of time.

Definition at line 111 of file TAO_Time_Service_Clerk.h.

Referenced by Timer_Helper::handle_timeout().

CORBA::Short TAO_Time_Service_Clerk::time_displacement_factor_ [private]
 

Time displacement factor in minutes.

Definition at line 116 of file TAO_Time_Service_Clerk.h.

Referenced by time_displacement_factor().

CORBA::ULongLong TAO_Time_Service_Clerk::update_timestamp_ [private]
 

Time when last global synchronization was done.

Definition at line 125 of file TAO_Time_Service_Clerk.h.

Referenced by get_time(), and Timer_Helper::handle_timeout().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:58:49 2006 for TAO_CosTime by doxygen 1.3.6