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 335 of file Timer_Queue_T.cpp.

00336 {
00337 }

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

Destructor.

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 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 444 of file Timer_Queue_T.cpp.

References ACE_Event_Handler::remove_reference().

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

00448 {
00449   if (requires_reference_counting)
00450     event_handler->remove_reference ();
00451 
00452   return 0;
00453 }

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 426 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().

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

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 456 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().

00459 {
00460   int requires_reference_counting = 0;
00461 
00462   this->cancel_type (timer_queue,
00463                      event_handler,
00464                      0,
00465                      requires_reference_counting);
00466 
00467   this->cancel_timer (timer_queue,
00468                       event_handler,
00469                       0,
00470                       requires_reference_counting);
00471 
00472   return 0;
00473 }

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 376 of file Timer_Queue_T.cpp.

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

00382 {
00383   if (upcall_act == &this->requires_reference_counting_)
00384     {
00385       event_handler->remove_reference ();
00386     }
00387 
00388   return 0;
00389 }

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 354 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_.

00360 {
00361   int requires_reference_counting =
00362     event_handler->reference_counting_policy ().value () ==
00363     ACE_Event_Handler::Reference_Counting_Policy::ENABLED;
00364 
00365   if (requires_reference_counting)
00366     {
00367       event_handler->add_reference ();
00368 
00369       upcall_act = &this->requires_reference_counting_;
00370     }
00371 
00372   return 0;
00373 }

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 345 of file Timer_Queue_T.cpp.

References ACE_Event_Handler::add_reference().

00348 {
00349   event_handler->add_reference ();
00350   return 0;
00351 }

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 392 of file Timer_Queue_T.cpp.

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

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


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 Thu Nov 9 11:22:05 2006 for ACE by doxygen 1.3.6