Restore build on FreeBSD.
[getmangos.git] / dep / ACE_wrappers / ace / Timer_Queue_T.inl
blob7606a2e1f6241f8f2236f60005855f3bcf270cfd
1 // -*- C++ -*-
2 //
3 // $Id: Timer_Queue_T.inl 80826 2008-03-04 14:51:23Z wotte $
5 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
7 template <class TYPE> ACE_INLINE void
8 ACE_Timer_Node_T<TYPE>::set (const TYPE &type,
9                              const void *a,
10                              const ACE_Time_Value &t,
11                              const ACE_Time_Value &i,
12                              ACE_Timer_Node_T<TYPE> *n,
13                              long timer_id)
15   this->type_ = type;
16   this->act_ = a;
17   this->timer_value_ = t;
18   this->interval_ = i;
19   this->next_ = n;
20   this->timer_id_ = timer_id;
23 template <class TYPE> ACE_INLINE void
24 ACE_Timer_Node_T<TYPE>::set (const TYPE &type,
25                              const void *a,
26                              const ACE_Time_Value &t,
27                              const ACE_Time_Value &i,
28                              ACE_Timer_Node_T<TYPE> *p,
29                              ACE_Timer_Node_T<TYPE> *n,
30                              long timer_id)
32   this->type_ = type;
33   this->act_ = a;
34   this->timer_value_ = t;
35   this->interval_ = i;
36   this->prev_ = p;
37   this->next_ = n;
38   this->timer_id_ = timer_id;
41 template <class TYPE> ACE_INLINE TYPE &
42 ACE_Timer_Node_T<TYPE>::get_type (void)
44   return this->type_;
47 template <class TYPE> ACE_INLINE void
48 ACE_Timer_Node_T<TYPE>::set_type (TYPE &type)
50   this->type_ = type;
53 template <class TYPE> ACE_INLINE const void *
54 ACE_Timer_Node_T<TYPE>::get_act (void)
56   return this->act_;
59 template <class TYPE> ACE_INLINE void
60 ACE_Timer_Node_T<TYPE>::set_act (void *act)
62   this->act_ = act;
65 template <class TYPE> ACE_INLINE const ACE_Time_Value &
66 ACE_Timer_Node_T<TYPE>::get_timer_value (void) const
68   return this->timer_value_;
71 template <class TYPE> ACE_INLINE void
72 ACE_Timer_Node_T<TYPE>::set_timer_value (const ACE_Time_Value &timer_value)
74   this->timer_value_ = timer_value;
77 template <class TYPE> ACE_INLINE const ACE_Time_Value &
78 ACE_Timer_Node_T<TYPE>::get_interval (void) const
80   return this->interval_;
83 template <class TYPE> ACE_INLINE void
84 ACE_Timer_Node_T<TYPE>::set_interval (const ACE_Time_Value &interval)
86   this->interval_ = interval;
89 template <class TYPE> ACE_INLINE ACE_Timer_Node_T<TYPE> *
90 ACE_Timer_Node_T<TYPE>::get_prev (void)
92   return this->prev_;
95 template <class TYPE> ACE_INLINE void
96 ACE_Timer_Node_T<TYPE>::set_prev (ACE_Timer_Node_T<TYPE> *prev)
98   this->prev_ = prev;
101 template <class TYPE> ACE_INLINE ACE_Timer_Node_T<TYPE> *
102 ACE_Timer_Node_T<TYPE>::get_next (void)
104   return this->next_;
107 template <class TYPE> ACE_INLINE void
108 ACE_Timer_Node_T<TYPE>::set_next (ACE_Timer_Node_T<TYPE> *next)
110   this->next_ = next;
113 template <class TYPE> ACE_INLINE long
114 ACE_Timer_Node_T<TYPE>::get_timer_id (void) const
116   return this->timer_id_;
119 template <class TYPE> ACE_INLINE void
120 ACE_Timer_Node_T<TYPE>::set_timer_id (long timer_id)
122   this->timer_id_ = timer_id;
125 template <class TYPE> ACE_INLINE void
126 ACE_Timer_Node_T<TYPE>::get_dispatch_info (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info)
128   // Yes, do a copy
129   info.type_ = this->type_;
130   info.act_  = this->act_;
131   info.recurring_timer_ =
132     this->interval_ > ACE_Time_Value::zero;
135 template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void
136 ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::timer_skew (const ACE_Time_Value &skew)
138   timer_skew_ = skew;
141 template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE const ACE_Time_Value &
142 ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::timer_skew (void) const
144   return timer_skew_;
147 template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE int
148 ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::expire (void)
150   if (!this->is_empty ())
151     return this->expire (this->gettimeofday () + timer_skew_);
152   else
153     return 0;
156 template <class TYPE, class FUNCTOR, class ACE_LOCK> int
157 ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::dispatch_info (const ACE_Time_Value &cur_time,
158                                                            ACE_Timer_Node_Dispatch_Info_T<TYPE> &info)
160   ACE_TRACE ("ACE_Timer_Queue_T::dispatch_info");
161   ACE_MT (ACE_GUARD_RETURN (ACE_LOCK, ace_mon, this->mutex_, 0));
163   return this->dispatch_info_i (cur_time, info);
166 template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void
167 ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::upcall (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info,
168                                                     const ACE_Time_Value &cur_time)
170   this->upcall_functor ().timeout (*this,
171                                    info.type_,
172                                    info.act_,
173                                    info.recurring_timer_,
174                                    cur_time);
177 template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void
178 ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::preinvoke (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info,
179                                                        const ACE_Time_Value &cur_time,
180                                                        const void *&upcall_act)
182   this->upcall_functor ().preinvoke (*this,
183                                      info.type_,
184                                      info.act_,
185                                      info.recurring_timer_,
186                                      cur_time,
187                                      upcall_act);
190 template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void
191 ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::postinvoke (ACE_Timer_Node_Dispatch_Info_T<TYPE> &info,
192                                                         const ACE_Time_Value &cur_time,
193                                                         const void *upcall_act)
195   this->upcall_functor ().postinvoke (*this,
196                                       info.type_,
197                                       info.act_,
198                                       info.recurring_timer_,
199                                       cur_time,
200                                       upcall_act);
203 template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE ACE_Time_Value
204 ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::gettimeofday (void)
206   // Invoke gettimeofday via pointer to function.
207   return this->gettimeofday_ ();
210 template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE void
211 ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::gettimeofday (ACE_Time_Value (*gettimeofday)(void))
213   this->gettimeofday_ = gettimeofday;
216 template <class TYPE, class FUNCTOR, class ACE_LOCK> ACE_INLINE FUNCTOR &
217 ACE_Timer_Queue_T<TYPE, FUNCTOR, ACE_LOCK>::upcall_functor (void)
219   return *this->upcall_functor_;
222 ACE_END_VERSIONED_NAMESPACE_DECL