Timer_Queue_T.inl

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Timer_Queue_T.inl,v 4.3 2005/10/28 23:55:10 ossama Exp
00004 
00005 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00006 
00007 template <class TYPE> ACE_INLINE void
00008 ACE_Timer_Node_T<TYPE>::set (const TYPE &type,
00009                              const void *a,
00010                              const ACE_Time_Value &t,
00011                              const ACE_Time_Value &i,
00012                              ACE_Timer_Node_T<TYPE> *n,
00013                              long timer_id)
00014 {
00015   this->type_ = type;
00016   this->act_ = a;
00017   this->timer_value_ = t;
00018   this->interval_ = i;
00019   this->next_ = n;
00020   this->timer_id_ = timer_id;
00021 }
00022 
00023 template <class TYPE> ACE_INLINE void
00024 ACE_Timer_Node_T<TYPE>::set (const TYPE &type,
00025                              const void *a,
00026                              const ACE_Time_Value &t,
00027                              const ACE_Time_Value &i,
00028                              ACE_Timer_Node_T<TYPE> *p,
00029                              ACE_Timer_Node_T<TYPE> *n,
00030                              long timer_id)
00031 {
00032   this->type_ = type;
00033   this->act_ = a;
00034   this->timer_value_ = t;
00035   this->interval_ = i;
00036   this->prev_ = p;
00037   this->next_ = n;
00038   this->timer_id_ = timer_id;
00039 }
00040 
00041 template <class TYPE> ACE_INLINE TYPE &
00042 ACE_Timer_Node_T<TYPE>::get_type (void)
00043 {
00044   return this->type_;
00045 }
00046 
00047 template <class TYPE> ACE_INLINE void
00048 ACE_Timer_Node_T<TYPE>::set_type (TYPE &type)
00049 {
00050   this->type_ = type;
00051 }
00052 
00053 template <class TYPE> ACE_INLINE const void *
00054 ACE_Timer_Node_T<TYPE>::get_act (void)
00055 {
00056   return this->act_;
00057 }
00058 
00059 template <class TYPE> ACE_INLINE void
00060 ACE_Timer_Node_T<TYPE>::set_act (void *act)
00061 {
00062   this->act_ = act;
00063 }
00064 
00065 template <class TYPE> ACE_INLINE const ACE_Time_Value &
00066 ACE_Timer_Node_T<TYPE>::get_timer_value (void) const
00067 {
00068   return this->timer_value_;
00069 }
00070 
00071 template <class TYPE> ACE_INLINE void
00072 ACE_Timer_Node_T<TYPE>::set_timer_value (const ACE_Time_Value &timer_value)
00073 {
00074   this->timer_value_ = timer_value;
00075 }
00076 
00077 template <class TYPE> ACE_INLINE const ACE_Time_Value &
00078 ACE_Timer_Node_T<TYPE>::get_interval (void) const
00079 {
00080   return this->interval_;
00081 }
00082 
00083 template <class TYPE> ACE_INLINE void
00084 ACE_Timer_Node_T<TYPE>::set_interval (const ACE_Time_Value &interval)
00085 {
00086   this->interval_ = interval;
00087 }
00088 
00089 template <class TYPE> ACE_INLINE ACE_Timer_Node_T<TYPE> *
00090 ACE_Timer_Node_T<TYPE>::get_prev (void)
00091 {
00092   return this->prev_;
00093 }
00094 
00095 template <class TYPE> ACE_INLINE void
00096 ACE_Timer_Node_T<TYPE>::set_prev (ACE_Timer_Node_T<TYPE> *prev)
00097 {
00098   this->prev_ = prev;
00099 }
00100 
00101 template <class TYPE> ACE_INLINE ACE_Timer_Node_T<TYPE> *
00102 ACE_Timer_Node_T<TYPE>::get_next (void)
00103 {
00104   return this->next_;
00105 }
00106 
00107 template <class TYPE> ACE_INLINE void
00108 ACE_Timer_Node_T<TYPE>::set_next (ACE_Timer_Node_T<TYPE> *next)
00109 {
00110   this->next_ = next;
00111 }
00112 
00113 template <class TYPE> ACE_INLINE long
00114 ACE_Timer_Node_T<TYPE>::get_timer_id (void) const
00115 {
00116   return this->timer_id_;
00117 }
00118 
00119 template <class TYPE> ACE_INLINE void
00120 ACE_Timer_Node_T<TYPE>::set_timer_id (long timer_id)
00121 {
00122   this->timer_id_ = timer_id;
00123 }
00124 
00125 template <class TYPE> ACE_INLINE void
00126 ACE_Timer_Node_T<TYPE>::get_dispatch_info (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info)
00127 {
00128   // Yes, do a copy
00129   info.type_ = this->type_;
00130   info.act_  = this->act_;
00131   info.recurring_timer_ =
00132     this->interval_ > ACE_Time_Value::zero;
00133 }
00134 
00135 template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void
00136 ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::timer_skew (const ACE_Time_Value &skew)
00137 {
00138   timer_skew_ = skew;
00139 }
00140 
00141 template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE const ACE_Time_Value &
00142 ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::timer_skew (void) const
00143 {
00144   return timer_skew_;
00145 }
00146 
00147 template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE int
00148 ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::expire (void)
00149 {
00150   if (!this->is_empty ())
00151     return this->expire (this->gettimeofday () + timer_skew_);
00152   else
00153     return 0;
00154 }
00155 
00156 template <class TYPE, class FUNCTOR, class ACE_LOCK> int
00157 ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::dispatch_info (const ACE_Time_Value &cur_time,
00158                                                            ACE_Timer_Node_Dispatch_Info_T<TYPE> &info)
00159 {
00160   ACE_TRACE ("ACE_Timer_Queue_T::dispatch_info");
00161   ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, 0));
00162 
00163   return this->dispatch_info_i (cur_time, info);
00164 }
00165 
00166 template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void
00167 ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::upcall (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info,
00168                                                     const ACE_Time_Value &cur_time)
00169 {
00170   this->upcall_functor ().timeout (*this,
00171                                    info.type_,
00172                                    info.act_,
00173                                    info.recurring_timer_,
00174                                    cur_time);
00175 }
00176 
00177 template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void
00178 ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::preinvoke (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info,
00179                                                        const ACE_Time_Value &cur_time,
00180                                                        const void *&upcall_act)
00181 {
00182   this->upcall_functor ().preinvoke (*this,
00183                                      info.type_,
00184                                      info.act_,
00185                                      info.recurring_timer_,
00186                                      cur_time,
00187                                      upcall_act);
00188 }
00189 
00190 template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void
00191 ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::postinvoke (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info,
00192                                                         const ACE_Time_Value &cur_time,
00193                                                         const void *upcall_act)
00194 {
00195   this->upcall_functor ().postinvoke (*this,
00196                                       info.type_,
00197                                       info.act_,
00198                                       info.recurring_timer_,
00199                                       cur_time,
00200                                       upcall_act);
00201 }
00202 
00203 template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE ACE_Time_Value
00204 ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::gettimeofday (void)
00205 {
00206   // Invoke gettimeofday via pointer to function.
00207   return this->gettimeofday_ ();
00208 }
00209 
00210 template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void
00211 ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::gettimeofday (ACE_Time_Value (*gettimeofday)(void))
00212 {
00213   this->gettimeofday_ = gettimeofday;
00214 }
00215 
00216 template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE FUNCTOR &
00217 ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::upcall_functor (void)
00218 {
00219   return *this->upcall_functor_;
00220 }
00221 
00222 ACE_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 09:42:07 2006 for ACE by doxygen 1.3.6