summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Time/Timer_Helper.h
blob: b38dd4eae8b21d9a7fff2b05801d76d60896fc9f (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
// -*- C++ -*-

//=============================================================================
/**
 * @file Timer_Helper.h
 *
 * $Id$
 *
 * This class is registered with the Reactor and extends from the
 * event handler.It is a friend of the TAO_Time_Service_Clerk and
 * helps to update the clerk's notion of globally synchronized
 * time. This class obviates the need for multiple inheritance in
 * the clerk.
 *
 * @author Vishal Kachroo  <vishal@cs.wustl.edu>
 */
//=============================================================================


#ifndef TIMER_HELPER_H
#define	TIMER_HELPER_H

#include /**/ "ace/pre.h"


#include "ace/Event_Handler.h"
#include "ace/Containers.h"
#include "time_export.h"

#include "orbsvcs/orbsvcs/TimeServiceS.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

class TAO_Time_Service_Clerk;

/**
 * @class Timer_Helper
 *
 * @brief Timer Helper for the clerk.
 *
 * The handle timeout method of this class is called periodically
 * by the reactor. This method updates the clerk's notion of
 * globally synchronized time by contacting the various Time
 * Servers.
 */
class TAO_Time_Export Timer_Helper : public ACE_Event_Handler
{
public:
  // = Initialization and termination methods.
  /// Constructor.
  Timer_Helper (void);

  /// Destructor.
  ~Timer_Helper (void);

  /// Constructor that sets the clerk.
  Timer_Helper (TAO_Time_Service_Clerk *clerk);

  /// This method is called periodically by the Reactor to update the
  /// clerk's time.
  int handle_timeout (const ACE_Time_Value &time,
		      const void *arg);

protected:
  /// Clerk's instance that this class helps to update time.
  TAO_Time_Service_Clerk *clerk_;

  /// The set of server IORs.
  typedef ACE_Array_Base<CosTime::TimeService_var> IORS;
};

#include /**/ "ace/post.h"

#endif /* TIMER_HELPER_H */