summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1997-05-05 22:34:06 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1997-05-05 22:34:06 +0000
commit01950efe74ac03f228c428b4726f7afcca5d36f0 (patch)
treea07cc5b1199793565c432d915b0ae2c1aa216ed8
parent3da02e5f0119cb5837e49b20ddf78d2b343a4712 (diff)
downloadATCD-01950efe74ac03f228c428b4726f7afcca5d36f0.tar.gz
*** empty log message ***
-rw-r--r--ChangeLog-97a55
-rw-r--r--README2
-rw-r--r--ace/Containers.cpp (renamed from ace/Set.cpp)686
-rw-r--r--ace/Containers.h707
-rw-r--r--ace/Containers.i (renamed from ace/Stack.i)2
-rw-r--r--ace/Local_Name_Space.cpp4
-rw-r--r--ace/Local_Name_Space.h2
-rw-r--r--ace/Local_Tokens.cpp2
-rw-r--r--ace/Local_Tokens.h2
-rw-r--r--ace/Log_Msg.cpp6
-rw-r--r--ace/Name_Space.h2
-rw-r--r--ace/Naming_Context.h2
-rw-r--r--ace/OS.cpp2
-rw-r--r--ace/OS.h6
-rw-r--r--ace/OS.i12
-rw-r--r--ace/Proactor.cpp2
-rw-r--r--ace/Remote_Name_Space.h2
-rw-r--r--ace/Service_Config.cpp4
-rw-r--r--ace/Service_Config.h2
-rw-r--r--ace/Set.h394
-rw-r--r--ace/Set.i5
-rw-r--r--ace/Signal.h2
-rw-r--r--ace/Stack.cpp446
-rw-r--r--ace/Stack.h291
-rw-r--r--ace/Timer_Heap_T.h2
-rw-r--r--ace/Timer_Queue.cpp2
-rw-r--r--apps/Gateway/Gateway/Consumer_Dispatch_Set.h2
-rw-r--r--apps/Gateway/Gateway/Gateway.cpp2
-rw-r--r--examples/ASX/Event_Server/Transceiver/transceiver.cpp40
-rw-r--r--examples/Misc/test_set.cpp50
-rw-r--r--netsvcs/lib/Name_Handler.cpp2
-rw-r--r--netsvcs/lib/TS_Clerk_Handler.cpp2
-rw-r--r--netsvcs/lib/TS_Server_Handler.cpp2
33 files changed, 1372 insertions, 1372 deletions
diff --git a/ChangeLog-97a b/ChangeLog-97a
index c3dcdf4560a..a223eaf6015 100644
--- a/ChangeLog-97a
+++ b/ChangeLog-97a
@@ -1,11 +1,49 @@
-Mon May 05 14:53:11 1997 David L. Levine <levine@cs.wustl.edu>
+Mon May 5 08:19:54 1997 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu>
- * netsvcs/lib/Server_Logging_Handler.cpp: fixed ACE_Svc_Handler
- specializations, yet again, for Linux w/LXPthreads. Thanks to
- Luis Lopes <llopes@tick.rcc.Ryerson.CA> for reporting this
- problem with sufficient detail for us to track it down.
+ * ace/Containers.cpp (set): Optimized for the common case where
+ we're increasing the size of the set by 1.
-Mon May 5 08:19:54 1997 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu>
+ * ace/Containers: Merged the ACE_Set_Node, ACE_Stack_Node, and
+ ACE_Set_Node into a single "ACE_Node" class. This tidies up the
+ code quite a bit.
+
+ * ace: Removed the Set.* and Stack.* files and replaced them with
+ the Containers.* files. This file contains the ACE_*Stack,
+ ACE_*Queue, and ACE_*Set classes. If this revised file scheme
+ breaks existing code please let me know and I'll provide
+ backwards compatibility.
+
+ * ace/Stack: Changed the name of ACE_Unbounded_Queue::enqueue() to
+ ACE_Unbounded_Queue::enqueue_tail() and also added
+ ACE_Unbounded_Queue::enqueue_head().
+
+ * ace/OS: Changed the names of the parameters of the ACE_OS::mem*
+ methods from ACE_OS::mem* (void *s, const void *t) to
+ ACE_OS::mem* (void *t, const void *s) since "t" should stand for
+ "target" and "s" for "source." Thanks to Andres Kruse
+ <Andres.Kruse@cern.ch> for pointing this out.
+
+ * ace/Stack: Removed the peek() method from ACE_Unbounded_Queue.
+ This functionality is now subsumed by the get(..., 0) method.
+ If this breaks any existing code please let me know.
+
+ * ace/Stack.h: Moved all the functionality from ACE_Unbounded_Set
+ into ACE_Unbounded_Queue. That's really where this belonged in
+ the first place. Thanks to David Levine for noticing this.
+
+ * ace/Set.h: Moved ACE_Set_Node from the *.cpp file into the *.cpp
+ file in anticipation of AIX C++ compiler bugs ;-).
+
+ * examples/ASX/Event_Server/Transceiver/transceiver.cpp:
+ Rearranged the location where we register to receive standard
+ input so that the socket handle will not be initialized at this
+ point. Thanks to craig perras <craigp@wolfenet.com> for
+ reporting this.
+
+ * examples/ASX/Event_Server/Transceiver/transceiver.cpp
+ (Event_Transceiver): Make sure to #ifdef around SIGQUIT for
+ WIN32 since it lacks this signal. Thanks to craig perras
+ <craigp@wolfenet.com> for reporting this.
* ace/config-osf1-4.0-g++.h: Removed the ACE_LACKS_SIGNED_CHAR
since this seems to be compiler specific. Thanks to Thilo for
@@ -59,6 +97,11 @@ Mon May 5 17:16:41 1997 Carlos O'Ryan <coryan@mat.puc.cl>
Mon May 05 11:50:39 1997 David L. Levine <levine@cs.wustl.edu>
+ * netsvcs/lib/Server_Logging_Handler.cpp: fixed ACE_Svc_Handler
+ specializations, yet again, for Linux w/LXPthreads. Thanks to
+ Luis Lopes <llopes@tick.rcc.Ryerson.CA> for reporting this
+ problem with sufficient detail for us to track it down.
+
* ace/Stack.* (ACE_Unbounded_Queue):
1) made peek () const.
2) added another peek (u_int index = 0) function that can peek
diff --git a/README b/README
index 1f29905869f..1f87531a63b 100644
--- a/README
+++ b/README
@@ -375,7 +375,7 @@ Audun Tornquist <Audun.Tornquist@iu.hioslo.no>
Sandeep Joshi <sandeepj@emailbox.att.com>
Kirk Sinnard <1764@mn.lawson.lawson.com>
Bernd Hofner <hofner@pd.et-inf.uni-siegen.de>
-Craig Perras <CraigP@saros.com>
+Craig Perras <craigp@wolfenet.com>
Kirk Sinnard <kirk.sinnard@lawson.com>
Matthew Newhook <matthew@neweast.ca>
Gerolf Wendland <wendland@hpp015.mch2.scn.de>
diff --git a/ace/Set.cpp b/ace/Containers.cpp
index d09ca2115b3..5a927228a88 100644
--- a/ace/Set.cpp
+++ b/ace/Containers.cpp
@@ -1,16 +1,525 @@
-// Set.cpp
+// Containers.cpp
// $Id$
-#if !defined (ACE_SET_C)
-#define ACE_SET_C
+#if !defined (ACE_CONTAINERS_C)
+#define ACE_CONTAINERS_C
#define ACE_BUILD_DLL
-#include "ace/Set.h"
+#include "ace/Containers.h"
#if !defined (__ACE_INLINE__)
-#include "ace/Set.i"
+#include "ace/Containers.i"
#endif /* __ACE_INLINE__ */
+ACE_ALLOC_HOOK_DEFINE(ACE_Bounded_Stack)
+
+template <class T> void
+ACE_Bounded_Stack<T>::dump (void) const
+{
+ ACE_TRACE ("ACE_Bounded_Stack<T>::dump");
+}
+
+template<class T>
+ACE_Bounded_Stack<T>::ACE_Bounded_Stack (size_t size)
+ : top_ (0),
+ size_ (size)
+{
+ ACE_NEW (this->stack_, T[size]);
+
+ ACE_TRACE ("ACE_Bounded_Stack<T>::ACE_Bounded_Stack");
+}
+
+template<class T>
+ACE_Bounded_Stack<T>::ACE_Bounded_Stack (const ACE_Bounded_Stack<T> &s)
+ : top_ (s.top_),
+ size_ (s.size_)
+{
+ ACE_NEW (this->stack_, T[s.size_]);
+
+ ACE_TRACE ("ACE_Bounded_Stack<T>::ACE_Bounded_Stack");
+
+ for (size_t i = 0; i < this->top_; i++)
+ this->stack_[i] = s.stack_[i];
+}
+
+template<class T> void
+ACE_Bounded_Stack<T>::operator= (const ACE_Bounded_Stack<T> &s)
+{
+ ACE_TRACE ("ACE_Bounded_Stack<T>::operator=");
+ if (&s == this)
+ return;
+ else if (this->size_ < s.size_)
+ {
+ delete [] this->stack_;
+ ACE_NEW (this->stack_, T[s.size_]);
+ }
+ this->top_ = s.top_;
+
+ for (size_t i = 0; i < this->top_; i++)
+ this->stack_[i] = s.stack_[i];
+}
+
+template<class T>
+ACE_Bounded_Stack<T>::~ACE_Bounded_Stack (void)
+{
+ ACE_TRACE ("ACE_Bounded_Stack<T>::~ACE_Bounded_Stack");
+ delete [] this->stack_;
+}
+
+// ----------------------------------------
+
+ACE_ALLOC_HOOK_DEFINE(ACE_Fixed_Stack)
+
+template <class T, size_t SIZE> void
+ACE_Fixed_Stack<T, SIZE>::dump (void) const
+{
+ ACE_TRACE ("ACE_Fixed_Stack<T, SIZE>::dump");
+}
+
+template<class T, size_t SIZE>
+ACE_Fixed_Stack<T, SIZE>::ACE_Fixed_Stack (void)
+ : top_ (0),
+ size_ (SIZE)
+{
+ ACE_TRACE ("ACE_Fixed_Stack<T, SIZE>::ACE_Fixed_Stack");
+}
+
+template<class T, size_t SIZE>
+ACE_Fixed_Stack<T, SIZE>::ACE_Fixed_Stack (const ACE_Fixed_Stack<T, SIZE> &s)
+ : top_ (s.top_),
+ size_ (s.size_)
+{
+ ACE_TRACE ("ACE_Fixed_Stack<T, SIZE>::ACE_Fixed_Stack");
+ for (size_t i = 0; i < this->top_; i++)
+ this->stack_[i] = s.stack_[i];
+}
+
+template<class T, size_t SIZE> void
+ACE_Fixed_Stack<T, SIZE>::operator= (const ACE_Fixed_Stack<T, SIZE> &s)
+{
+ ACE_TRACE ("ACE_Fixed_Stack<T, SIZE>::operator=");
+ if (&s == this)
+ return;
+ this->top_ = s.top_;
+
+ for (size_t i = 0; i < this->top_; i++)
+ this->stack_[i] = s.stack_[i];
+}
+
+template<class T, size_t SIZE>
+ACE_Fixed_Stack<T, SIZE>::~ACE_Fixed_Stack (void)
+{
+ ACE_TRACE ("ACE_Fixed_Stack<T, SIZE>::~ACE_Fixed_Stack");
+ delete [] this->stack_;
+}
+
+//----------------------------------------
+
+ACE_ALLOC_HOOK_DEFINE(ACE_Unbounded_Stack)
+
+template <class T> void
+ACE_Unbounded_Stack<T>::dump (void) const
+{
+ ACE_TRACE ("ACE_Unbounded_Stack<T>::dump");
+}
+
+template<class T>
+ACE_Unbounded_Stack<T>::ACE_Unbounded_Stack (void)
+ : head_ (0)
+{
+ ACE_NEW (this->last_resort_, ACE_Node<T>);
+ ACE_TRACE ("ACE_Unbounded_Stack<T>::ACE_Unbounded_Stack");
+}
+
+template<class T> void
+ACE_Unbounded_Stack<T>::delete_all_nodes (void)
+{
+ ACE_TRACE ("ACE_Unbounded_Stack<T>::delete_all_nodes");
+ while (this->head_ != 0)
+ {
+ ACE_Node<T> *temp = this->head_;
+ this->head_ = this->head_->next_;
+ delete temp;
+ }
+
+ delete this->last_resort_;
+ this->last_resort_ = 0;
+}
+
+template<class T> void
+ACE_Unbounded_Stack<T>::copy_all_nodes (const ACE_Unbounded_Stack<T> &s)
+{
+ ACE_TRACE ("ACE_Unbounded_Stack<T>::copy_all_nodes");
+ // Push all of <s>'s nodes onto our stack (this puts them in the
+ // reverse order).
+ ACE_Node<T> *temp;
+
+ for (temp = s.head_;
+ temp != 0;
+ temp = temp->next_)
+ {
+ if (!this->is_full ())
+ this->push (temp->item_);
+ else
+ break;
+ }
+
+ // Reverse the order of our stack.
+
+ ACE_Node<T> *prev = 0;
+
+ for (temp = this->head_; temp != 0; )
+ {
+ ACE_Node<T> *next = temp->next_;
+
+ temp->next_ = prev;
+ prev = temp;
+ temp = next;
+ }
+
+ this->head_ = prev;
+}
+
+template<class T>
+ACE_Unbounded_Stack<T>::ACE_Unbounded_Stack (const ACE_Unbounded_Stack<T> &s)
+ : head_ (0)
+{
+ ACE_NEW (this->last_resort_, ACE_Node<T>);
+
+ ACE_TRACE ("ACE_Unbounded_Stack<T>::ACE_Unbounded_Stack");
+ this->copy_all_nodes (s);
+}
+
+template<class T> void
+ACE_Unbounded_Stack<T>::operator= (const ACE_Unbounded_Stack<T> &s)
+{
+ ACE_TRACE ("ACE_Unbounded_Stack<T>::operator=");
+ if (this == &s)
+ return;
+
+ this->delete_all_nodes ();
+ this->copy_all_nodes (s);
+}
+
+template<class T>
+ACE_Unbounded_Stack<T>::~ACE_Unbounded_Stack (void)
+{
+ ACE_TRACE ("ACE_Unbounded_Stack<T>::~ACE_Unbounded_Stack");
+ this->delete_all_nodes ();
+}
+
+template<class T> void
+ACE_Unbounded_Stack<T>::push (const T &new_item)
+{
+ ACE_TRACE ("ACE_Unbounded_Stack<T>::push");
+
+ ACE_Node<T> *temp = new ACE_Node<T> (new_item, this->head_);
+
+ if (temp == 0)
+ {
+ temp = this->last_resort_;
+ this->last_resort_ = 0;
+ }
+
+ this->head_ = temp;
+}
+
+template<class T> void
+ACE_Unbounded_Stack<T>::pop (T &item)
+{
+ ACE_TRACE ("ACE_Unbounded_Stack<T>::pop");
+ item = this->head_->item_;
+ ACE_Node<T> *temp = this->head_;
+ this->head_ = this->head_->next_;
+
+ // Restore the node of last resort if necessary.
+ if (this->last_resort_ == 0)
+ this->last_resort_ = temp;
+ else
+ delete temp;
+}
+
+template <class T>
+ACE_Unbounded_Queue<T>::ACE_Unbounded_Queue (void)
+ : head_ (0),
+ cur_size_ (0)
+{
+ ACE_TRACE ("ACE_Unbounded_Queue<T>::ACE_Unbounded_Queue (void)");
+
+ ACE_NEW (this->head_, ACE_Node<T>);
+
+ // Make the list circular by pointing it back to itself.
+ this->head_->next_ = this->head_;
+}
+
+template <class T>
+ACE_Unbounded_Queue<T>::ACE_Unbounded_Queue (const ACE_Unbounded_Queue<T> &us)
+ : head_ (0),
+ cur_size_ (0)
+{
+ ACE_TRACE ("ACE_Unbounded_Queue<T>::ACE_Unbounded_Queue");
+
+ ACE_NEW (this->head_, ACE_Node<T>);
+ this->head_->next_ = this->head_;
+ this->copy_nodes (us);
+}
+
+template <class T> void
+ACE_Unbounded_Queue<T>::operator = (const ACE_Unbounded_Queue<T> &us)
+{
+ ACE_TRACE ("ACE_Unbounded_Queue<T>::operator =");
+
+ if (this == &us)
+ return;
+
+ this->delete_nodes ();
+ this->copy_nodes (us);
+}
+
+ACE_ALLOC_HOOK_DEFINE(ACE_Unbounded_Queue)
+
+template <class T> void
+ACE_Unbounded_Queue<T>::dump (void) const
+{
+ ACE_TRACE ("ACE_Unbounded_Queue<T>::dump");
+
+ ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
+ ACE_DEBUG ((LM_DEBUG, "\nhead_ = %u", this->head_));
+ ACE_DEBUG ((LM_DEBUG, "\nhead_->next_ = %u", this->head_->next_));
+ ACE_DEBUG ((LM_DEBUG, "\ncur_size_ = %d\n", this->cur_size_));
+
+ T *item = 0;
+ size_t count = 1;
+
+ for (ACE_Unbounded_Queue_Iterator<T> iter (*(ACE_Unbounded_Queue<T> *) this);
+ iter.next (item) != 0;
+ iter.advance ())
+ ACE_DEBUG ((LM_DEBUG, "count = %d\n", count++));
+
+ ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
+}
+
+template <class T> void
+ACE_Unbounded_Queue<T>::copy_nodes (const ACE_Unbounded_Queue<T> &us)
+{
+ for (ACE_Node<T> *curr = us.head_->next_;
+ curr != us.head_;
+ curr = curr->next_)
+ if (this->enqueue_tail (curr->item_) == -1)
+ // @@ What's the right thing to do here?
+ this->delete_nodes ();
+}
+
+template <class T> void
+ACE_Unbounded_Queue<T>::delete_nodes (void)
+{
+ ACE_Node<T> *curr = this->head_->next_;
+
+ // Keep looking until we've hit the dummy node.
+
+ while (curr != this->head_)
+ {
+ ACE_Node<T> *temp = curr;
+ curr = curr->next_;
+ delete temp;
+ this->cur_size_--;
+ }
+
+ // Reset the list to be a circular list with just a dummy node.
+ this->head_->next_ = this->head_;
+}
+
+template <class T>
+ACE_Unbounded_Queue<T>::~ACE_Unbounded_Queue (void)
+{
+ ACE_TRACE ("ACE_Unbounded_Queue<T>::~ACE_Unbounded_Queue (void)");
+
+ this->delete_nodes ();
+ delete this->head_;
+ this->head_ = 0;
+}
+
+template <class T> int
+ACE_Unbounded_Queue<T>::enqueue_head (const T &new_item)
+{
+ ACE_TRACE ("ACE_Unbounded_Queue<T>::enqueue_tail");
+
+ ACE_Node<T> *temp;
+
+ // Create a new node that points to the original head.
+ ACE_NEW_RETURN (temp, ACE_Node<T> (new_item, this->head_->next_->next_), -1);
+
+ // Link this pointer into the front of the list.
+ this->head_->next_ = temp;
+
+ this->cur_size_++;
+ return 0;
+}
+
+template <class T> int
+ACE_Unbounded_Queue<T>::enqueue_tail (const T &new_item)
+{
+ ACE_TRACE ("ACE_Unbounded_Queue<T>::enqueue_head");
+
+ ACE_Node<T> *temp;
+
+ // Insert <item> into the old dummy node location.
+ this->head_->item_ = new_item;
+
+ // Create a new dummy node.
+ ACE_NEW_RETURN (temp, ACE_Node<T> (this->head_->next_), -1);
+
+ // Link this dummy pointer into the list.
+ this->head_->next_ = temp;
+
+ // Point the head to the new dummy node.
+ this->head_ = temp;
+
+ this->cur_size_++;
+ return 0;
+}
+
+template <class T> int
+ACE_Unbounded_Queue<T>::dequeue_head (T &item)
+{
+ ACE_TRACE ("ACE_Unbounded_Queue<T>::dequeue_head");
+
+ // Check for empty queue.
+ if (this->head_ == this->head_->next_)
+ return -1;
+
+ ACE_Node<T> *temp = this->head_->next_;
+
+ item = temp->item_;
+ this->head_->next = temp_->next_;
+ delete temp;
+ --this->cur_size_;
+ return 0;
+}
+
+template <class T> void
+ACE_Unbounded_Queue<T>::reset (void)
+{
+ ACE_TRACE ("reset");
+
+ this->delete_nodes ();
+}
+
+template <class T> int
+ACE_Unbounded_Queue<T>::get (T *&item, size_t index) const
+{
+ ACE_TRACE ("ACE_Unbounded_Queue<T>::get");
+
+ ACE_Node<T> *curr = this->head_->next_;
+
+ size_t i;
+
+ for (i = 0; i < this->cur_size_; i++)
+ {
+ if (i == index)
+ break;
+
+ curr = curr->next_;
+ }
+
+ if (i < this->cur_size_)
+ {
+ item = &curr->item_;
+ return 1;
+ }
+ else
+ return 0;
+}
+
+template <class T> int
+ACE_Unbounded_Queue<T>::set (const T &item,
+ size_t index)
+{
+ ACE_TRACE ("ACE_Unbounded_Queue<T>::set");
+
+ ACE_Node<T> *curr = this->head_->next_;
+
+ int result = 1;
+ size_t i;
+
+ for (i = 0; i <= index; i++)
+ {
+ if (i == this->cur_size_)
+ {
+ // We need to expand the list.
+
+ result = 0;
+
+ // A common case will be increasing the set size by 1.
+ // Therefore, we'll optimize for this case.
+ if (i + i == index)
+ // Try to expand the size of the set by 1.
+ return this->enqueue_tail (item);
+ else
+ {
+ T dummy;
+
+ // This head points to the existing dummy node, which is
+ // about to be overwritten when we add the new dummy node.
+ curr = this->head_;
+
+ // Try to expand the size of the set by 1, but don't
+ // store anything in the dummy node (yet).
+ if (this->enqueue_tail (dummy) == -1)
+ return -1;
+ }
+ }
+ else
+ curr = curr->next_;
+ }
+
+ curr->item_ = item;
+ return result;
+}
+
+template <class T> void
+ACE_Unbounded_Queue_Iterator<T>::dump (void) const
+{
+// ACE_TRACE ("ACE_Unbounded_Queue_Iterator<T>::dump");
+}
+
+template <class T>
+ACE_Unbounded_Queue_Iterator<T>::ACE_Unbounded_Queue_Iterator (ACE_Unbounded_Queue<T> &q)
+ : current_ (q.head_->next_),
+ queue_ (q)
+{
+// ACE_TRACE ("ACE_Unbounded_Queue_Iterator<T>::ACE_Unbounded_Queue_Iterator");
+}
+
+template <class T> int
+ACE_Unbounded_Queue_Iterator<T>::advance (void)
+{
+// ACE_TRACE ("ACE_Unbounded_Queue_Iterator<T>::advance");
+ this->current_ = this->current_->next_;
+ return this->current_ != this->queue_.head_;
+}
+
+template <class T> int
+ACE_Unbounded_Queue_Iterator<T>::done (void) const
+{
+ ACE_TRACE ("ACE_Unbounded_Queue_Iterator<T>::done");
+
+ return this->current_ == this->queue_.head_;
+}
+
+template <class T> int
+ACE_Unbounded_Queue_Iterator<T>::next (T *&item)
+{
+// ACE_TRACE ("ACE_Unbounded_Queue_Iterator<T>::next");
+ if (this->current_ == this->queue_.head_)
+ return 0;
+ else
+ {
+ item = &this->current_->item_;
+ return 1;
+ }
+}
+
ACE_ALLOC_HOOK_DEFINE(ACE_Fixed_Set)
template <class T, size_t SIZE> size_t
@@ -424,52 +933,55 @@ ACE_Bounded_Set_Iterator<T>::next (T *&item)
return 0;
}
-ACE_ALLOC_HOOK_DEFINE(ACE_Set_Node)
-
-template <class T>
-class ACE_Set_Node
-{
-friend class ACE_Unbounded_Set<T>;
-friend class ACE_Unbounded_Set_Iterator<T>;
-public:
- // = Initialization methods
- ACE_Set_Node (const T &i, ACE_Set_Node<T> *n);
- ACE_Set_Node (ACE_Set_Node<T> *n = 0, int MS_SUCKS = 0);
- ACE_Set_Node (const ACE_Set_Node<T> &n);
-
-private:
- ACE_Set_Node<T> *next_;
- // Pointer to next element in the list of ACE_Set_Nodes.
-
- T item_;
- // Current value of the item in this node.
-};
+ACE_ALLOC_HOOK_DEFINE(ACE_Node)
template <class T>
-ACE_Set_Node<T>::ACE_Set_Node (const T &i, ACE_Set_Node<T> *n)
+ACE_Node<T>::ACE_Node (const T &i, ACE_Node<T> *n)
: next_ (n),
item_ (i)
{
-// ACE_TRACE ("ACE_Set_Node<T>::ACE_Set_Node");
+// ACE_TRACE ("ACE_Node<T>::ACE_Node");
}
template <class T>
-ACE_Set_Node<T>::ACE_Set_Node (ACE_Set_Node<T> *n, int /* MS_SUCKS */)
+ACE_Node<T>::ACE_Node (ACE_Node<T> *n, int /* MS_SUCKS */)
: next_ (n)
{
-// ACE_TRACE ("ACE_Set_Node<T>::ACE_Set_Node");
+// ACE_TRACE ("ACE_Node<T>::ACE_Node");
}
template <class T>
-ACE_Set_Node<T>::ACE_Set_Node (const ACE_Set_Node<T> &s)
+ACE_Node<T>::ACE_Node (const ACE_Node<T> &s)
: next_ (s.next_),
item_ (s.item_)
{
-// ACE_TRACE ("ACE_Set_Node<T>::ACE_Set_Node");
+// ACE_TRACE ("ACE_Node<T>::ACE_Node");
}
ACE_ALLOC_HOOK_DEFINE(ACE_Unbounded_Set)
+template <class T> int
+ACE_Unbounded_Set<T>::insert_tail (const T &item)
+{
+// ACE_TRACE ("ACE_Unbounded_Queue<T>::insert_tail");
+ ACE_Node<T> *temp;
+
+ // Insert <item> into the old dummy node location.
+ this->head_->item_ = item;
+
+ // Create a new dummy node.
+ ACE_NEW_RETURN (temp, ACE_Node<T> (this->head_->next_), -1);
+
+ // Link this pointer into the list.
+ this->head_->next_ = temp;
+
+ // Point the head to the new dummy node.
+ this->head_ = temp;
+
+ this->cur_size_++;
+ return 0;
+}
+
template <class T> void
ACE_Unbounded_Set<T>::dump (void) const
{
@@ -494,7 +1006,7 @@ ACE_Unbounded_Set<T>::dump (void) const
template <class T> void
ACE_Unbounded_Set<T>::copy_nodes (const ACE_Unbounded_Set<T> &us)
{
- for (ACE_Set_Node<T> *curr = us.head_->next_;
+ for (ACE_Node<T> *curr = us.head_->next_;
curr != us.head_;
curr = curr->next_)
this->insert_tail (curr->item_);
@@ -503,13 +1015,13 @@ ACE_Unbounded_Set<T>::copy_nodes (const ACE_Unbounded_Set<T> &us)
template <class T> void
ACE_Unbounded_Set<T>::delete_nodes (void)
{
- ACE_Set_Node<T> *curr = this->head_->next_;
+ ACE_Node<T> *curr = this->head_->next_;
// Keep looking until we've hit the dummy node.
while (curr != this->head_)
{
- ACE_Set_Node<T> *temp = curr;
+ ACE_Node<T> *temp = curr;
curr = curr->next_;
delete temp;
this->cur_size_--;
@@ -538,7 +1050,7 @@ ACE_Unbounded_Set<T>::find (const T &item) const
// Set <item> into the dummy node.
this->head_->item_ = item;
- ACE_Set_Node<T> *temp = this->head_->next_;
+ ACE_Node<T> *temp = this->head_->next_;
// Keep looping until we find the item.
while (!(temp->item_ == item))
@@ -549,68 +1061,6 @@ ACE_Unbounded_Set<T>::find (const T &item) const
return temp == this->head_ ? 0 : 1;
}
-template <class T> int
-ACE_Unbounded_Set<T>::get (T &item, size_t index) const
-{
- ACE_TRACE ("ACE_Unbounded_Set<T>::get");
-
- ACE_Set_Node<T> *curr = this->head_->next_;
-
- size_t i;
-
- for (i = 0; i < this->cur_size_; i++)
- {
- if (i == index)
- break;
-
- curr = curr->next_;
- }
-
- if (i < this->cur_size_)
- {
- item = curr->item_;
- return 1;
- }
- else
- return 0;
-}
-
-template <class T> int
-ACE_Unbounded_Set<T>::set (const T &item, size_t index)
-{
- ACE_TRACE ("ACE_Unbounded_Set<T>::get");
-
- ACE_Set_Node<T> *curr = this->head_->next_;
-
- int result = 1;
- size_t i;
-
- for (i = 0; i <= index; i++)
- {
- if (i == this->cur_size_)
- {
- // We need to expand the list.
-
- result = 0;
-
- T dummy;
-
- // This head points to the existing dummy node, which is
- // about to be overwritten when we add the new dummy node.
- curr = this->head_;
-
- // Try to expand the size of the set by 1.
- if (this->insert_tail (dummy) == -1)
- return -1;
- }
- else
- curr = curr->next_;
- }
-
- curr->item_ = item;
- return result;
-}
-
template <class T>
ACE_Unbounded_Set<T>::ACE_Unbounded_Set (void)
: head_ (0),
@@ -618,7 +1068,7 @@ ACE_Unbounded_Set<T>::ACE_Unbounded_Set (void)
{
// ACE_TRACE ("ACE_Unbounded_Set<T>::ACE_Unbounded_Set");
- ACE_NEW (this->head_, ACE_Set_Node<T>);
+ ACE_NEW (this->head_, ACE_Node<T>);
// Make the list circular by pointing it back to itself.
this->head_->next_ = this->head_;
@@ -631,7 +1081,7 @@ ACE_Unbounded_Set<T>::ACE_Unbounded_Set (const ACE_Unbounded_Set<T> &us)
{
ACE_TRACE ("ACE_Unbounded_Set<T>::ACE_Unbounded_Set");
- ACE_NEW (this->head_, ACE_Set_Node<T>);
+ ACE_NEW (this->head_, ACE_Node<T>);
this->head_->next_ = this->head_;
this->copy_nodes (us);
}
@@ -648,38 +1098,6 @@ ACE_Unbounded_Set<T>::operator = (const ACE_Unbounded_Set<T> &us)
this->copy_nodes (us);
}
-template <class T> void
-ACE_Unbounded_Set<T>::reset (void)
-{
- ACE_TRACE ("reset");
-
- this->delete_nodes ();
-}
-
-// Insert the new node at the tail of the list.
-
-template <class T> int
-ACE_Unbounded_Set<T>::insert_tail (const T &item)
-{
-// ACE_TRACE ("ACE_Unbounded_Set<T>::insert");
- ACE_Set_Node<T> *temp;
-
- // Insert <item> into the old dummy node location.
- this->head_->item_ = item;
-
- // Create a new dummy node.
- ACE_NEW_RETURN (temp, ACE_Set_Node<T> (this->head_->next_), -1);
-
- // Link this pointer into the list.
- this->head_->next_ = temp;
-
- // Point the head to the new dummy node.
- this->head_ = temp;
-
- this->cur_size_++;
- return 0;
-}
-
template <class T> int
ACE_Unbounded_Set<T>::insert (const T &item)
{
@@ -698,7 +1116,7 @@ ACE_Unbounded_Set<T>::remove (const T &item)
// Insert the item to be founded into the dummy node.
this->head_->item_ = item;
- ACE_Set_Node<T> *curr = this->head_;
+ ACE_Node<T> *curr = this->head_;
while (!(curr->next_->item_ == item))
curr = curr->next_;
@@ -707,7 +1125,7 @@ ACE_Unbounded_Set<T>::remove (const T &item)
return 0; // Item was not found.
else
{
- ACE_Set_Node<T> *temp = curr->next_;
+ ACE_Node<T> *temp = curr->next_;
// Skip over the node that we're deleting.
curr->next_ = temp->next_;
this->cur_size_--;
@@ -761,4 +1179,4 @@ ACE_Unbounded_Set_Iterator<T>::next (T *&item)
}
}
-#endif /* ACE_SET_C */
+#endif /* ACE_CONTAINERS_C */
diff --git a/ace/Containers.h b/ace/Containers.h
new file mode 100644
index 00000000000..a763a016abf
--- /dev/null
+++ b/ace/Containers.h
@@ -0,0 +1,707 @@
+/* -*- C++ -*- */
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// ace
+//
+// = FILENAME
+// Containers.h
+//
+// = AUTHOR
+// Doug Schmidt
+//
+// ============================================================================
+
+#if !defined (ACE_CONTAINERS_H)
+#define ACE_CONTAINERS_H
+
+#include "ace/ACE.h"
+
+template <class T>
+class ACE_Bounded_Stack
+ // = TITLE
+ // Implement a generic LIFO abstract data type.
+ //
+ // = DESCRIPTION
+ // This implementation of a Stack uses a bounded array
+ // that is allocated dynamically.
+{
+public:
+ // = Initialization, assignemnt, and termination methods.
+ ACE_Bounded_Stack (size_t size);
+ // Initialize a new stack so that it is empty.
+
+ ACE_Bounded_Stack (const ACE_Bounded_Stack<T> &s);
+ // The copy constructor (performs initialization).
+
+ void operator= (const ACE_Bounded_Stack<T> &s);
+ // Assignment operator (performs assignment).
+
+ ~ACE_Bounded_Stack (void);
+ // Perform actions needed when stack goes out of scope.
+
+ // = Classic Stack operations.
+
+ void push (const T &new_item);
+ // Place a new item on top of the stack. Does not check if the
+ // stack is full.
+
+ void pop (T &item);
+ // Remove and return the top stack item. Does not check if stack
+ // is full.
+
+ void top (T &item) const;
+ // Return top stack item without removing it. Does not check if
+ // stack is empty.
+
+ // = Check boundary conditions for Stack operations.
+
+ int is_empty (void) const;
+ // Returns 1 if the stack is empty, otherwise returns 0.
+
+ int is_full (void) const;
+ // Returns 1 if the stack is full, otherwise returns 0.
+
+ void dump (void) const;
+ // Dump the state of an object.
+
+ ACE_ALLOC_HOOK_DECLARE;
+ // Declare the dynamic allocation hooks.
+
+private:
+ size_t size_;
+ // Size of the dynamically allocated data.
+
+ size_t top_;
+ // Keeps track of the current top of stack.
+
+ T *stack_;
+ // Holds the stack's contents.
+};
+
+//----------------------------------------
+
+template <class T, size_t SIZE>
+class ACE_Fixed_Stack
+ // = TITLE
+ // Implement a generic LIFO abstract data type.
+ //
+ // = DESCRIPTION
+ // This implementation of a Stack uses a fixed array
+ // with the size fixed at instantiation time.
+{
+public:
+ // = Initialization, assignemnt, and termination methods.
+ ACE_Fixed_Stack (void);
+ // Initialize a new stack so that it is empty.
+
+ ACE_Fixed_Stack (const ACE_Fixed_Stack<T, SIZE> &s);
+ // The copy constructor (performs initialization).
+
+ void operator= (const ACE_Fixed_Stack<T, SIZE> &s);
+ // Assignment operator (performs assignment).
+
+ ~ACE_Fixed_Stack (void);
+ // Perform actions needed when stack goes out of scope.
+
+ // = Classic Stack operations.
+
+ void push (const T &new_item);
+ // Place a new item on top of the stack. Does not check if the
+ // stack is full.
+
+ void pop (T &item);
+ // Remove and return the top stack item. Does not check if stack
+ // is full.
+
+ void top (T &item) const;
+ // Return top stack item without removing it. Does not check if
+ // stack is empty.
+
+ // = Check boundary conditions for Stack operations.
+
+ int is_empty (void) const;
+ // Returns 1 if the stack is empty, otherwise returns 0.
+
+ int is_full (void) const;
+ // Returns 1 if the stack is full, otherwise returns 0.
+
+ void dump (void) const;
+ // Dump the state of an object.
+
+ ACE_ALLOC_HOOK_DECLARE;
+ // Declare the dynamic allocation hooks.
+
+private:
+ size_t size_;
+ // Size of the dynamically allocated data.
+
+ size_t top_;
+ // Keeps track of the current top of stack.
+
+ T stack_[SIZE];
+ // Holds the stack's contents.
+};
+
+//----------------------------------------
+
+// Forward declarations.
+template <class T> class ACE_Unbounded_Set;
+template <class T> class ACE_Unbounded_Set_Iterator;
+template <class T> class ACE_Unbounded_Queue;
+template <class T> class ACE_Unbounded_Queue_Iterator;
+template <class T> class ACE_Unbounded_Stack;
+template <class T> class ACE_Unbounded_Stack_Iterator;
+
+template<class T>
+class ACE_Node
+ // = TITLE
+ // Implementation element in a Queue
+{
+ friend class ACE_Unbounded_Queue<T>;
+ friend class ACE_Unbounded_Queue_Iterator<T>;
+ friend class ACE_Unbounded_Set<T>;
+ friend class ACE_Unbounded_Set_Iterator<T>;
+ friend class ACE_Unbounded_Stack<T>;
+ friend class ACE_Unbounded_Stack_Iterator<T>;
+private:
+ // = Initialization methods
+ ACE_Node (const T &i, ACE_Node<T> *n);
+ ACE_Node (ACE_Node<T> *n = 0, int MS_SUCKS = 0);
+ ACE_Node (const ACE_Node<T> &n);
+
+ ACE_Node<T> *next_;
+ // Pointer to next element in the list of <ACE_Node>s.
+
+ T item_;
+ // Current value of the item in this node.
+};
+
+template <class T>
+class ACE_Unbounded_Stack
+ // = TITLE
+ // Implement a generic LIFO abstract data type.
+ //
+ // = DESCRIPTION
+ // This implementation of an unbounded Stack uses a linked list.
+{
+public:
+ // = Initialization, assignemnt, and termination methods.
+ ACE_Unbounded_Stack (void);
+ // Initialize a new stack so that it is empty.
+
+ ACE_Unbounded_Stack (const ACE_Unbounded_Stack<T> &s);
+ // The copy constructor (performs initialization).
+
+ void operator= (const ACE_Unbounded_Stack<T> &s);
+ // Assignment operator (performs assignment).
+
+ ~ACE_Unbounded_Stack (void);
+ // Perform actions needed when stack goes out of scope.
+
+ // = Classic Stack operations.
+
+ void push (const T &new_item);
+ // Place a new item on top of the stack. Does not check if the
+ // stack is full.
+
+ void pop (T &item);
+ // Remove and return the top stack item. Does not check if stack
+ // is full.
+
+ void top (T &item) const;
+ // Return top stack item without removing it. Does not check if
+ // stack is empty.
+
+ // = Check boundary conditions for Stack operations.
+
+ int is_empty (void) const;
+ // Returns 1 if the stack is empty, otherwise returns 0.
+
+ int is_full (void) const;
+ // Returns 1 if the stack is full, otherwise returns 0.
+
+ void dump (void) const;
+ // Dump the state of an object.
+
+ ACE_ALLOC_HOOK_DECLARE;
+ // Declare the dynamic allocation hooks.
+
+private:
+ void delete_all_nodes (void);
+ // Delete all the nodes in the stack.
+
+ void copy_all_nodes (const ACE_Unbounded_Stack<T> &s);
+ // Copy all nodes from <s> to <this>.
+
+ ACE_Node<T> *head_;
+ // Head of the linked list of Nodes.
+
+ ACE_Node<T> *last_resort_;
+ // Use this node when all memory is exhausted...
+};
+
+template <class T>
+class ACE_Unbounded_Queue;
+
+template <class T>
+class ACE_Unbounded_Queue_Iterator
+ // = TITLE
+ // Implement an iterator over an unbounded queue.
+{
+public:
+ // = Initialization method.
+ ACE_Unbounded_Queue_Iterator (ACE_Unbounded_Queue<T> &);
+
+ // = Iteration methods.
+
+ int next (T *&next_item);
+ // Pass back the <next_item> that hasn't been seen in the queue.
+ // Returns 0 when all items have been seen, else 1.
+
+ int advance (void);
+ // Move forward by one element in the set. Returns 0 when all the
+ // items in the queue have been seen, else 1.
+
+ int done (void) const;
+ // Returns 1 when all items have been seen, else 0.
+
+ void dump (void) const;
+ // Dump the state of an object.
+
+ ACE_ALLOC_HOOK_DECLARE;
+ // Declare the dynamic allocation hooks.
+
+private:
+ ACE_Node<T> *current_;
+ // Pointer to the current node in the iteration.
+
+ ACE_Unbounded_Queue<T> &queue_;
+ // Pointer to the queue we're iterating over.
+};
+
+template <class T>
+class ACE_Unbounded_Queue
+ // = TITLE
+ // A Queue of "infinite" length.
+ //
+ // = DESCRIPTION
+ // This implementation of an unbounded queue uses a circular
+ // linked list with a dummy node.
+{
+ friend class ACE_Unbounded_Queue_Iterator<T>;
+public:
+ // = Initialization and termination methods.
+ ACE_Unbounded_Queue (void);
+ // construction.
+
+ ACE_Unbounded_Queue (const ACE_Unbounded_Queue<T> &);
+ // Copy constructor.
+
+ void operator= (const ACE_Unbounded_Queue<T> &);
+ // Assignment operator.
+
+ ~ACE_Unbounded_Queue (void);
+ // construction.
+
+ // = Classic queue operations.
+ int enqueue_tail (const T &new_item);
+ // Adds <new_item> to the tail of the queue. Returns 0 on success,
+ // -1 on failure.
+
+ int enqueue_head (const T &new_item);
+ // Adds <new_item> to the head of the queue. Returns 0 on success,
+ // -1 on failure.
+
+ int dequeue_head (T &item);
+ // Removes and returns the first <item> on the queue. Returns 0 on
+ // success, -1 if the queue was empty.
+
+ // = Additional utility methods.
+
+ void reset (void);
+ // Reset the <ACE_Unbounded_Queue> to be empty.
+
+ int get (T *&item, size_t index = 0) const;
+ // Get the <index>th element in the set. Returns 0 if the element
+ // isn't in the range <0..size() - 1>, else 1.
+
+ int set (const T &item, size_t index);
+ // Set the <index>th element in the set. Will pad out the set with
+ // empty nodes if <index> is beyond the range <0..size() - 1>.
+ // Returns -1 on failure, 0 if <index> isn't initially in range, and
+ // 1 otherwise.
+
+ size_t size (void) const;
+ // The number of items in the queue.
+
+ void dump (void) const;
+ // Dump the state of an object.
+
+ ACE_ALLOC_HOOK_DECLARE;
+ // Declare the dynamic allocation hooks.
+
+protected:
+ void delete_nodes (void);
+ // Delete all the nodes in the queue.
+
+ void copy_nodes (const ACE_Unbounded_Queue<T> &);
+ // Copy nodes into this queue.
+
+ ACE_Node<T> *head_;
+ // Pointer to the dummy node in the circular linked Queue.
+
+ size_t cur_size_;
+ // Current size of the queue.
+};
+
+template <class T>
+class ACE_Unbounded_Set_Iterator
+ // = TITLE
+ // Implement an iterator over an unbounded set.
+{
+public:
+ // = Initialization method.
+ ACE_Unbounded_Set_Iterator (ACE_Unbounded_Set<T> &s);
+
+ // = Iteration methods.
+
+ int next (T *&next_item);
+ // Pass back the <next_item> that hasn't been seen in the Set.
+ // Returns 0 when all items have been seen, else 1.
+
+ int advance (void);
+ // Move forward by one element in the set. Returns 0 when all the
+ // items in the set have been seen, else 1.
+
+ int done (void) const;
+ // Returns 1 when all items have been seen, else 0.
+
+ void dump (void) const;
+ // Dump the state of an object.
+
+ ACE_ALLOC_HOOK_DECLARE;
+ // Declare the dynamic allocation hooks.
+
+private:
+ ACE_Node<T> *current_;
+ // Pointer to the current node in the iteration.
+
+ ACE_Unbounded_Set<T> &set_;
+ // Pointer to the set we're iterating over.
+};
+
+template <class T>
+class ACE_Unbounded_Set
+ // = TITLE
+ // Implement a simple unordered set of <T> of unbounded size.
+ //
+ // = DESCRIPTION
+ // This implementation of an unordered set uses a circular
+ // linked list with a dummy node. This implementation does not
+ // allow duplicates.
+{
+friend class ACE_Unbounded_Set_Iterator<T>;
+public:
+ // = Initialization and termination methods.
+ ACE_Unbounded_Set (void);
+ // Constructor.
+
+ ACE_Unbounded_Set (const ACE_Unbounded_Set<T> &);
+ // Copy constructor.
+
+ void operator= (const ACE_Unbounded_Set<T> &);
+ // Assignment operator.
+
+ ~ACE_Unbounded_Set (void);
+ // Destructor.
+
+ // = Classic unordered set operations.
+ int insert (const T &new_item);
+ // Insert <new_item> into the set (doesn't allow duplicates).
+ // Returns -1 if failures occur, 1 if item is already present, else
+ // 0.
+
+ int remove (const T &item);
+ // Remove first occurrence of <item> from the set. Returns 1 if
+ // it removes the item, 0 if it can't find the item, and -1 if a
+ // failure occurs.
+
+ int find (const T &item) const;
+ // Return first occurrence of <item> from the set.
+ // Returns 0 if can't find, else 1.
+
+ size_t size (void) const;
+ // Size of the set.
+
+ void dump (void) const;
+ // Dump the state of an object.
+
+ ACE_ALLOC_HOOK_DECLARE;
+ // Declare the dynamic allocation hooks.
+
+private:
+ int insert_tail (const T &item);
+ // Insert <item> at the tail of the set (doesn't check for
+ // duplicates).
+
+ void delete_nodes (void);
+ // Delete all the nodes in the Set.
+
+ void copy_nodes (const ACE_Unbounded_Set<T> &);
+ // Copy nodes into this set.
+
+ ACE_Node<T> *head_;
+ // Head of the linked list of Nodes.
+
+ size_t cur_size_;
+ // Current size of the set.
+};
+
+// Forward declaration.
+template <class T, size_t SIZE>
+class ACE_Fixed_Set;
+
+template <class T, size_t SIZE>
+class ACE_Fixed_Set_Iterator
+ // = TITLE
+ // Interates through an unordered set.
+ //
+ // = DESCRIPTION
+ // This implementation of an unordered set uses a fixed array.
+ // Allows deletions while iteration is occurring.
+{
+public:
+ // = Initialization method.
+ ACE_Fixed_Set_Iterator (ACE_Fixed_Set<T, SIZE> &s);
+
+ // = Iteration methods.
+
+ int next (T *&next_item);
+ // Pass back the <next_item> that hasn't been seen in the Set.
+ // Returns 0 when all items have been seen, else 1.
+
+ int advance (void);
+ // Move forward by one element in the set. Returns 0 when all the
+ // items in the set have been seen, else 1.
+
+ int done (void) const;
+ // Returns 1 when all items have been seen, else 0.
+
+ void dump (void) const;
+ // Dump the state of an object.
+
+ ACE_ALLOC_HOOK_DECLARE;
+ // Declare the dynamic allocation hooks.
+
+private:
+ ACE_Fixed_Set<T, SIZE> &s_;
+ // Set we are iterating over.
+
+ ssize_t next_;
+ // How far we've advanced over the set.
+};
+
+template <class T, size_t SIZE>
+class ACE_Fixed_Set
+ // = TITLE
+ // Implement a simple unordered set of <T> with maximum <SIZE>.
+ //
+ // = DESCRIPTION
+ // This implementation of an unordered set uses a fixed array.
+ // This implementation does not allow duplicates...
+{
+friend class ACE_Fixed_Set_Iterator<T, SIZE>;
+public:
+ // = Initialization and termination methods.
+ ACE_Fixed_Set (void);
+ // Constructor.
+
+ ACE_Fixed_Set (size_t size);
+ // Constructor.
+
+ ACE_Fixed_Set (const ACE_Fixed_Set<T, SIZE> &);
+ // Copy constructor.
+
+ void operator = (const ACE_Fixed_Set<T, SIZE> &);
+ // Assignment operator.
+
+ ~ACE_Fixed_Set (void);
+ // Destructor.
+
+ // = Classic unordered set operations.
+ int insert (const T &new_item);
+ // Insert <new_item> into the set (doesn't allow duplicates).
+ // Returns -1 if failures occur, 1 if item is already present, else
+ // 0.
+
+ int remove (const T &item);
+ // Remove first occurrence of <item> from the set. Returns 1 if
+ // it removes the item, 0 if it can't find the item, and -1 if a
+ // failure occurs.
+
+ int find (const T &item) const;
+ // Return first occurrence of <item> from the set.
+ // Returns 0 if can't find, else 1.
+
+ size_t size (void) const;
+ // Size of the set.
+
+ void dump (void) const;
+ // Dump the state of an object.
+
+ ACE_ALLOC_HOOK_DECLARE;
+ // Declare the dynamic allocation hooks.
+
+private:
+ struct
+ {
+ T item_;
+ // Item in the set.
+ int is_free_;
+ // Keeps track of whether this item is in use or not.
+ } search_structure_[SIZE];
+ // Holds the contents of the set.
+
+ size_t cur_size_;
+ // Current size of the set.
+
+ size_t max_size_;
+ // Maximum size of the set.
+};
+
+// Forward declaration.
+template <class T>
+class ACE_Bounded_Set;
+
+template <class T>
+class ACE_Bounded_Set_Iterator
+ // = TITLE
+ // Interates through an unordered set.
+ //
+ // = DESCRIPTION
+ // This implementation of an unordered set uses a Bounded array.
+ // Allows deletions while iteration is occurring.
+{
+public:
+ // = Initialization method.
+ ACE_Bounded_Set_Iterator (ACE_Bounded_Set<T> &s);
+
+ // = Iteration methods.
+
+ int next (T *&next_item);
+ // Pass back the <next_item> that hasn't been seen in the Set.
+ // Returns 0 when all items have been seen, else 1.
+
+ int advance (void);
+ // Move forward by one element in the set. Returns 0 when all the
+ // items in the set have been seen, else 1.
+
+ int done (void) const;
+ // Returns 1 when all items have been seen, else 0.
+
+ void dump (void) const;
+ // Dump the state of an object.
+
+ ACE_ALLOC_HOOK_DECLARE;
+ // Declare the dynamic allocation hooks.
+
+private:
+ ACE_Bounded_Set<T> &s_;
+ // Set we are iterating over.
+
+ ssize_t next_;
+ // How far we've advanced over the set.
+};
+
+template <class T>
+class ACE_Bounded_Set
+ // = TITLE
+ // Implement a simple unordered set of <T> with maximum
+ // set at creation time.
+ //
+ // = DESCRIPTION
+ // This implementation of an unordered set uses a Bounded array.
+ // This implementation does not allow duplicates...
+{
+friend class ACE_Bounded_Set_Iterator<T>;
+public:
+ enum
+ {
+ DEFAULT_SIZE = 10
+ };
+
+ // = Initialization and termination methods.
+ ACE_Bounded_Set (void);
+ // Constructor.
+
+ ACE_Bounded_Set (size_t size);
+ // Constructor.
+
+ ACE_Bounded_Set (const ACE_Bounded_Set<T> &);
+ // Copy constructor.
+
+ void operator= (const ACE_Bounded_Set<T> &);
+ // Assignment operator.
+
+ ~ACE_Bounded_Set (void);
+ // Destructor
+
+ // = Classic unordered set operations.
+ int insert (const T &new_item);
+ // Insert <new_item> into the set (doesn't allow duplicates).
+ // Returns -1 if failures occur, 1 if item is already present, else
+ // 0.
+
+ int remove (const T &item);
+ // Remove first occurrence of <item> from the set. Returns 1 if it
+ // removes the item, 0 if it can't find the item, and -1 if a
+ // failure occurs.
+
+ int find (const T &item) const;
+ // Return first occurrence of <item> from the set.
+ // Returns 0 if can't find, else 1.
+
+ size_t size (void) const;
+ // Size of the set.
+
+ void dump (void) const;
+ // Dump the state of an object.
+
+ ACE_ALLOC_HOOK_DECLARE;
+ // Declare the dynamic allocation hooks.
+
+private:
+ struct Search_Structure
+ {
+ T item_;
+ // Item in the set.
+ int is_free_;
+ // Keeps track of whether this item is in use or not.
+ };
+
+ Search_Structure *search_structure_;
+ // Holds the contents of the set.
+
+ size_t cur_size_;
+ // Current size of the set.
+
+ size_t max_size_;
+ // Maximum size of the set.
+};
+
+#if defined (__ACE_INLINE__)
+#include "ace/Containers.i"
+#endif /* __ACE_INLINE__ */
+
+#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
+#include "ace/Containers.cpp"
+#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
+
+#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
+#pragma implementation ("Containers.cpp")
+#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
+
+#endif /* ACE_CONTAINERS_H */
diff --git a/ace/Stack.i b/ace/Containers.i
index 13f65190d66..18218b3f41c 100644
--- a/ace/Stack.i
+++ b/ace/Containers.i
@@ -1,7 +1,7 @@
/* -*- C++ -*- */
// $Id$
-// Stack.i
+// Containers.i
template <class T> ACE_INLINE void
ACE_Bounded_Stack<T>::push (const T &new_item)
diff --git a/ace/Local_Name_Space.cpp b/ace/Local_Name_Space.cpp
index 48f6dc00535..0ba1c5dc0f2 100644
--- a/ace/Local_Name_Space.cpp
+++ b/ace/Local_Name_Space.cpp
@@ -162,8 +162,8 @@ template class ACE_Unbounded_Set<ACE_Name_Binding>;
template class ACE_Unbounded_Set_Iterator<ACE_Name_Binding>;
template class ACE_Unbounded_Set<ACE_WString>;
template class ACE_Unbounded_Set_Iterator<ACE_WString>;
-template class ACE_Set_Node<ACE_WString>;
-template class ACE_Set_Node<ACE_Name_Binding>;
+template class ACE_Node<ACE_WString>;
+template class ACE_Node<ACE_Name_Binding>;
template class ACE_Guard<ACE_RW_Process_Mutex>;
template class ACE_Read_Guard<ACE_RW_Process_Mutex>;
template class ACE_Write_Guard<ACE_RW_Process_Mutex>;
diff --git a/ace/Local_Name_Space.h b/ace/Local_Name_Space.h
index cee5042db1c..e115903cc2f 100644
--- a/ace/Local_Name_Space.h
+++ b/ace/Local_Name_Space.h
@@ -20,7 +20,7 @@
#define ACE_LOCAL_NAME_SPACE_H
#include "ace/SString.h"
-#include "ace/Set.h"
+#include "ace/Containers.h"
#include "ace/Malloc.h"
#include "ace/Synch.h"
diff --git a/ace/Local_Tokens.cpp b/ace/Local_Tokens.cpp
index 0fbe4524db6..d786e4a9b3f 100644
--- a/ace/Local_Tokens.cpp
+++ b/ace/Local_Tokens.cpp
@@ -1412,5 +1412,5 @@ ACE_Token_Name::dump (void) const
template class ACE_TSS <ACE_TPQ_Entry>;
#endif /* ACE_NO_TSS_TOKENS */
template class ACE_Unbounded_Stack <ACE_TPQ_Entry *>;
-template class ACE_Stack_Node <ACE_TPQ_Entry *>;
+template class ACE_Node <ACE_TPQ_Entry *>;
#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
diff --git a/ace/Local_Tokens.h b/ace/Local_Tokens.h
index 49a66af5b68..5663e0913d0 100644
--- a/ace/Local_Tokens.h
+++ b/ace/Local_Tokens.h
@@ -40,7 +40,7 @@
#define ACE_LOCAL_MUTEX_H
#include "ace/Synch.h"
-#include "ace/Stack.h"
+#include "ace/Containers.h"
#include "ace/Synch_Options.h"
#include "ace/Map_Manager.h"
diff --git a/ace/Log_Msg.cpp b/ace/Log_Msg.cpp
index 6225d122630..701029d69a9 100644
--- a/ace/Log_Msg.cpp
+++ b/ace/Log_Msg.cpp
@@ -24,7 +24,7 @@
#include "ace/Thread.h"
#include "ace/Synch.h"
#include "ace/Signal.h"
-#include "ace/Set.h"
+#include "ace/Containers.h"
#if defined (ACE_HAS_UNICODE)
#define ACE_WSPRINTF(BUF,VALUE) ::wsprintf (BUF, "%S", VALUE)
@@ -169,7 +169,7 @@ ACE_Log_Msg_Manager::atexit (void)
)
{
// Advance the iterator first because it needs to read the next
- // field of the ACE_Set_Node that will be deleted as a result of
+ // field of the ACE_Node that will be deleted as a result of
// the following call to remove the node.
i.advance ();
@@ -1259,7 +1259,7 @@ ACE_Log_Msg::getpid (void) const
#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
-template class ACE_Set_Node<ACE_Log_Msg *>;
+template class ACE_Node<ACE_Log_Msg *>;
template class ACE_Unbounded_Set<ACE_Log_Msg *>;
template class ACE_Unbounded_Set_Iterator<ACE_Log_Msg *>;
#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
diff --git a/ace/Name_Space.h b/ace/Name_Space.h
index 78a274e86b5..0aecbad5248 100644
--- a/ace/Name_Space.h
+++ b/ace/Name_Space.h
@@ -21,7 +21,7 @@
#include "ace/ACE.h"
#include "ace/SString.h"
-#include "ace/Set.h"
+#include "ace/Containers.h"
#include "ace/Name_Proxy.h"
typedef ACE_Unbounded_Set<ACE_WString> ACE_WSTRING_SET;
diff --git a/ace/Naming_Context.h b/ace/Naming_Context.h
index afa79ef0bf0..3c418dfdd3b 100644
--- a/ace/Naming_Context.h
+++ b/ace/Naming_Context.h
@@ -21,7 +21,7 @@
#include "ace/ACE.h"
#include "ace/SString.h"
-#include "ace/Set.h"
+#include "ace/Containers.h"
#include "ace/Service_Object.h"
#include "ace/Name_Proxy.h"
#include "ace/Name_Space.h"
diff --git a/ace/OS.cpp b/ace/OS.cpp
index babd7ce9427..3a050d24b76 100644
--- a/ace/OS.cpp
+++ b/ace/OS.cpp
@@ -16,7 +16,7 @@
#endif /* ACE_HAS_INLINED_OS_CALLS */
#include "ace/Synch.h"
-#include "ace/Set.h"
+#include "ace/Containers.h"
#if defined (ACE_MT_SAFE)
diff --git a/ace/OS.h b/ace/OS.h
index 6f4146d592b..49a20a5c3ec 100644
--- a/ace/OS.h
+++ b/ace/OS.h
@@ -2722,9 +2722,9 @@ public:
static void free (void *);
// = A set of wrappers for memory copying operations.
- static int memcmp (const void *s, const void *t, size_t len);
- static void *memcpy (void *s, const void *t, size_t len);
- static void *memmove (void *s, const void *t, size_t len);
+ static int memcmp (const void *t, const void *s, size_t len);
+ static void *memcpy (void *t, const void *s, size_t len);
+ static void *memmove (void *t, const void *s, size_t len);
static void *memset (void *s, int c, size_t len);
// = A set of wrappers for System V message queues.
diff --git a/ace/OS.i b/ace/OS.i
index 338f8471e30..8cc1dca73e3 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -952,24 +952,24 @@ ACE_OS::_exit (int status)
}
ACE_INLINE int
-ACE_OS::memcmp (const void *s, const void *t, size_t len)
+ACE_OS::memcmp (const void *t, const void *s, size_t len)
{
// ACE_TRACE ("ACE_OS::memcmp");
- return ::memcmp (s, t, len);
+ return ::memcmp (t, s, len);
}
ACE_INLINE void *
-ACE_OS::memcpy (void *s, const void *t, size_t len)
+ACE_OS::memcpy (void *t, const void *s, size_t len)
{
// ACE_TRACE ("ACE_OS::memcpy");
- return ::memcpy (s, t, len);
+ return ::memcpy (t, s, len);
}
ACE_INLINE void *
-ACE_OS::memmove (void *s, const void *t, size_t len)
+ACE_OS::memmove (void *t, const void *s, size_t len)
{
// ACE_TRACE ("ACE_OS::memcpy");
- return ::memmove (s, t, len);
+ return ::memmove (t, s, len);
}
ACE_INLINE void *
diff --git a/ace/Proactor.cpp b/ace/Proactor.cpp
index 050b142d144..04eaf1d6bdc 100644
--- a/ace/Proactor.cpp
+++ b/ace/Proactor.cpp
@@ -541,7 +541,7 @@ ACE_Proactor::Asynch_Timer::complete (u_long bytes_transferred,
template class ACE_Unbounded_Set<ACE_Timer_Node_T<ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall> *>;
template class ACE_Unbounded_Set_Iterator<ACE_Timer_Node_T<ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall> *>;
-template class ACE_Set_Node<ACE_Timer_Node_T<ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall> *>;
+template class ACE_Node<ACE_Timer_Node_T<ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall> *>;
template class ACE_Timer_Node_T<ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall>;
diff --git a/ace/Remote_Name_Space.h b/ace/Remote_Name_Space.h
index d6010250c07..d978fa39e00 100644
--- a/ace/Remote_Name_Space.h
+++ b/ace/Remote_Name_Space.h
@@ -21,7 +21,7 @@
#include "ace/ACE.h"
#include "ace/SString.h"
-#include "ace/Set.h"
+#include "ace/Containers.h"
#include "ace/Name_Proxy.h"
#include "ace/Name_Space.h"
diff --git a/ace/Service_Config.cpp b/ace/Service_Config.cpp
index 7c4fd047675..86e58214088 100644
--- a/ace/Service_Config.cpp
+++ b/ace/Service_Config.cpp
@@ -9,7 +9,7 @@
#include "ace/Service_Manager.h"
#include "ace/Service_Repository.h"
#include "ace/Service_Record.h"
-#include "ace/Set.h"
+#include "ace/Containers.h"
#include "ace/Auto_Ptr.h"
#include "ace/Service_Config.h"
@@ -961,7 +961,7 @@ ACE_Service_Config::reconfig_occurred (sig_atomic_t config_occurred)
}
#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
-template class ACE_Set_Node<ACE_Static_Svc_Descriptor *>;
+template class ACE_Node<ACE_Static_Svc_Descriptor *>;
template class ACE_Unbounded_Set<ACE_Static_Svc_Descriptor *>;
template class ACE_Unbounded_Set_Iterator<ACE_Static_Svc_Descriptor *>;
template class ACE_Malloc<ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex>;
diff --git a/ace/Service_Config.h b/ace/Service_Config.h
index ee7829232e7..1e196cc8246 100644
--- a/ace/Service_Config.h
+++ b/ace/Service_Config.h
@@ -20,7 +20,7 @@
#include "ace/Service_Object.h"
#include "ace/Thread_Manager.h"
#include "ace/Signal.h"
-#include "ace/Set.h"
+#include "ace/Containers.h"
// Forward decl.
class ACE_Service_Repository;
diff --git a/ace/Set.h b/ace/Set.h
deleted file mode 100644
index fccaeb8a2e3..00000000000
--- a/ace/Set.h
+++ /dev/null
@@ -1,394 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// ace
-//
-// = FILENAME
-// Set.h
-//
-// = AUTHOR
-// Doug Schmidt
-//
-// ============================================================================
-
-#if !defined (ACE_SET)
-#define ACE_SET
-
-#include "ace/ACE.h"
-
-// Forward declarations.
-template <class T> class ACE_Unbounded_Set;
-
-// "Cheshire cat" forward decl.
-template <class T> class ACE_Set_Node;
-
-template <class T>
-class ACE_Unbounded_Set_Iterator
- // = TITLE
- // Implement an iterator over an unbounded set.
-{
-public:
- // = Initialization method.
- ACE_Unbounded_Set_Iterator (ACE_Unbounded_Set<T> &s);
-
- // = Iteration methods.
-
- int next (T *&next_item);
- // Pass back the <next_item> that hasn't been seen in the Set.
- // Returns 0 when all items have been seen, else 1.
-
- int advance (void);
- // Move forward by one element in the set. Returns 0 when all the
- // items in the set have been seen, else 1.
-
- int done (void) const;
- // Returns 1 when all items have been seen, else 0.
-
- void dump (void) const;
- // Dump the state of an object.
-
- ACE_ALLOC_HOOK_DECLARE;
- // Declare the dynamic allocation hooks.
-
-private:
- ACE_Set_Node<T> *current_;
- // Pointer to the current node in the iteration.
-
- ACE_Unbounded_Set<T> &set_;
- // Pointer to the set we're iterating over.
-};
-
-// Forward declaration (use the "Cheshire Cat" approach to information
-// hiding).
-template <class T>
-class ACE_Set_Node;
-
-template <class T>
-class ACE_Unbounded_Set
- // = TITLE
- // Implement a simple unordered set of <T> of unbounded size.
- //
- // = DESCRIPTION
- // This implementation of an unordered set uses a linked list.
- // This implementation does not allow duplicates...
-{
-friend class ACE_Unbounded_Set_Iterator<T>;
-public:
- // = Initialization and termination methods.
- ACE_Unbounded_Set (void);
- // Constructor.
-
- ACE_Unbounded_Set (const ACE_Unbounded_Set<T> &);
- // Copy constructor.
-
- void operator= (const ACE_Unbounded_Set<T> &);
- // Assignment operator.
-
- ~ACE_Unbounded_Set (void);
- // Destructor.
-
- // = Classic unordered set operations.
- int insert (const T &new_item);
- // Insert <new_item> into the set (doesn't allow duplicates).
- // Returns -1 if failures occur, 1 if item is already present, else
- // 0.
-
- int remove (const T &item);
- // Remove first occurrence of <item> from the set. Returns 1 if
- // it removes the item, 0 if it can't find the item, and -1 if a
- // failure occurs.
-
- int find (const T &item) const;
- // Return first occurrence of <item> from the set.
- // Returns 0 if can't find, else 1.
-
- size_t size (void) const;
- // Size of the set.
-
- // = Additional utility methods.
-
- int get (T &item, size_t index) const;
- // Get the <index>th element in the set. Returns 0 if the element
- // isn't in the range <0..size() - 1>, else 1.
-
- int set (const T &item, size_t index);
- // Set the <index>th element in the set. Will pad out the set with
- // empty nodes if <index> is beyond the range <0..size() - 1>.
- // Returns -1 on failure, 0 if <index> isn't initially in range, and
- // 1 otherwise.
-
- int insert_tail (const T &new_item);
- // Insert <new_item> into the set at the tail. Returns -1 if
- // failures occur else 0.
-
- void reset (void);
- // Reset the <ACE_Unbounded_Set> to be empty.
-
- void dump (void) const;
- // Dump the state of an object.
-
- ACE_ALLOC_HOOK_DECLARE;
- // Declare the dynamic allocation hooks.
-
-private:
- void delete_nodes (void);
- // Delete all the nodes in the Set.
-
- void copy_nodes (const ACE_Unbounded_Set<T> &);
- // Copy nodes into this set.
-
- ACE_Set_Node<T> *head_;
- // Head of the linked list of Nodes.
-
- size_t cur_size_;
- // Current size of the set.
-};
-
-// Forward declaration.
-template <class T, size_t SIZE>
-class ACE_Fixed_Set;
-
-template <class T, size_t SIZE>
-class ACE_Fixed_Set_Iterator
- // = TITLE
- // Interates through an unordered set.
- //
- // = DESCRIPTION
- // This implementation of an unordered set uses a fixed array.
- // Allows deletions while iteration is occurring.
-{
-public:
- // = Initialization method.
- ACE_Fixed_Set_Iterator (ACE_Fixed_Set<T, SIZE> &s);
-
- // = Iteration methods.
-
- int next (T *&next_item);
- // Pass back the <next_item> that hasn't been seen in the Set.
- // Returns 0 when all items have been seen, else 1.
-
- int advance (void);
- // Move forward by one element in the set. Returns 0 when all the
- // items in the set have been seen, else 1.
-
- int done (void) const;
- // Returns 1 when all items have been seen, else 0.
-
- void dump (void) const;
- // Dump the state of an object.
-
- ACE_ALLOC_HOOK_DECLARE;
- // Declare the dynamic allocation hooks.
-
-private:
- ACE_Fixed_Set<T, SIZE> &s_;
- // Set we are iterating over.
-
- ssize_t next_;
- // How far we've advanced over the set.
-};
-
-template <class T, size_t SIZE>
-class ACE_Fixed_Set
- // = TITLE
- // Implement a simple unordered set of <T> with maximum <SIZE>.
- //
- // = DESCRIPTION
- // This implementation of an unordered set uses a fixed array.
- // This implementation does not allow duplicates...
-{
-friend class ACE_Fixed_Set_Iterator<T, SIZE>;
-public:
- // = Initialization and termination methods.
- ACE_Fixed_Set (void);
- // Constructor.
-
- ACE_Fixed_Set (size_t size);
- // Constructor.
-
- ACE_Fixed_Set (const ACE_Fixed_Set<T, SIZE> &);
- // Copy constructor.
-
- void operator = (const ACE_Fixed_Set<T, SIZE> &);
- // Assignment operator.
-
- ~ACE_Fixed_Set (void);
- // Destructor.
-
- // = Classic unordered set operations.
- int insert (const T &new_item);
- // Insert <new_item> into the set (doesn't allow duplicates).
- // Returns -1 if failures occur, 1 if item is already present, else
- // 0.
-
- int remove (const T &item);
- // Remove first occurrence of <item> from the set. Returns 1 if
- // it removes the item, 0 if it can't find the item, and -1 if a
- // failure occurs.
-
- int find (const T &item) const;
- // Return first occurrence of <item> from the set.
- // Returns 0 if can't find, else 1.
-
- size_t size (void) const;
- // Size of the set.
-
- void dump (void) const;
- // Dump the state of an object.
-
- ACE_ALLOC_HOOK_DECLARE;
- // Declare the dynamic allocation hooks.
-
-private:
- struct
- {
- T item_;
- // Item in the set.
- int is_free_;
- // Keeps track of whether this item is in use or not.
- } search_structure_[SIZE];
- // Holds the contents of the set.
-
- size_t cur_size_;
- // Current size of the set.
-
- size_t max_size_;
- // Maximum size of the set.
-};
-
-// Forward declaration.
-template <class T>
-class ACE_Bounded_Set;
-
-template <class T>
-class ACE_Bounded_Set_Iterator
- // = TITLE
- // Interates through an unordered set.
- //
- // = DESCRIPTION
- // This implementation of an unordered set uses a Bounded array.
- // Allows deletions while iteration is occurring.
-{
-public:
- // = Initialization method.
- ACE_Bounded_Set_Iterator (ACE_Bounded_Set<T> &s);
-
- // = Iteration methods.
-
- int next (T *&next_item);
- // Pass back the <next_item> that hasn't been seen in the Set.
- // Returns 0 when all items have been seen, else 1.
-
- int advance (void);
- // Move forward by one element in the set. Returns 0 when all the
- // items in the set have been seen, else 1.
-
- int done (void) const;
- // Returns 1 when all items have been seen, else 0.
-
- void dump (void) const;
- // Dump the state of an object.
-
- ACE_ALLOC_HOOK_DECLARE;
- // Declare the dynamic allocation hooks.
-
-private:
- ACE_Bounded_Set<T> &s_;
- // Set we are iterating over.
-
- ssize_t next_;
- // How far we've advanced over the set.
-};
-
-template <class T>
-class ACE_Bounded_Set
- // = TITLE
- // Implement a simple unordered set of <T> with maximum
- // set at creation time.
- //
- // = DESCRIPTION
- // This implementation of an unordered set uses a Bounded array.
- // This implementation does not allow duplicates...
-{
-friend class ACE_Bounded_Set_Iterator<T>;
-public:
- enum
- {
- DEFAULT_SIZE = 10
- };
-
- // = Initialization and termination methods.
- ACE_Bounded_Set (void);
- // Constructor.
-
- ACE_Bounded_Set (size_t size);
- // Constructor.
-
- ACE_Bounded_Set (const ACE_Bounded_Set<T> &);
- // Copy constructor.
-
- void operator= (const ACE_Bounded_Set<T> &);
- // Assignment operator.
-
- ~ACE_Bounded_Set (void);
- // Destructor
-
- // = Classic unordered set operations.
- int insert (const T &new_item);
- // Insert <new_item> into the set (doesn't allow duplicates).
- // Returns -1 if failures occur, 1 if item is already present, else
- // 0.
-
- int remove (const T &item);
- // Remove first occurrence of <item> from the set. Returns 1 if it
- // removes the item, 0 if it can't find the item, and -1 if a
- // failure occurs.
-
- int find (const T &item) const;
- // Return first occurrence of <item> from the set.
- // Returns 0 if can't find, else 1.
-
- size_t size (void) const;
- // Size of the set.
-
- void dump (void) const;
- // Dump the state of an object.
-
- ACE_ALLOC_HOOK_DECLARE;
- // Declare the dynamic allocation hooks.
-
-private:
- struct Search_Structure
- {
- T item_;
- // Item in the set.
- int is_free_;
- // Keeps track of whether this item is in use or not.
- };
-
- Search_Structure *search_structure_;
- // Holds the contents of the set.
-
- size_t cur_size_;
- // Current size of the set.
-
- size_t max_size_;
- // Maximum size of the set.
-};
-
-#if defined (__ACE_INLINE__)
-#include "ace/Set.i"
-#endif /* __ACE_INLINE__ */
-
-#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
-#include "ace/Set.cpp"
-#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
-
-#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
-#pragma implementation ("Set.cpp")
-#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
-
-#endif /* ACE_SET */
diff --git a/ace/Set.i b/ace/Set.i
deleted file mode 100644
index 8628f7acd9f..00000000000
--- a/ace/Set.i
+++ /dev/null
@@ -1,5 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-
-// Set.i
-
diff --git a/ace/Signal.h b/ace/Signal.h
index 77d458cfcd6..d289e6869ba 100644
--- a/ace/Signal.h
+++ b/ace/Signal.h
@@ -19,7 +19,7 @@
#include "ace/Synch.h"
#include "ace/Event_Handler.h"
-#include "ace/Set.h"
+#include "ace/Containers.h"
// This worksaround a horrible bug with HP/UX C++...
typedef struct sigaction ACE_SIGACTION;
diff --git a/ace/Stack.cpp b/ace/Stack.cpp
deleted file mode 100644
index a297ca2e9e4..00000000000
--- a/ace/Stack.cpp
+++ /dev/null
@@ -1,446 +0,0 @@
-// Stack.cpp
-// $Id$
-
-#if !defined (ACE_STACK_C)
-#define ACE_STACK_C
-
-#define ACE_BUILD_DLL
-#include "ace/Stack.h"
-
-#if !defined (__ACE_INLINE__)
-#include "ace/Stack.i"
-#endif /* __ACE_INLINE__ */
-
-ACE_ALLOC_HOOK_DEFINE(ACE_Bounded_Stack)
-
-template <class T> void
-ACE_Bounded_Stack<T>::dump (void) const
-{
- ACE_TRACE ("ACE_Bounded_Stack<T>::dump");
-}
-
-template<class T>
-ACE_Bounded_Stack<T>::ACE_Bounded_Stack (size_t size)
- : top_ (0),
- size_ (size)
-{
- ACE_NEW (this->stack_, T[size]);
-
- ACE_TRACE ("ACE_Bounded_Stack<T>::ACE_Bounded_Stack");
-}
-
-template<class T>
-ACE_Bounded_Stack<T>::ACE_Bounded_Stack (const ACE_Bounded_Stack<T> &s)
- : top_ (s.top_),
- size_ (s.size_)
-{
- ACE_NEW (this->stack_, T[s.size_]);
-
- ACE_TRACE ("ACE_Bounded_Stack<T>::ACE_Bounded_Stack");
-
- for (size_t i = 0; i < this->top_; i++)
- this->stack_[i] = s.stack_[i];
-}
-
-template<class T> void
-ACE_Bounded_Stack<T>::operator= (const ACE_Bounded_Stack<T> &s)
-{
- ACE_TRACE ("ACE_Bounded_Stack<T>::operator=");
- if (&s == this)
- return;
- else if (this->size_ < s.size_)
- {
- delete [] this->stack_;
- ACE_NEW (this->stack_, T[s.size_]);
- }
- this->top_ = s.top_;
-
- for (size_t i = 0; i < this->top_; i++)
- this->stack_[i] = s.stack_[i];
-}
-
-template<class T>
-ACE_Bounded_Stack<T>::~ACE_Bounded_Stack (void)
-{
- ACE_TRACE ("ACE_Bounded_Stack<T>::~ACE_Bounded_Stack");
- delete [] this->stack_;
-}
-
-// ----------------------------------------
-
-ACE_ALLOC_HOOK_DEFINE(ACE_Fixed_Stack)
-
-template <class T, size_t SIZE> void
-ACE_Fixed_Stack<T, SIZE>::dump (void) const
-{
- ACE_TRACE ("ACE_Fixed_Stack<T, SIZE>::dump");
-}
-
-template<class T, size_t SIZE>
-ACE_Fixed_Stack<T, SIZE>::ACE_Fixed_Stack (void)
- : top_ (0),
- size_ (SIZE)
-{
- ACE_TRACE ("ACE_Fixed_Stack<T, SIZE>::ACE_Fixed_Stack");
-}
-
-template<class T, size_t SIZE>
-ACE_Fixed_Stack<T, SIZE>::ACE_Fixed_Stack (const ACE_Fixed_Stack<T, SIZE> &s)
- : top_ (s.top_),
- size_ (s.size_)
-{
- ACE_TRACE ("ACE_Fixed_Stack<T, SIZE>::ACE_Fixed_Stack");
- for (size_t i = 0; i < this->top_; i++)
- this->stack_[i] = s.stack_[i];
-}
-
-template<class T, size_t SIZE> void
-ACE_Fixed_Stack<T, SIZE>::operator= (const ACE_Fixed_Stack<T, SIZE> &s)
-{
- ACE_TRACE ("ACE_Fixed_Stack<T, SIZE>::operator=");
- if (&s == this)
- return;
- this->top_ = s.top_;
-
- for (size_t i = 0; i < this->top_; i++)
- this->stack_[i] = s.stack_[i];
-}
-
-template<class T, size_t SIZE>
-ACE_Fixed_Stack<T, SIZE>::~ACE_Fixed_Stack (void)
-{
- ACE_TRACE ("ACE_Fixed_Stack<T, SIZE>::~ACE_Fixed_Stack");
- delete [] this->stack_;
-}
-
-//----------------------------------------
-
-template<class T>
-class ACE_Stack_Node
-{
-friend class ACE_Unbounded_Stack<T>;
-private:
-#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
- // = Only use a free list if the compiler supports static data
- // members...
-
- void *operator new (size_t bytes);
- void operator delete (void *ptr);
-
- // Returns all dynamic memory on the free list to the free store.
- static void free_all_nodes (void);
-
- static ACE_Stack_Node<T> *free_list_;
- // Head of the free list of Nodes used to speed up allocation.
-#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
-
- ACE_Stack_Node (T i, ACE_Stack_Node<T> *n);
- ACE_Stack_Node (void);
-
- ACE_Stack_Node<T> *next_;
- T item_;
-};
-
-#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
-/* static */
-template<class T> ACE_Stack_Node<T> *
-ACE_Stack_Node<T>::free_list_ = 0;
-
-template<class T> void *
-ACE_Stack_Node<T>::operator new (size_t bytes)
-{
- ACE_TRACE ("ACE_Stack_Node<T>::operator new");
- ACE_Stack_Node<T> *temp = ACE_Stack_Node<T>::free_list_;
-
- if (temp)
- ACE_Stack_Node<T>::free_list_ = ACE_Stack_Node<T>::free_list_->next_;
- else
- temp = (ACE_Stack_Node<T> *) new char[bytes];
-
- return temp;
-}
-
-template<class T> void
-ACE_Stack_Node<T>::operator delete (void *ptr)
-{
- ACE_TRACE ("ACE_Stack_Node<T>::operator delete");
- ((ACE_Stack_Node<T> *) ptr)->next_ = ACE_Stack_Node<T>::free_list_;
- ACE_Stack_Node<T>::free_list_ = (ACE_Stack_Node<T> *) ptr;
-}
-
-template<class T> void
-ACE_Stack_Node<T>::free_all_nodes (void)
-{
- ACE_TRACE ("ACE_Stack_Node<T>::free_all_nodes");
-
- while (ACE_Stack_Node<T>::free_list_)
- {
- ACE_Stack_Node<T> *temp = ACE_Stack_Node<T>::free_list_;
- ACE_Stack_Node<T>::free_list_ = ACE_Stack_Node<T>::free_list_->next_;
- ::delete temp;
- }
-}
-
-#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
-
-template<class T>
-ACE_Stack_Node<T>::ACE_Stack_Node (T i, ACE_Stack_Node<T> *n)
- : next_ (n),
- item_ (i)
-{
- ACE_TRACE ("ACE_Stack_Node<T>::ACE_Stack_Node");
-}
-
-template<class T>
-ACE_Stack_Node<T>::ACE_Stack_Node (void)
- : next_ (0)
-{
- ACE_TRACE ("ACE_Stack_Node<T>::ACE_Stack_Node");
-}
-
-ACE_ALLOC_HOOK_DEFINE(ACE_Unbounded_Stack)
-
-template <class T> void
-ACE_Unbounded_Stack<T>::dump (void) const
-{
- ACE_TRACE ("ACE_Unbounded_Stack<T>::dump");
-}
-
-template<class T>
-ACE_Unbounded_Stack<T>::ACE_Unbounded_Stack (void)
- : head_ (0)
-{
- ACE_NEW (this->last_resort_, ACE_Stack_Node<T>);
- ACE_TRACE ("ACE_Unbounded_Stack<T>::ACE_Unbounded_Stack");
-}
-
-template<class T> void
-ACE_Unbounded_Stack<T>::delete_all_nodes (void)
-{
- ACE_TRACE ("ACE_Unbounded_Stack<T>::delete_all_nodes");
- while (this->head_ != 0)
- {
- ACE_Stack_Node<T> *temp = this->head_;
- this->head_ = this->head_->next_;
- delete temp;
- }
-
- delete this->last_resort_;
- this->last_resort_ = 0;
-}
-
-template<class T> void
-ACE_Unbounded_Stack<T>::copy_all_nodes (const ACE_Unbounded_Stack<T> &s)
-{
- ACE_TRACE ("ACE_Unbounded_Stack<T>::copy_all_nodes");
- // Push all of <s>'s nodes onto our stack (this puts them in the
- // reverse order).
- ACE_Stack_Node<T> *temp;
-
- for (temp = s.head_;
- temp != 0;
- temp = temp->next_)
- {
- if (!this->is_full ())
- this->push (temp->item_);
- else
- break;
- }
-
- // Reverse the order of our stack.
-
- ACE_Stack_Node<T> *prev = 0;
-
- for (temp = this->head_; temp != 0; )
- {
- ACE_Stack_Node<T> *next = temp->next_;
-
- temp->next_ = prev;
- prev = temp;
- temp = next;
- }
-
- this->head_ = prev;
-}
-
-template<class T>
-ACE_Unbounded_Stack<T>::ACE_Unbounded_Stack (const ACE_Unbounded_Stack<T> &s)
- : head_ (0)
-{
- ACE_NEW (this->last_resort_, ACE_Stack_Node<T>);
-
- ACE_TRACE ("ACE_Unbounded_Stack<T>::ACE_Unbounded_Stack");
- this->copy_all_nodes (s);
-}
-
-template<class T> void
-ACE_Unbounded_Stack<T>::operator= (const ACE_Unbounded_Stack<T> &s)
-{
- ACE_TRACE ("ACE_Unbounded_Stack<T>::operator=");
- if (this == &s)
- return;
-
- this->delete_all_nodes ();
- this->copy_all_nodes (s);
-}
-
-template<class T>
-ACE_Unbounded_Stack<T>::~ACE_Unbounded_Stack (void)
-{
- ACE_TRACE ("ACE_Unbounded_Stack<T>::~ACE_Unbounded_Stack");
- this->delete_all_nodes ();
-}
-
-template<class T> void
-ACE_Unbounded_Stack<T>::push (const T &new_item)
-{
- ACE_TRACE ("ACE_Unbounded_Stack<T>::push");
-
- ACE_Stack_Node<T> *temp = new ACE_Stack_Node<T> (new_item, this->head_);
-
- if (temp == 0)
- {
- temp = this->last_resort_;
- this->last_resort_ = 0;
- }
-
- this->head_ = temp;
-}
-
-template<class T> void
-ACE_Unbounded_Stack<T>::pop (T &item)
-{
- ACE_TRACE ("ACE_Unbounded_Stack<T>::pop");
- item = this->head_->item_;
- ACE_Stack_Node<T> *temp = this->head_;
- this->head_ = this->head_->next_;
-
- // Restore the node of last resort if necessary.
- if (this->last_resort_ == 0)
- this->last_resort_ = temp;
- else
- delete temp;
-}
-
-template<class T> void
-ACE_Unbounded_Stack<T>::delete_free_list (void)
-{
- ACE_TRACE ("ACE_Unbounded_Stack<T>::delete_free_list");
-#if !defined (ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES)
- ACE_Stack_Node<T>::free_all_nodes ();
-#endif /* ACE_LACKS_STATIC_DATA_MEMBER_TEMPLATES */
-}
-
-template<class T>
-class ACE_Queue_Node
-{
-friend class ACE_Unbounded_Queue<T>;
- ACE_Queue_Node (T i, ACE_Queue_Node<T> *n);
-
- ACE_Queue_Node<T> *next_;
- T item_;
-};
-
-template<class T>
-ACE_Queue_Node<T>::ACE_Queue_Node (T i, ACE_Queue_Node<T> *n)
- : next_ (n),
- item_ (i)
-{
- ACE_TRACE ("ACE_Queue_Node<T>::ACE_Queue_Node");
-}
-
-template <class TYPE>
-ACE_Unbounded_Queue<TYPE>::ACE_Unbounded_Queue (void)
- : head_ (0),
- tail_ (0),
- cur_size_ (0)
-{
- ACE_TRACE ("ACE_Unbounded_Queue<TYPE>::ACE_Unbounded_Queue (void)");
-}
-
-ACE_ALLOC_HOOK_DEFINE(ACE_Unbounded_Queue)
-
-template <class TYPE> void
-ACE_Unbounded_Queue<TYPE>::dump (void) const
-{
- ACE_TRACE ("ACE_Unbounded_Queue<TYPE>::dump");
-}
-
-template <class TYPE>
-ACE_Unbounded_Queue<TYPE>::~ACE_Unbounded_Queue (void)
-{
- ACE_TRACE ("ACE_Unbounded_Queue<TYPE>::~ACE_Unbounded_Queue (void)");
- ACE_Queue_Node<TYPE> *temp = head_;
- while (temp != 0)
- {
- head_ = head_->next_;
- delete temp;
- temp = head_;
- this->cur_size_--;
- }
-}
-
-template <class TYPE> int
-ACE_Unbounded_Queue<TYPE>::enqueue (const TYPE &new_item)
-{
- ACE_TRACE ("ACE_Unbounded_Queue<TYPE>::enqueue (const TYPE& new_item)");
-
- ACE_Queue_Node<TYPE> *temp = new ACE_Queue_Node<TYPE> (new_item, 0);
-
- if (temp == 0)
- return -1;
-
- if (this->head_ == 0)
- this->head_ = this->tail_ = temp;
- else
- {
- this->tail_->next_ = temp;
- this->tail_ = temp;
- }
-
- ++this->cur_size_;
-
- return 0;
-}
-
-template <class TYPE> int
-ACE_Unbounded_Queue<TYPE>::peek (TYPE &item) const
-{
- ACE_TRACE ("ACE_Unbounded_Queue<TYPE>::peek (TYPE *&item)");
-
- if (this->head_ == 0)
- return -1;
-
- item = this->head_->item_;
- return 0;
-}
-
-template <class TYPE> TYPE *
-ACE_Unbounded_Queue<TYPE>::peek (const u_int index) const
-{
- ACE_TRACE ("ACE_Unbounded_Queue<TYPE>::peek (const u_int index)");
-
- ACE_Queue_Node<TYPE> *temp = head_;
- for (u_int i = 0; temp != 0 && i < index; temp = temp->next_, ++i)
- /* null */;
-
- return temp == 0 ? 0 : &temp->item_;
-}
-
-template <class TYPE> int
-ACE_Unbounded_Queue<TYPE>::dequeue (TYPE &item)
-{
- ACE_TRACE ("ACE_Unbounded_Queue<TYPE>::dequeue (TYPE *&item)");
-
- if (this->head_ == 0)
- return -1;
-
- item = this->head_->item_;
- ACE_Queue_Node<TYPE> *temp = this->head_;
- this->head_ = this->head_->next_;
- delete temp;
- --this->cur_size_;
- return 0;
-}
-
-#endif /* ACE_STACK_C */
diff --git a/ace/Stack.h b/ace/Stack.h
deleted file mode 100644
index aa888fcae80..00000000000
--- a/ace/Stack.h
+++ /dev/null
@@ -1,291 +0,0 @@
-/* -*- C++ -*- */
-// $Id$
-
-// ============================================================================
-//
-// = LIBRARY
-// ace
-//
-// = FILENAME
-// Stack.h
-//
-// = AUTHOR
-// Doug Schmidt
-//
-// ============================================================================
-
-#if !defined (ACE_STACK_H)
-#define ACE_STACK_H
-
-#include "ace/ACE.h"
-
-template <class T>
-class ACE_Bounded_Stack
- // = TITLE
- // Implement a generic LIFO abstract data type.
- //
- // = DESCRIPTION
- // This implementation of a Stack uses a bounded array
- // that is allocated dynamically.
-{
-public:
- // = Initialization, assignemnt, and termination methods.
- ACE_Bounded_Stack (size_t size);
- // Initialize a new stack so that it is empty.
-
- ACE_Bounded_Stack (const ACE_Bounded_Stack<T> &s);
- // The copy constructor (performs initialization).
-
- void operator= (const ACE_Bounded_Stack<T> &s);
- // Assignment operator (performs assignment).
-
- ~ACE_Bounded_Stack (void);
- // Perform actions needed when stack goes out of scope.
-
- // = Classic Stack operations.
-
- void push (const T &new_item);
- // Place a new item on top of the stack. Does not check if the
- // stack is full.
-
- void pop (T &item);
- // Remove and return the top stack item. Does not check if stack
- // is full.
-
- void top (T &item) const;
- // Return top stack item without removing it. Does not check if
- // stack is empty.
-
- // = Check boundary conditions for Stack operations.
-
- int is_empty (void) const;
- // Returns 1 if the stack is empty, otherwise returns 0.
-
- int is_full (void) const;
- // Returns 1 if the stack is full, otherwise returns 0.
-
- void dump (void) const;
- // Dump the state of an object.
-
- ACE_ALLOC_HOOK_DECLARE;
- // Declare the dynamic allocation hooks.
-
-private:
- size_t size_;
- // Size of the dynamically allocated data.
-
- size_t top_;
- // Keeps track of the current top of stack.
-
- T *stack_;
- // Holds the stack's contents.
-};
-
-//----------------------------------------
-
-template <class T, size_t SIZE>
-class ACE_Fixed_Stack
- // = TITLE
- // Implement a generic LIFO abstract data type.
- //
- // = DESCRIPTION
- // This implementation of a Stack uses a fixed array
- // with the size fixed at instantiation time.
-{
-public:
- // = Initialization, assignemnt, and termination methods.
- ACE_Fixed_Stack (void);
- // Initialize a new stack so that it is empty.
-
- ACE_Fixed_Stack (const ACE_Fixed_Stack<T, SIZE> &s);
- // The copy constructor (performs initialization).
-
- void operator= (const ACE_Fixed_Stack<T, SIZE> &s);
- // Assignment operator (performs assignment).
-
- ~ACE_Fixed_Stack (void);
- // Perform actions needed when stack goes out of scope.
-
- // = Classic Stack operations.
-
- void push (const T &new_item);
- // Place a new item on top of the stack. Does not check if the
- // stack is full.
-
- void pop (T &item);
- // Remove and return the top stack item. Does not check if stack
- // is full.
-
- void top (T &item) const;
- // Return top stack item without removing it. Does not check if
- // stack is empty.
-
- // = Check boundary conditions for Stack operations.
-
- int is_empty (void) const;
- // Returns 1 if the stack is empty, otherwise returns 0.
-
- int is_full (void) const;
- // Returns 1 if the stack is full, otherwise returns 0.
-
- void dump (void) const;
- // Dump the state of an object.
-
- ACE_ALLOC_HOOK_DECLARE;
- // Declare the dynamic allocation hooks.
-
-private:
- size_t size_;
- // Size of the dynamically allocated data.
-
- size_t top_;
- // Keeps track of the current top of stack.
-
- T stack_[SIZE];
- // Holds the stack's contents.
-};
-
-//----------------------------------------
-
-// Forward declaration (use the "Cheshire Cat" approach to information
-// hiding).
-template <class T>
-class ACE_Stack_Node;
-
-template <class T>
-class ACE_Unbounded_Stack
- // = TITLE
- // Implement a generic LIFO abstract data type.
- //
- // = DESCRIPTION
- // This implementation of an unbounded Stack uses a linked list.
-{
-public:
- // = Initialization, assignemnt, and termination methods.
- ACE_Unbounded_Stack (void);
- // Initialize a new stack so that it is empty.
-
- ACE_Unbounded_Stack (const ACE_Unbounded_Stack<T> &s);
- // The copy constructor (performs initialization).
-
- void operator= (const ACE_Unbounded_Stack<T> &s);
- // Assignment operator (performs assignment).
-
- ~ACE_Unbounded_Stack (void);
- // Perform actions needed when stack goes out of scope.
-
- // = Classic Stack operations.
-
- void push (const T &new_item);
- // Place a new item on top of the stack. Does not check if the
- // stack is full.
-
- void pop (T &item);
- // Remove and return the top stack item. Does not check if stack
- // is full.
-
- void top (T &item) const;
- // Return top stack item without removing it. Does not check if
- // stack is empty.
-
- // = Check boundary conditions for Stack operations.
-
- int is_empty (void) const;
- // Returns 1 if the stack is empty, otherwise returns 0.
-
- int is_full (void) const;
- // Returns 1 if the stack is full, otherwise returns 0.
-
- static void delete_free_list (void);
- // Returns all dynamic memory on the free list to the free store.
-
- void dump (void) const;
- // Dump the state of an object.
-
- ACE_ALLOC_HOOK_DECLARE;
- // Declare the dynamic allocation hooks.
-
-private:
- void delete_all_nodes (void);
- // Delete all the nodes in the stack.
-
- void copy_all_nodes (const ACE_Unbounded_Stack<T> &s);
- // Copy all nodes from <s> to <this>.
-
- ACE_Stack_Node<T> *head_;
- // Head of the linked list of Nodes.
-
- ACE_Stack_Node<T> *last_resort_;
- // Use this node when all memory is exhausted...
-};
-
-// Forward declaration (use the "Cheshire Cat" approach to information
-// hiding).
-template <class T>
-class ACE_Queue_Node;
-
-template <class TYPE>
-class ACE_Unbounded_Queue
- // = TITLE
- // A Queue of "infinite" length.
-
- // = DESCRIPTION
- // Implemented using dynamic memory...
-{
-public:
- ACE_Unbounded_Queue (void);
- // construction.
-
- ~ACE_Unbounded_Queue (void);
- // construction.
-
- int enqueue (const TYPE &new_item);
- // Addes <new_item> to the queue. Returns 0 on success, -1 on failure.
-
- int dequeue (TYPE &item);
- // Removes and returns the first <item> on the queue. Returns 0 on
- // success, -1 if nothing was found.
-
- int peek (TYPE &item) const;
- // Returns the first <item> on the queue without removing it.
- // Returns 0 on success, -1 if nothing was found.
-
- TYPE *peek (const u_int index = 0) const;
- // Returns a pointer to the item indicated by index without removing it,
- // or 0 if nothing was found because index is greater than the number of
- // enqueued items, less one. An index of 0 indicates the first item, and
- // so on.
-
- size_t size (void) const;
- // The number of items in the queue.
-
- void dump (void) const;
- // Dump the state of an object.
-
- ACE_ALLOC_HOOK_DECLARE;
- // Declare the dynamic allocation hooks.
-
-protected:
- ACE_Queue_Node<TYPE> *head_;
- // Head of the Queue.
-
- ACE_Queue_Node<TYPE> *tail_;
- // Tail of the Queue.
-
- size_t cur_size_;
- // Current size of the queue.
-};
-
-#if defined (__ACE_INLINE__)
-#include "ace/Stack.i"
-#endif /* __ACE_INLINE__ */
-
-#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
-#include "ace/Stack.cpp"
-#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */
-
-#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
-#pragma implementation ("Stack.cpp")
-#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */
-
-#endif /* ACE_STACK_H */
diff --git a/ace/Timer_Heap_T.h b/ace/Timer_Heap_T.h
index 4c7a7a3be1f..45fb7e26b19 100644
--- a/ace/Timer_Heap_T.h
+++ b/ace/Timer_Heap_T.h
@@ -18,7 +18,7 @@
#define ACE_TIMER_HEAP_T_H
#include "ace/Timer_Queue.h"
-#include "ace/Set.h"
+#include "ace/Containers.h"
// Forward declaration
template <class TYPE, class FUNCTOR>
diff --git a/ace/Timer_Queue.cpp b/ace/Timer_Queue.cpp
index 3a05a599f69..5a3033170ad 100644
--- a/ace/Timer_Queue.cpp
+++ b/ace/Timer_Queue.cpp
@@ -37,7 +37,7 @@ ACE_Event_Handler_Handle_Timeout_Upcall::operator () (TIMER_QUEUE &timer_queue,
#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
template class ACE_Unbounded_Set<ACE_Timer_Node_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall> *>;
-template class ACE_Set_Node<ACE_Timer_Node_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall> *>;
+template class ACE_Node<ACE_Timer_Node_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall> *>;
template class ACE_Unbounded_Set_Iterator<ACE_Timer_Node_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall> *>;
template class ACE_Timer_Heap_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall>;
template class ACE_Timer_Heap_Iterator_T<ACE_Event_Handler *, ACE_Event_Handler_Handle_Timeout_Upcall>;
diff --git a/apps/Gateway/Gateway/Consumer_Dispatch_Set.h b/apps/Gateway/Gateway/Consumer_Dispatch_Set.h
index 71e2046b56e..5ff672679c2 100644
--- a/apps/Gateway/Gateway/Consumer_Dispatch_Set.h
+++ b/apps/Gateway/Gateway/Consumer_Dispatch_Set.h
@@ -17,7 +17,7 @@
#if !defined (_DISPATCH_SET)
#define _DISPATCH_SET
-#include "ace/Set.h"
+#include "ace/Containers.h"
// Forward reference.
class Proxy_Handler;
diff --git a/apps/Gateway/Gateway/Gateway.cpp b/apps/Gateway/Gateway/Gateway.cpp
index 872366eee93..f6746794dda 100644
--- a/apps/Gateway/Gateway/Gateway.cpp
+++ b/apps/Gateway/Gateway/Gateway.cpp
@@ -367,6 +367,6 @@ Gateway::parse_consumer_config_file (void)
ACE_SVC_FACTORY_DEFINE (Gateway)
#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
-template class ACE_Set_Node<Proxy_Handler *>;
+template class ACE_Node<Proxy_Handler *>;
template class ACE_Unbounded_Set<Proxy_Handler *>;
#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
diff --git a/examples/ASX/Event_Server/Transceiver/transceiver.cpp b/examples/ASX/Event_Server/Transceiver/transceiver.cpp
index 4c9a16abaf0..d86e4ee2d9a 100644
--- a/examples/ASX/Event_Server/Transceiver/transceiver.cpp
+++ b/examples/ASX/Event_Server/Transceiver/transceiver.cpp
@@ -67,6 +67,7 @@ class Event_Transceiver : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH
// it is a ``transceiver.''
{
public:
+ // = Initialization method.
Event_Transceiver (void);
// = Svc_Handler hook called by the <ACE_Connector>.
@@ -99,12 +100,12 @@ Event_Transceiver::handle_close (ACE_HANDLE,
return 0;
}
-// Close down via SIGINT.
+// Close down via SIGINT or SIGQUIT.
int
Event_Transceiver::handle_signal (int signum,
- siginfo_t *,
- ucontext_t *)
+ siginfo_t *,
+ ucontext_t *)
{
ACE_DEBUG ((LM_DEBUG, "(%P|%t) received signal %S\n", signum));
@@ -117,24 +118,37 @@ Event_Transceiver::Event_Transceiver (void)
ACE_Sig_Set sig_set;
sig_set.sig_add (SIGINT);
+
+#if !defined (ACE_WIN32)
sig_set.sig_add (SIGQUIT);
+#endif /* ACE_WIN32 */
if (ACE_Service_Config::reactor ()->register_handler
(sig_set, this) == -1)
ACE_ERROR ((LM_ERROR, "%p\n", "register_handler"));
+
+ // We need to register <this> here before we're connected since
+ // otherwise <get_handle> will return the connection socket handle
+ // for the peer.
+ else if (ACE::register_stdin_handler (this,
+ ACE_Service_Config::reactor (),
+ ACE_Service_Config::thr_mgr ()) == -1)
+ ACE_ERROR ((LM_ERROR,
+ "%p\n",
+ "register_stdin_handler"));
}
int
Event_Transceiver::open (void *)
{
+ // Register ourselves to be notified when there's data on the
+ // socket.
if (ACE_Service_Config::reactor ()->register_handler
- (this->peer ().get_handle (), this,
- ACE_Event_Handler::READ_MASK) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "register_handler"), -1);
- else if (ACE::register_stdin_handler (this,
- ACE_Service_Config::reactor (),
- ACE_Service_Config::thr_mgr ()) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "register_stdin_handler"), -1);
+ (this, ACE_Event_Handler::READ_MASK) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "register_handler"),
+ -1);
return 0;
}
@@ -192,11 +206,13 @@ main (int argc, char *argv[])
parse_args (argc, argv);
- // Establish the connection.
ACE_Connector<Event_Transceiver, ACE_SOCK_CONNECTOR> connector;
Event_Transceiver transceiver, *tp = &transceiver;
- if (connector.connect (tp, ACE_INET_Addr (port_number, host_name)) == -1)
+ ACE_INET_Addr server_addr (port_number, host_name);
+
+ // Establish the connection to the Event Server.
+ if (connector.connect (tp, server_addr) == -1)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", host_name), 1);
// Run event loop until either the event server shuts down or we get
diff --git a/examples/Misc/test_set.cpp b/examples/Misc/test_set.cpp
index d6ff912e604..e43d96bab82 100644
--- a/examples/Misc/test_set.cpp
+++ b/examples/Misc/test_set.cpp
@@ -1,60 +1,12 @@
// $Id$
-#include "ace/Set.h"
+#include "ace/Containers.h"
int
main (int, char *[])
{
- ACE_Unbounded_Set<int> s1;
-
- ACE_ASSERT (s1.size () == 0);
- s1.insert_tail (10);
- s1.insert_tail (20);
- ACE_ASSERT (s1.size () == 2);
-
- ACE_Unbounded_Set<int> s2 (s1);
- ACE_ASSERT (s2.size () == 2);
-
- ACE_Unbounded_Set<int> s3;
- ACE_ASSERT (s3.size () == 0);
-
- s3 = s2;
- ACE_ASSERT (s3.size () == s2.size ());
-
- ACE_Unbounded_Set<int> s4 (s3);
- ACE_ASSERT (s4.size () == 2);
-
- int *ip = 0;
-
- ACE_DEBUG ((LM_DEBUG, "dumping s1\n"));
- for (ACE_Unbounded_Set_Iterator<int> iter1 (s1);
- iter1.next (ip) != 0;
- iter1.advance ())
- ACE_DEBUG ((LM_DEBUG, "item = %d\n", *ip));
-
- ACE_DEBUG ((LM_DEBUG, "dumping s2\n"));
- for (ACE_Unbounded_Set_Iterator<int> iter2 (s2);
- iter2.next (ip) != 0;
- iter2.advance ())
- ACE_DEBUG ((LM_DEBUG, "item = %d\n", *ip));
-
- ACE_DEBUG ((LM_DEBUG, "dumping s3\n"));
- for (ACE_Unbounded_Set_Iterator<int> iter3 (s3);
- iter3.next (ip) != 0;
- iter3.advance ())
- ACE_DEBUG ((LM_DEBUG, "item = %d\n", *ip));
-
- ACE_DEBUG ((LM_DEBUG, "dumping s4\n"));
- for (ACE_Unbounded_Set_Iterator<int> iter4 (s4);
- iter4.next (ip) != 0;
- iter4.advance ())
- ACE_DEBUG ((LM_DEBUG, "item = %d\n", *ip));
-
return 0;
}
#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
-template class ACE_Unbounded_Set<int>;
-template class ACE_Unbounded_Set_Iterator<int>;
-template class ACE_Set_Node<int>;
#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */
diff --git a/netsvcs/lib/Name_Handler.cpp b/netsvcs/lib/Name_Handler.cpp
index e1904e53375..bfebddaf8b9 100644
--- a/netsvcs/lib/Name_Handler.cpp
+++ b/netsvcs/lib/Name_Handler.cpp
@@ -2,7 +2,7 @@
// $Id$
#define ACE_BUILD_SVC_DLL
-#include "ace/Set.h"
+#include "ace/Containers.h"
#include "ace/Get_Opt.h"
#include "Name_Handler.h"
diff --git a/netsvcs/lib/TS_Clerk_Handler.cpp b/netsvcs/lib/TS_Clerk_Handler.cpp
index a526b49324d..b7122e0f931 100644
--- a/netsvcs/lib/TS_Clerk_Handler.cpp
+++ b/netsvcs/lib/TS_Clerk_Handler.cpp
@@ -596,7 +596,7 @@ ACE_SVC_FACTORY_DEFINE (ACE_TS_Clerk_Processor)
#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION)
template class ACE_Connector<ACE_TS_Clerk_Handler, ACE_SOCK_CONNECTOR>;
-template class ACE_Set_Node<ACE_TS_Clerk_Handler *>;
+template class ACE_Node<ACE_TS_Clerk_Handler *>;
template class ACE_Svc_Tuple<ACE_TS_Clerk_Handler>;
template class ACE_Unbounded_Set<ACE_TS_Clerk_Handler *>;
template class ACE_Unbounded_Set_Iterator<ACE_TS_Clerk_Handler *>;
diff --git a/netsvcs/lib/TS_Server_Handler.cpp b/netsvcs/lib/TS_Server_Handler.cpp
index a8ff6c99ab6..3df08b7551c 100644
--- a/netsvcs/lib/TS_Server_Handler.cpp
+++ b/netsvcs/lib/TS_Server_Handler.cpp
@@ -3,7 +3,7 @@
#define ACE_BUILD_SVC_DLL
#include "ace/SString.h"
-#include "ace/Set.h"
+#include "ace/Containers.h"
#include "ace/Get_Opt.h"
#include "TS_Server_Handler.h"