00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Timer_Helper.h 00006 * 00007 * Timer_Helper.h,v 1.14 2006/03/14 06:14:35 jtc Exp 00008 * 00009 * This class is registered with the Reactor and extends from the 00010 * event handler.It is a friend of the TAO_Time_Service_Clerk and 00011 * helps to update the clerk's notion of globally synchronized 00012 * time. This class obviates the need for multiple inheritance in 00013 * the clerk. 00014 * 00015 * @author Vishal Kachroo <vishal@cs.wustl.edu> 00016 */ 00017 //============================================================================= 00018 00019 00020 #ifndef TIMER_HELPER_H 00021 #define TIMER_HELPER_H 00022 00023 #include /**/ "ace/pre.h" 00024 00025 00026 #include "ace/Event_Handler.h" 00027 #include "ace/Containers.h" 00028 #include "orbsvcs/Time/time_export.h" 00029 00030 #include "orbsvcs/TimeServiceS.h" 00031 00032 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00033 # pragma once 00034 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00035 00036 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00037 00038 class TAO_Time_Service_Clerk; 00039 00040 /** 00041 * @class Timer_Helper 00042 * 00043 * @brief Timer Helper for the clerk. 00044 * 00045 * The handle timeout method of this class is called periodically 00046 * by the reactor. This method updates the clerk's notion of 00047 * globally synchronized time by contacting the various Time 00048 * Servers. 00049 */ 00050 class TAO_Time_Export Timer_Helper : public ACE_Event_Handler 00051 { 00052 public: 00053 // = Initialization and termination methods. 00054 /// Constructor. 00055 Timer_Helper (void); 00056 00057 /// Destructor. 00058 ~Timer_Helper (void); 00059 00060 /// Constructor that sets the clerk. 00061 Timer_Helper (TAO_Time_Service_Clerk *clerk); 00062 00063 /// This method is called periodically by the Reactor to update the 00064 /// clerk's time. 00065 int handle_timeout (const ACE_Time_Value &time, 00066 const void *arg); 00067 00068 protected: 00069 /// Clerk's instance that this class helps to update time. 00070 TAO_Time_Service_Clerk *clerk_; 00071 00072 /// The set of server IORs. 00073 typedef ACE_Array_Base<CosTime::TimeService_var> IORS; 00074 }; 00075 00076 TAO_END_VERSIONED_NAMESPACE_DECL 00077 00078 #include /**/ "ace/post.h" 00079 00080 #endif /* TIMER_HELPER_H */