ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK > Class Template Reference

Functor for Timer_Queues. More...

#include <Timer_Queue_T.h>

List of all members.

Public Types

typedef ACE_Timer_Queue_T<
ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<
ACE_LOCK >, ACE_LOCK > 
TIMER_QUEUE

Public Member Functions

 ACE_Event_Handler_Handle_Timeout_Upcall (void)
 Constructor.

 ~ACE_Event_Handler_Handle_Timeout_Upcall (void)
 Destructor.

int registration (TIMER_QUEUE &timer_queue, ACE_Event_Handler *handler, const void *arg)
 This method is called when a timer is registered.

int preinvoke (TIMER_QUEUE &timer_queue, ACE_Event_Handler *handler, const void *arg, int recurring_timer, const ACE_Time_Value &cur_time, const void *&upcall_act)
 This method is called before the timer expires.

int timeout (TIMER_QUEUE &timer_queue, ACE_Event_Handler *handler, const void *arg, int recurring_timer, const ACE_Time_Value &cur_time)
 This method is called when the timer expires.

int postinvoke (TIMER_QUEUE &timer_queue, ACE_Event_Handler *handler, const void *arg, int recurring_timer, const ACE_Time_Value &cur_time, const void *upcall_act)
 This method is called after the timer expires.

int cancel_type (TIMER_QUEUE &timer_queue, ACE_Event_Handler *handler, int dont_call, int &requires_reference_counting)
 This method is called when a handler is cancelled.

int cancel_timer (TIMER_QUEUE &timer_queue, ACE_Event_Handler *handler, int dont_call, int requires_reference_counting)
 This method is called when a timer is cancelled.

int deletion (TIMER_QUEUE &timer_queue, ACE_Event_Handler *handler, const void *arg)

Private Member Functions

 ACE_Event_Handler_Handle_Timeout_Upcall (const ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK > &)
void operator= (const ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK > &)

Private Attributes

int requires_reference_counting_


Detailed Description

template<class ACE_LOCK>
class ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >

Functor for Timer_Queues.

This class implements the functor required by the Timer Queue to call on ACE_Event_Handlers.

Definition at line 475 of file Timer_Queue_T.h.


Member Typedef Documentation

template<class ACE_LOCK>
typedef ACE_Timer_Queue_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall<ACE_LOCK>, ACE_LOCK> ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::TIMER_QUEUE
 

Definition at line 481 of file Timer_Queue_T.h.


Constructor & Destructor Documentation

template<class ACE_LOCK>
ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::ACE_Event_Handler_Handle_Timeout_Upcall void   ) 
 

Constructor.

Definition at line 340 of file Timer_Queue_T.cpp.

00341 {
00342 }

template<class ACE_LOCK>
ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::~ACE_Event_Handler_Handle_Timeout_Upcall void   ) 
 

Destructor.

Definition at line 345 of file Timer_Queue_T.cpp.

00346 {
00347 }

template<class ACE_LOCK>
ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::ACE_Event_Handler_Handle_Timeout_Upcall const ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK > &   )  [private]
 


Member Function Documentation

template<class ACE_LOCK>
int ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::cancel_timer TIMER_QUEUE timer_queue,
ACE_Event_Handler handler,
int  dont_call,
int  requires_reference_counting
 

This method is called when a timer is cancelled.

Definition at line 449 of file Timer_Queue_T.cpp.

References ACE_Event_Handler::remove_reference().

Referenced by ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::deletion().

00453 {
00454   if (requires_reference_counting)
00455     event_handler->remove_reference ();
00456 
00457   return 0;
00458 }

template<class ACE_LOCK>
int ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::cancel_type TIMER_QUEUE timer_queue,
ACE_Event_Handler handler,
int  dont_call,
int &  requires_reference_counting
 

This method is called when a handler is cancelled.

Definition at line 431 of file Timer_Queue_T.cpp.

References ACE_Event_Handler::handle_close(), and ACE_Event_Handler::reference_counting_policy().

Referenced by ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::deletion().

00435 {
00436   requires_reference_counting =
00437     event_handler->reference_counting_policy ().value () ==
00438     ACE_Event_Handler::Reference_Counting_Policy::ENABLED;
00439 
00440   // Upcall to the <handler>s handle_close method
00441   if (dont_call == 0)
00442     event_handler->handle_close (ACE_INVALID_HANDLE,
00443                                  ACE_Event_Handler::TIMER_MASK);
00444 
00445   return 0;
00446 }

template<class ACE_LOCK>
int ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::deletion TIMER_QUEUE timer_queue,
ACE_Event_Handler handler,
const void *  arg
 

This method is called when the timer queue is destroyed and the timer is still contained in it

Definition at line 461 of file Timer_Queue_T.cpp.

References ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::cancel_timer(), and ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::cancel_type().

00464 {
00465   int requires_reference_counting = 0;
00466 
00467   this->cancel_type (timer_queue,
00468                      event_handler,
00469                      0,
00470                      requires_reference_counting);
00471 
00472   this->cancel_timer (timer_queue,
00473                       event_handler,
00474                       0,
00475                       requires_reference_counting);
00476 
00477   return 0;
00478 }

template<class ACE_LOCK>
void ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::operator= const ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK > &   )  [private]
 

template<class ACE_LOCK>
int ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::postinvoke TIMER_QUEUE timer_queue,
ACE_Event_Handler handler,
const void *  arg,
int  recurring_timer,
const ACE_Time_Value cur_time,
const void *  upcall_act
 

This method is called after the timer expires.

Definition at line 381 of file Timer_Queue_T.cpp.

References ACE_Event_Handler::remove_reference(), and ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::requires_reference_counting_.

00387 {
00388   if (upcall_act == &this->requires_reference_counting_)
00389     {
00390       event_handler->remove_reference ();
00391     }
00392 
00393   return 0;
00394 }

template<class ACE_LOCK>
int ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::preinvoke TIMER_QUEUE timer_queue,
ACE_Event_Handler handler,
const void *  arg,
int  recurring_timer,
const ACE_Time_Value cur_time,
const void *&  upcall_act
 

This method is called before the timer expires.

Definition at line 359 of file Timer_Queue_T.cpp.

References ACE_Event_Handler::add_reference(), ACE_Event_Handler::reference_counting_policy(), and ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::requires_reference_counting_.

00365 {
00366   bool const requires_reference_counting =
00367     event_handler->reference_counting_policy ().value () ==
00368     ACE_Event_Handler::Reference_Counting_Policy::ENABLED;
00369 
00370   if (requires_reference_counting)
00371     {
00372       event_handler->add_reference ();
00373 
00374       upcall_act = &this->requires_reference_counting_;
00375     }
00376 
00377   return 0;
00378 }

template<class ACE_LOCK>
int ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::registration TIMER_QUEUE timer_queue,
ACE_Event_Handler handler,
const void *  arg
 

This method is called when a timer is registered.

Definition at line 350 of file Timer_Queue_T.cpp.

References ACE_Event_Handler::add_reference().

00353 {
00354   event_handler->add_reference ();
00355   return 0;
00356 }

template<class ACE_LOCK>
int ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::timeout TIMER_QUEUE timer_queue,
ACE_Event_Handler handler,
const void *  arg,
int  recurring_timer,
const ACE_Time_Value cur_time
 

This method is called when the timer expires.

Definition at line 397 of file Timer_Queue_T.cpp.

References ACE_Reactor_Timer_Interface::cancel_timer(), ACE_Event_Handler::handle_timeout(), ACE_Event_Handler::reactor_timer_interface(), ACE_Event_Handler::reference_counting_policy(), and ACE_Event_Handler::remove_reference().

00402 {
00403   int requires_reference_counting = 0;
00404 
00405   if (!recurring_timer)
00406     {
00407       requires_reference_counting =
00408         event_handler->reference_counting_policy ().value () ==
00409         ACE_Event_Handler::Reference_Counting_Policy::ENABLED;
00410     }
00411 
00412   // Upcall to the <handler>s handle_timeout method.
00413   if (event_handler->handle_timeout (cur_time, act) == -1)
00414     {
00415       if (event_handler->reactor_timer_interface ())
00416         event_handler->reactor_timer_interface ()->cancel_timer (event_handler, 0);
00417       else
00418         timer_queue.cancel (event_handler, 0); // 0 means "call handle_close()".
00419     }
00420 
00421   if (!recurring_timer &&
00422       requires_reference_counting)
00423     {
00424       event_handler->remove_reference ();
00425     }
00426 
00427   return 0;
00428 }


Member Data Documentation

template<class ACE_LOCK>
int ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::requires_reference_counting_ [private]
 

Flag indicating that reference counting is required for this event handler upcall.

Definition at line 540 of file Timer_Queue_T.h.

Referenced by ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::postinvoke(), and ACE_Event_Handler_Handle_Timeout_Upcall< ACE_LOCK >::preinvoke().


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 12:54:38 2008 for ACE by doxygen 1.3.6