summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-05-28 12:57:24 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-05-28 12:57:24 +0000
commit72af31ee073fef94f8ea7b10726bda2c36163f03 (patch)
tree8be37f006966cd8ae97fcdebb82fa886cba79e99
parent06077ebe682cd629408ecd3ba99ba86a1079b741 (diff)
downloadATCD-72af31ee073fef94f8ea7b10726bda2c36163f03.tar.gz
merged main trunk (V 4.2.3) changes
-rw-r--r--ace/Handle_Set.i111
-rw-r--r--ace/Local_Tokens_T.h3
-rw-r--r--ace/Local_Tokens_T.i2
3 files changed, 108 insertions, 8 deletions
diff --git a/ace/Handle_Set.i b/ace/Handle_Set.i
index d7577404ea3..e6d9265076d 100644
--- a/ace/Handle_Set.i
+++ b/ace/Handle_Set.i
@@ -41,7 +41,7 @@ ACE_Handle_Set::set_bit (ACE_HANDLE handle)
if (!this->is_set (handle))
{
#if defined(ACE_WIN32)
- FD_SET ((SOCKET)handle, &this->mask_);
+ FD_SET ((SOCKET) handle, &this->mask_);
#else /* !ACE_WIN32 */
FD_SET (handle, &this->mask_);
this->size_++;
@@ -77,7 +77,7 @@ ACE_INLINE int
ACE_Handle_Set::num_set (void) const
{
ACE_TRACE ("ACE_Handle_Set::num_set");
-#if defined(ACE_WIN32)
+#if defined (ACE_WIN32)
return this->mask_.fd_count;
#else /* !ACE_WIN32 */
return this->size_;
@@ -97,11 +97,108 @@ ACE_INLINE ACE_HANDLE
ACE_Handle_Set_Iterator::operator () (void)
{
ACE_TRACE ("ACE_Handle_Set_Iterator::operator");
-#if defined(ACE_WIN32)
- return this->index_ < this->handles_.mask_.fd_count
- ? (ACE_HANDLE)this->handles_.mask_.fd_array[this->index_]
- : ACE_INVALID_HANDLE;
+#if defined (ACE_WIN32)
+ if (this->handle_index_ < this->handles_.mask_.fd_count)
+ // Return the handle and advance the iterator.
+ return (ACE_HANDLE) this->handles_.mask_.fd_array[this->handle_index_++];
+ else
+ return ACE_INVALID_HANDLE;
+
#else /* !ACE_WIN32 */
- return this->num_ <= this->handles_.max_handle_ ? this->num_ : -1;
+ // No sense searching further than the max_handle_ + 1;
+ ACE_HANDLE maxhandlep1 = this->handles_.max_handle_ + 1;
+
+ if (this->handle_index_ >= maxhandlep1)
+ // We've seen all the handles we're interested in seeing for this
+ // iterator.
+ return ACE_INVALID_HANDLE;
+ else
+ {
+ ACE_HANDLE result = this->handle_index_;
+
+ // Increment the iterator.
+ this->handle_index_++;
+ this->word_val_ = (this->word_val_ >> 1) & ACE_MSB_MASK;
+
+ // If've examined all the bits in this word, we'll go onto the
+ // next word.
+
+ if (this->word_val_ == 0)
+ {
+ // Loop until we've found the first non-zero bit or we run
+ // past the <maxhandlep1> of the bitset.
+ while (this->handle_index_ < maxhandlep1
+ && this->handles_.mask_.fds_bits[++this->word_num_] == 0)
+ this->handle_index_ += ACE_Handle_Set::WORDSIZE;
+
+ // If the bit index becomes >= the maxhandlep1 that means
+ // there weren't any more bits set that we want to consider.
+ // Therefore, we'll just store the maxhandlep1, which will
+ // cause <operator()> to return <ACE_INVALID_HANDLE>
+ // immediately next time it's called.
+ if (this->handle_index_ >= maxhandlep1)
+ {
+ this->handle_index_ = maxhandlep1;
+ return result;
+ }
+ else
+ // Load the bits of the next word.
+ this->word_val_ = this->handles_.mask_.fds_bits[this->word_num_];
+ }
+
+ // Loop until we get <word_val_> to have its least significant
+ // bit enabled, keeping track of which <handle_index> this
+ // represents (this information is used by subsequent calls to
+ // <operator()>).
+
+ for (;
+ ACE_BIT_DISABLED (this->word_val_, 1);
+ this->handle_index_++)
+ this->word_val_ = (this->word_val_ >> 1) & ACE_MSB_MASK;
+
+ return result;
+ }
#endif /* ACE_WIN32 */
}
+
+ACE_INLINE void
+ACE_Handle_Set_Iterator::operator++ (void)
+{
+ ACE_TRACE ("ACE_Handle_Set_Iterator::operator++");
+
+ // This is now a no-op.
+}
+
+ACE_INLINE
+ACE_Handle_Set_Iterator::ACE_Handle_Set_Iterator (const ACE_Handle_Set &hs)
+ : handles_ (hs),
+ handle_index_ (0),
+ word_num_ (-1)
+{
+ ACE_TRACE ("ACE_Handle_Set_Iterator::ACE_Handle_Set_Iterator");
+#if !defined(ACE_WIN32)
+ // No sense searching further than the max_handle_ + 1;
+ ACE_HANDLE maxhandlep1 = this->handles_.max_handle_ + 1;
+
+ // Loop until we've found the first non-zero bit or we run past the
+ // <maxhandlep1> of the bitset.
+ while (this->handle_index_ < maxhandlep1
+ && this->handles_.mask_.fds_bits[++this->word_num_] == 0)
+ this->handle_index_ += ACE_Handle_Set::WORDSIZE;
+
+ // If the bit index becomes >= the maxhandlep1 that means there weren't
+ // any bits set. Therefore, we'll just store the maxhandlep1, which will
+ // cause <operator()> to return <ACE_INVALID_HANDLE> immediately.
+ if (this->handle_index_ >= maxhandlep1)
+ this->handle_index_ = maxhandlep1;
+ else
+ // Loop until we get <word_val_> to have its least significant bit
+ // enabled, keeping track of which <handle_index> this represents
+ // (this information is used by <operator()>).
+ for (this->word_val_ = this->handles_.mask_.fds_bits[this->word_num_];
+ ACE_BIT_DISABLED (this->word_val_, 1)
+ && this->handle_index_ < maxhandlep1;
+ this->handle_index_++)
+ this->word_val_ = (this->word_val_ >> 1) & ACE_MSB_MASK;
+#endif /* !ACE_WIN32 */
+}
diff --git a/ace/Local_Tokens_T.h b/ace/Local_Tokens_T.h
index c8a5f21db2a..a47651eeaa8 100644
--- a/ace/Local_Tokens_T.h
+++ b/ace/Local_Tokens_T.h
@@ -1,7 +1,6 @@
/* -*- C++ -*- */
// $Id$
-
// ============================================================================
//
// = LIBRARY
@@ -21,6 +20,7 @@
//
// ============================================================================
+#if 0
#if !defined (ACE_LOCAL_TOKENS_T_H)
#define ACE_LOCAL_TOKENS_T_H
@@ -93,3 +93,4 @@ private:
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
#endif /* ACE_LOCAL_TOKENS_T_H */
+#endif /* 0 */
diff --git a/ace/Local_Tokens_T.i b/ace/Local_Tokens_T.i
index 1eb8881a464..eb356d1ae9a 100644
--- a/ace/Local_Tokens_T.i
+++ b/ace/Local_Tokens_T.i
@@ -2,6 +2,7 @@
// $Id$
// Local_Tokens_T.i
+#if 0
template <class TYPE> ACE_INLINE void
ACE_Token_Name<TYPE>::operator= (const ACE_Token_Name<TYPE> &rhs)
@@ -63,3 +64,4 @@ ACE_Token_Name<TYPE>::type (TYPE type)
this->type_ = type;
}
+#endif /* 0 */