TAO_Time_Service_Clerk.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file    TAO_Time_Service_Clerk.h
00006  *
00007  *  $Id: TAO_Time_Service_Clerk.h 77001 2007-02-12 07:54:49Z johnnyw $
00008  *
00009  *  This class implements the CosTime::TimeService IDL interface.
00010  *
00011  *
00012  *  @author Vishal Kachroo  <vishal@cs.wustl.edu>
00013  */
00014 //=============================================================================
00015 
00016 
00017 #ifndef TAO_TIME_SERVICE_CLERK_H
00018 #define TAO_TIME_SERVICE_CLERK_H
00019 #include /**/ "ace/pre.h"
00020 
00021 #include "ace/Reactor.h"
00022 
00023 #include "orbsvcs/TimeServiceS.h"
00024 #include "orbsvcs/Time/Timer_Helper.h"
00025 #include "orbsvcs/Time/time_export.h"
00026 
00027 
00028 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00029 
00030 /**
00031  * @class TAO_Time_Service_Clerk
00032  *
00033  * @brief TimeService Object Implementation.
00034  *
00035  * The Object implementation implements methods to retrieve
00036  * GLOBAL time as well as secure GLOBAL time. The times are
00037  * retrieved as UTOs. The object also allows creation of a TIO
00038  * for a given time interval.  In general, the TimeService clerk
00039  * manages the UTOs and the TIOs. The notion of time returned
00040  * here is the globally synchronized time.
00041  */
00042 class TAO_Time_Export TAO_Time_Service_Clerk : public POA_CosTime::TimeService
00043 {
00044 public:
00045 
00046   /// Helper class to help in the updation of time.
00047   friend class Timer_Helper;
00048 
00049   /// Unbounded set of IORs.
00050   typedef ACE_Array_Base<CosTime::TimeService_var> IORS;
00051 
00052   // = Initialization and termination methods.
00053   /// Constructor.
00054   TAO_Time_Service_Clerk (int timer_value,
00055                           int timer_value_usecs,
00056                           const IORS& server);
00057 
00058   /// Destructor.
00059   ~TAO_Time_Service_Clerk (void);
00060 
00061   /// This operation returns the global time and an estimate of
00062   /// inaccuracy in a UTO.
00063   virtual CosTime::UTO_ptr universal_time (void);
00064 
00065   /**
00066    * This operation returns the global time in a UTO only if the time
00067    * can be guaranteed to have been obtained securely. Currently this
00068    * operation is not implemented and throws a CORBA::NO_IMPLEMENT
00069    * exception, if called.
00070    */
00071   virtual CosTime::UTO_ptr secure_universal_time (void);
00072 
00073   /// This creates a new UTO based on the given parameters.
00074   virtual CosTime::UTO_ptr new_universal_time (TimeBase::TimeT time,
00075                                                TimeBase::InaccuracyT inaccuracy,
00076                                                TimeBase::TdfT tdf);
00077 
00078   /// This creates a new UTO given a time in the UtcT form.
00079   virtual CosTime::UTO_ptr uto_from_utc (const TimeBase::UtcT &utc);
00080 
00081   /// This creates a new TIO with the given parameters.
00082   virtual CosTime::TIO_ptr new_interval (TimeBase::TimeT lower,
00083                                          TimeBase::TimeT upper);
00084 
00085   /// Return the globally synchronized time.
00086   virtual CORBA::ULongLong get_time (void);
00087 
00088   /// Returns the time displacement factor.
00089   CORBA::Short time_displacement_factor (void);
00090 
00091   /// Set the TDF.
00092   void time_displacement_factor (CORBA::Short);
00093 
00094   /// Get method for inaccuracy.
00095   TimeBase::InaccuracyT inaccuracy (void);
00096 
00097   /// Set method for inaccuracy.
00098   void inaccuracy (TimeBase::InaccuracyT inaccuracy);
00099 
00100   /// Clerk's notion of time.
00101   CORBA::ULongLong time_;
00102 
00103 private:
00104 
00105   /// Time displacement factor in minutes.
00106   CORBA::Short time_displacement_factor_;
00107 
00108   /// Inaccuracy in the time.
00109   TimeBase::InaccuracyT inaccuracy_;
00110 
00111   /// Set of server Time Server IORs.
00112   IORS server_;
00113 
00114   /// Time when last global synchronization was done.
00115   CORBA::ULongLong update_timestamp_;
00116 
00117   /**
00118    * This is a friend class that inherits from the Event Handler
00119    * class.  The handle_timeout method of this class is scheduled for
00120    * periodic invocation by the reactor. This method, in turn, updates
00121    * the clerks notion of time. Using this class obviates the need for
00122    * the clerk to multiple inherit from the servant base as well as
00123    * the event handler.
00124    */
00125   Timer_Helper helper_;
00126 };
00127 
00128 TAO_END_VERSIONED_NAMESPACE_DECL
00129 
00130 #include /**/ "ace/post.h"
00131 #endif /* TIME_SERVICE_CLERK_H */

Generated on Tue Feb 2 17:49:17 2010 for TAO_CosTime by  doxygen 1.4.7