ACE+TAO-6_5_17
[ACE_TAO.git] / TAO / tests / Xt_Stopwatch / timer.h
blob48979fd954bc70ffe7f13bfc6dc1cb2027dbb447
2 //=============================================================================
3 /**
4 * @file timer.h
6 * @author Bala <bala@cs.wustl.edu>
7 */
8 //=============================================================================
11 #ifndef TIMER_H
12 #define TIMER_H
14 #include "Stopwatch_display.h"
17 #include <Xm/Xm.h>
20 class Timer_imp
22 public:
24 /// Constructor
25 Timer_imp (XtAppContext &,
26 CORBA::Long,
27 Stopwatch_display *);
29 /// Destructor
30 virtual ~Timer_imp ();
32 /// Resets, and starts the clock ticking
33 void start (void);
35 /// Stops the clock
36 void stop (void);
38 /// Returns time since timer started
39 CORBA::Float elapsed_time (void);
41 private:
43 /// Static member function used for TimeOut callback.
44 static void tick_callback (XtPointer,
45 XtIntervalId *);
47 /// Called every interval_ milliseconds
48 void tick (void);
50 /// Called at each clock tick...
51 virtual void report_time (CORBA::Float);
53 /// A copy of the stopwatch object
54 Stopwatch_display *stopwatch_;
56 /// Current number of ticks
57 CORBA::Long counter_;
59 /// Time in milliseconds between updates
60 CORBA::Long interval_;
62 /// Identifier of current TimeOut
63 XtIntervalId id_;
65 /// Required by Xt functions
66 XtAppContext app_;
70 #endif /* TIMER_H */