2 #include "ace/Log_Category.h"
4 // AIX defines bzero() in this odd file... used by FD_ZERO
5 #if defined (ACE_HAS_STRINGS)
6 # include "ace/os_include/os_strings.h"
7 #endif /* ACE_HAS_STRINGS */
9 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
11 // Initialize the bitmask to all 0s and reset the associated fields.
14 ACE_Handle_Set::reset (void)
16 ACE_TRACE ("ACE_Handle_Set::reset");
19 #if defined (ACE_HAS_BIG_FD_SET)
22 #endif /* ACE_HAS_BIG_FD_SET */
24 // #if !defined (ACE_HAS_BIG_FD_SET) Why is this here? -Steve Huston
25 FD_ZERO (&this->mask_);
26 // #endif /* ACE_HAS_BIG_FD_SET */
29 #if defined (ACE_HAS_BIG_FD_SET)
30 ACE_INLINE ACE_Handle_Set &
31 ACE_Handle_Set::operator = (const ACE_Handle_Set &rhs)
33 ACE_TRACE ("ACE_Handle_Set::operator =");
51 #endif /* ACE_HAS_BIG_FD_SET */
53 // Returns the number of the large bit.
56 ACE_Handle_Set::max_set (void) const
58 ACE_TRACE ("ACE_Handle_Set::max_set");
59 return this->max_handle_;
62 // Checks whether handle is enabled.
65 ACE_Handle_Set::is_set (ACE_HANDLE handle) const
67 ACE_TRACE ("ACE_Handle_Set::is_set");
69 fd_set *set = const_cast<fd_set*> (&this->mask_);
70 int ret = FD_ISSET (handle, set);
72 #if defined (ACE_HAS_BIG_FD_SET)
73 ret = ret && this->size_ > 0;
74 #elif defined (ACE_VXWORKS) && ACE_VXWORKS >= 0x690
80 // Enables the handle.
83 ACE_Handle_Set::set_bit (ACE_HANDLE handle)
85 ACE_TRACE ("ACE_Handle_Set::set_bit");
86 if ((handle != ACE_INVALID_HANDLE)
87 && (!this->is_set (handle)))
89 #if defined (ACE_HANDLE_SET_USES_FD_ARRAY)
90 FD_SET ((SOCKET) handle,
93 #else /* ACE_HANDLE_SET_USES_FD_ARRAY */
94 #if defined (ACE_HAS_BIG_FD_SET)
96 FD_ZERO (&this->mask_);
98 if (handle < this->min_handle_)
99 this->min_handle_ = handle;
100 #endif /* ACE_HAS_BIG_FD_SET */
106 if (handle > this->max_handle_)
107 this->max_handle_ = handle;
108 #endif /* ACE_HANDLE_SET_USES_FD_ARRAY */
112 // Disables the handle.
115 ACE_Handle_Set::clr_bit (ACE_HANDLE handle)
117 ACE_TRACE ("ACE_Handle_Set::clr_bit");
119 if ((handle != ACE_INVALID_HANDLE) &&
120 (this->is_set (handle)))
122 FD_CLR ((ACE_SOCKET) handle,
126 #if !defined (ACE_HANDLE_SET_USES_FD_ARRAY)
127 if (handle == this->max_handle_)
128 this->set_max (this->max_handle_);
129 #endif /* !ACE_HANDLE_SET_USES_FD_ARRAY */
133 // Returns a count of the number of enabled bits.
136 ACE_Handle_Set::num_set (void) const
138 ACE_TRACE ("ACE_Handle_Set::num_set");
139 #if defined (ACE_HANDLE_SET_USES_FD_ARRAY)
140 return this->mask_.fd_count;
141 #else /* !ACE_HANDLE_SET_USES_FD_ARRAY */
143 #endif /* ACE_HANDLE_SET_USES_FD_ARRAY */
146 // Returns a pointer to the underlying fd_set.
149 ACE_Handle_Set::operator fd_set *()
151 ACE_TRACE ("ACE_Handle_Set::operator fd_set *");
154 return (fd_set *) &this->mask_;
159 // Returns a pointer to the underlying fd_set.
162 ACE_Handle_Set::fdset (void)
164 ACE_TRACE ("ACE_Handle_Set::fdset");
167 return (fd_set *) &this->mask_;
173 ACE_Handle_Set_Iterator::~ACE_Handle_Set_Iterator (void)
177 ACE_END_VERSIONED_NAMESPACE_DECL