summaryrefslogtreecommitdiff
path: root/TAO/tests/Xt_Stopwatch/timer.h
blob: 54c79f2f5518a70b225b6128ea2593bfa8f438a5 (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
// $Id$

// ============================================================================
//
// = LIBRARY
//   TAO/tests/Xt_Stopwatch
//
// = FILENAME
//   timer.h
//
// = AUTHOR
//   Bala
//
// ============================================================================
#ifndef TIMER_H
#define TIMER_H

#include <Xm/Xm.h>
#include "Stopwatch_display.h"


class Timer_imp
{
 public:
    
  Timer_imp (XtAppContext &, 
             CORBA::Long,
             Stopwatch_display *);
  // Constructor..
    
  void start(void);        
  // Resets, and starts the clock ticking

  void stop (void);         
  // Stops the clock

  CORBA::Float  elapsed_time(void ); 
  // Returns time since timer started

 private:
  
  static void tick_callback (XtPointer, XtIntervalId* );
  // Static member function used for TimeOut callback  
  
  void tick (void);  
  // Called every interval_ milliseconds
  
  virtual void report_time (CORBA::Float );
  // Called at each clock tick...  

  Stopwatch_display *stopwatch_;
  // A copy of the stopwatch object

  CORBA::Long counter_;    
  // Current number of ticks

  CORBA::Long interval_;   
  // Time in milliseconds between updates

  XtIntervalId id_;  
  // Identifier of current TimeOut

  XtAppContext app_; 
  // Required by Xt functions
};
#endif