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

00340 {
00341 }

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

Destructor.

Definition at line 344 of file Timer_Queue_T.cpp.

00345 {
00346 }

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

References ACE_Event_Handler::remove_reference().

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

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

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

References ACE_Event_Handler::Reference_Counting_Policy::ENABLED, ACE_Event_Handler::handle_close(), ACE_Event_Handler::reference_counting_policy(), and ACE_Event_Handler::TIMER_MASK.

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

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

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

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

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

References ACE_Event_Handler::remove_reference().

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

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

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

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

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

References ACE_Event_Handler::add_reference().

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

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

References ACE_Timer_Queue_T< TYPE, FUNCTOR, ACE_LOCK >::cancel(), ACE_Reactor_Timer_Interface::cancel_timer(), ACE_Event_Handler::Reference_Counting_Policy::ENABLED, ACE_Event_Handler::handle_timeout(), ACE_Event_Handler::reactor_timer_interface(), ACE_Event_Handler::reference_counting_policy(), and ACE_Event_Handler::remove_reference().

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


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 >::preinvoke().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:35:06 2010 for ACE by  doxygen 1.4.7