ACE+TAO-7_0_8
[ACE_TAO.git] / ACE / apps / JAWS3 / jaws3 / Timer.h
blob9f00ed5a75db6848dcf836b96fdf69f218e8b012
1 /* -*- c++ -*- */
2 #ifndef JAWS_TIMER_H
3 #define JAWS_TIMER_H
5 #include "ace/Singleton.h"
6 #include "ace/Timer_Wheel.h"
7 #include "ace/Timer_Queue_Adapters.h"
9 #include "jaws3/Export.h"
10 #include "jaws3/Event_Completer.h"
12 class JAWS_Timer;
13 class JAWS_Timer_Impl;
15 class JAWS_Export JAWS_Timer_Impl
16 // = TITLE
17 // Implementation base class for Timers that corresponds to the
18 // RHS of the Bridge pattern.
20 public:
22 virtual ~JAWS_Timer_Impl (void) {}
24 virtual void schedule_timer ( long *timer_id
25 , const ACE_Time_Value &delta
26 , JAWS_Event_Completer *completer
27 , void *act = 0
28 ) = 0;
29 // Schedule a timer to expire at now+delta.
31 virtual void schedule_absolute_timer ( long *timer_id
32 , const ACE_Time_Value &tv
33 , JAWS_Event_Completer *completer
34 , void *act = 0
35 ) = 0;
36 // Schedule a timer to expire at tv.
38 virtual void schedule_interval_timer ( long *timer_id
39 , const ACE_Time_Value &interval
40 , JAWS_Event_Completer *completer
41 , void *act = 0
42 ) = 0;
43 // Schedule a timer to expire at now+interval, and every interval following.
45 virtual void cancel_timer (long timer_id) = 0;
46 // Cancel a timer.
51 class JAWS_Export JAWS_Timer
52 // = TITLE
53 // Abstraction base class for Timers that corresponds to the LHS of the
54 // Bridge pattern.
56 public:
58 JAWS_Timer (JAWS_Timer_Impl *impl = 0);
60 static JAWS_Timer * instance (void)
62 return ACE_Singleton<JAWS_Timer, ACE_SYNCH_MUTEX>::instance ();
65 void schedule_timer ( long *timer_id
66 , const ACE_Time_Value &delta
67 , JAWS_Event_Completer *completer
68 , void *act = 0
71 void schedule_absolute_timer ( long *timer_id
72 , const ACE_Time_Value &tv
73 , JAWS_Event_Completer *completer
74 , void *act = 0
77 void schedule_interval_timer ( long *timer_id
78 , const ACE_Time_Value &interval
79 , JAWS_Event_Completer *completer
80 , void *act = 0
83 void cancel_timer (long timer_id);
85 private:
87 JAWS_Timer_Impl *impl_;
92 #endif /* JAWS_TIMER_H */