3 //=============================================================================
5 * @file Reactor_Timer_Interface.h
7 * @author Irfan Pyarali <irfan@oomworks.com>
9 //=============================================================================
11 #ifndef ACE_REACTOR_TIMER_INTERFACE_H
12 #define ACE_REACTOR_TIMER_INTERFACE_H
14 #include /**/ "ace/pre.h"
16 #include "ace/Time_Value.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
24 class ACE_Event_Handler
;
27 * @class ACE_Reactor_Timer_Interface
29 * @brief Interface for timer related methods on the Reactor.
31 class ACE_Export ACE_Reactor_Timer_Interface
34 virtual ~ACE_Reactor_Timer_Interface ();
36 virtual long schedule_timer (ACE_Event_Handler
*event_handler
,
38 const ACE_Time_Value
&delay
,
39 const ACE_Time_Value
&interval
= ACE_Time_Value::zero
) = 0;
41 template<class Rep1
, class Period1
, class Rep2
= int, class Period2
= std::ratio
<1>>
42 long schedule_timer (ACE_Event_Handler
*event_handler
,
44 const std::chrono::duration
<Rep1
, Period1
>& delay
,
45 const std::chrono::duration
<Rep2
, Period2
>& interval
= std::chrono::duration
<Rep2
, Period2
>::zero ())
47 ACE_Time_Value
const tv_delay (delay
);
48 ACE_Time_Value
const tv_interval (interval
);
49 return this->schedule_timer (event_handler
, arg
, tv_delay
, tv_interval
);
52 virtual int reset_timer_interval (long timer_id
,
53 const ACE_Time_Value
&interval
) = 0;
55 template<class Rep
, class Period
>
56 int reset_timer_interval (long timer_id
,
57 const std::chrono::duration
<Rep
, Period
>& interval
)
59 ACE_Time_Value
const tv_interval (interval
);
60 return this->reset_timer_interval (timer_id
, tv_interval
);
63 virtual int cancel_timer (long timer_id
,
65 int dont_call_handle_close
= 1) = 0;
67 virtual int cancel_timer (ACE_Event_Handler
*event_handler
,
68 int dont_call_handle_close
= 1) = 0;
71 ACE_END_VERSIONED_NAMESPACE_DECL
73 #include /**/ "ace/post.h"
75 #endif /* ACE_REACTOR_TIMER_INTERFACE_H */