00001
00002
00003
00004
00005
00006
00007
00008 ACE_INLINE void
00009 ACE_Handle_Set::reset (void)
00010 {
00011 ACE_TRACE ("ACE_Handle_Set::reset");
00012 this->max_handle_ =
00013 ACE_INVALID_HANDLE;
00014 #if defined (ACE_HAS_BIG_FD_SET)
00015 this->min_handle_ =
00016 NUM_WORDS * WORDSIZE;
00017 #endif
00018 this->size_ = 0;
00019
00020 FD_ZERO (&this->mask_);
00021
00022 }
00023
00024 #if defined (ACE_HAS_BIG_FD_SET)
00025 ACE_INLINE ACE_Handle_Set &
00026 ACE_Handle_Set::operator = (const ACE_Handle_Set &rhs)
00027 {
00028 ACE_TRACE ("ACE_Handle_Set::operator =");
00029
00030 if (rhs.size_ > 0)
00031 {
00032 this->size_ =
00033 rhs.size_;
00034 this->max_handle_ =
00035 rhs.max_handle_;
00036 this->min_handle_ =
00037 rhs.min_handle_;
00038 this->mask_ =
00039 rhs.mask_;
00040 }
00041 else
00042 this->reset ();
00043
00044 return *this;
00045 }
00046 #endif
00047
00048
00049
00050 ACE_INLINE ACE_HANDLE
00051 ACE_Handle_Set::max_set (void) const
00052 {
00053 ACE_TRACE ("ACE_Handle_Set::max_set");
00054 return this->max_handle_;
00055 }
00056
00057
00058
00059 ACE_INLINE int
00060 ACE_Handle_Set::is_set (ACE_HANDLE handle) const
00061 {
00062 ACE_TRACE ("ACE_Handle_Set::is_set");
00063 #if defined (ACE_HAS_BIG_FD_SET)
00064 return FD_ISSET (handle,
00065 &this->mask_)
00066 && this->size_ > 0;
00067 #else
00068 return FD_ISSET (handle,
00069 &this->mask_);
00070 #endif
00071 }
00072
00073
00074
00075 ACE_INLINE void
00076 ACE_Handle_Set::set_bit (ACE_HANDLE handle)
00077 {
00078 ACE_TRACE ("ACE_Handle_Set::set_bit");
00079 if ((handle != ACE_INVALID_HANDLE)
00080 && (!this->is_set (handle)))
00081 {
00082 #if defined (ACE_WIN32)
00083 FD_SET ((SOCKET) handle,
00084 &this->mask_);
00085 this->size_++;
00086 #else
00087 #if defined (ACE_HAS_BIG_FD_SET)
00088 if (this->size_ == 0)
00089 FD_ZERO (&this->mask_);
00090
00091 if (handle < this->min_handle_)
00092 this->min_handle_ = handle;
00093 #endif
00094
00095 FD_SET (handle,
00096 &this->mask_);
00097 this->size_++;
00098
00099 if (handle > this->max_handle_)
00100 this->max_handle_ = handle;
00101 #endif
00102 }
00103 }
00104
00105
00106
00107 ACE_INLINE void
00108 ACE_Handle_Set::clr_bit (ACE_HANDLE handle)
00109 {
00110 ACE_TRACE ("ACE_Handle_Set::clr_bit");
00111
00112 if ((handle != ACE_INVALID_HANDLE) &&
00113 (this->is_set (handle)))
00114 {
00115 FD_CLR ((ACE_SOCKET) handle,
00116 &this->mask_);
00117 this->size_--;
00118
00119 #if !defined (ACE_WIN32)
00120 if (handle == this->max_handle_)
00121 this->set_max (this->max_handle_);
00122 #endif
00123 }
00124 }
00125
00126
00127
00128 ACE_INLINE int
00129 ACE_Handle_Set::num_set (void) const
00130 {
00131 ACE_TRACE ("ACE_Handle_Set::num_set");
00132 #if defined (ACE_WIN32)
00133 return this->mask_.fd_count;
00134 #else
00135 return this->size_;
00136 #endif
00137 }
00138
00139
00140
00141 ACE_INLINE
00142 ACE_Handle_Set::operator fd_set *()
00143 {
00144 ACE_TRACE ("ACE_Handle_Set::operator fd_set *");
00145
00146 if (this->size_ > 0)
00147 return (fd_set *) &this->mask_;
00148 else
00149 return (fd_set *) 0;
00150 }
00151
00152
00153
00154 ACE_INLINE fd_set *
00155 ACE_Handle_Set::fdset (void)
00156 {
00157 ACE_TRACE ("ACE_Handle_Set::fdset");
00158
00159 if (this->size_ > 0)
00160 return (fd_set *) &this->mask_;
00161 else
00162 return (fd_set *) 0;
00163 }
00164
00165 ACE_INLINE
00166 ACE_Handle_Set_Iterator::~ACE_Handle_Set_Iterator (void)
00167 {
00168 }