Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / ace / Select_Reactor_Base.inl
blob47125eb4fc4b3e8a69d7ce0bc34e904066074e2d
1 // -*- C++ -*-
2 #include "ace/Reactor.h"
4 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
6 ACE_INLINE ACE_Select_Reactor_Handler_Repository::size_type
7 ACE_Select_Reactor_Handler_Repository::size () const
9 #ifdef ACE_SELECT_REACTOR_BASE_USES_HASH_MAP
10   return this->event_handlers_.total_size ();
11 #else
12   return this->event_handlers_.size ();
13 #endif  /* ACE_SELECT_REACTOR_BASE_USES_HASH_MAP */
16 ACE_INLINE ACE_Select_Reactor_Handler_Repository::max_handlep1_type
17 ACE_Select_Reactor_Handler_Repository::max_handlep1 () const
19 #ifdef ACE_SELECT_REACTOR_BASE_USES_HASH_MAP
20   return this->event_handlers_.current_size ();
21 #else
22   return this->max_handlep1_;
23 #endif  /* ACE_SELECT_REACTOR_BASE_USES_HASH_MAP */
26 ACE_INLINE int
27 ACE_Select_Reactor_Handler_Repository::unbind (ACE_HANDLE handle,
28                                                ACE_Reactor_Mask mask)
30   // Do not refactor this code to optimize the call to the unbind impl.
31   // To resolve bug 2653, unbind must be called even when find_eh returns
32   // event_handlers_.end().
34   return !this->handle_in_range (handle) ? -1
35           : this->unbind (handle,
36                           this->find_eh (handle),
37                           mask);
40 ACE_INLINE ACE_Event_Handler *
41 ACE_Select_Reactor_Handler_Repository::find (ACE_HANDLE handle)
43   ACE_TRACE ("ACE_Select_Reactor_Handler_Repository::find");
45   ACE_Event_Handler * eh = 0;
47   if (this->handle_in_range (handle))
48     {
49       map_type::iterator const pos = this->find_eh (handle);
51       if (pos != this->event_handlers_.end ())
52         {
53 #ifdef ACE_SELECT_REACTOR_BASE_USES_HASH_MAP
54           eh = (*pos).item ();
55 #else
56           eh = *pos;
57 #endif  /* ACE_SELECT_REACTOR_BASE_USES_HASH_MAP */
58         }
59     }
60   // Don't bother setting errno.  It isn't used in the select()-based
61   // reactors and incurs a TSS access.
62   //   else
63   //     {
64   //       errno = ENOENT;
65   //     }
67   return eh;
70 // ------------------------------------------------------------------
72 ACE_INLINE bool
73 ACE_Select_Reactor_Handler_Repository_Iterator::done () const
75 #ifdef ACE_SELECT_REACTOR_BASE_USES_HASH_MAP
76   return this->current_ == this->rep_->event_handlers_.end ();
77 #else
78   return this->current_ == (this->rep_->event_handlers_.begin ()
79                             + this->rep_->max_handlep1 ());
80 #endif /* ACE_SELECT_REACTOR_BASE_USES_HASH_MAP */
83 // ------------------------------------------------------------------
85 ACE_INLINE
86 ACE_Event_Tuple::ACE_Event_Tuple ()
87   : handle_ (ACE_INVALID_HANDLE),
88     event_handler_ (0)
92 ACE_INLINE
93 ACE_Event_Tuple::ACE_Event_Tuple (ACE_Event_Handler* eh,
94                                   ACE_HANDLE h)
95   : handle_ (h),
96     event_handler_ (eh)
100 ACE_INLINE bool
101 ACE_Event_Tuple::operator== (const ACE_Event_Tuple &rhs) const
103   return this->handle_ == rhs.handle_;
106 ACE_INLINE bool
107 ACE_Event_Tuple::operator!= (const ACE_Event_Tuple &rhs) const
109   return !(*this == rhs);
112 #if defined (_MSC_VER)
113 #  pragma warning (push)
114 #  pragma warning (disable:4355)  /* Use of 'this' in initializer list */
115 #endif
116 ACE_INLINE
117 ACE_Select_Reactor_Impl::ACE_Select_Reactor_Impl (bool ms)
118   : handler_rep_ (*this)
119   , timer_queue_ (0)
120   , signal_handler_ (0)
121   , notify_handler_ (0)
122   , delete_timer_queue_ (false)
123   , delete_signal_handler_ (false)
124   , delete_notify_handler_ (false)
125   , initialized_ (false)
126   , restart_ (false)
127   , requeue_position_ (-1) // Requeue at end of waiters by default.
128   , owner_ (ACE_OS::NULL_thread)
129   , state_changed_ (false)
130   , mask_signals_ (ms)
131   , supress_renew_ (0)
134 #if defined (_MSC_VER)
135 #  pragma warning (pop)
136 #endif
138 ACE_INLINE bool
139 ACE_Select_Reactor_Impl::supress_notify_renew ()
141   return this->supress_renew_;
144 ACE_INLINE void
145 ACE_Select_Reactor_Impl::supress_notify_renew (bool sr)
147   this->supress_renew_ = sr;
150 ACE_END_VERSIONED_NAMESPACE_DECL