diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-07-26 23:52:20 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-07-26 23:52:20 +0000 |
commit | dcfd08cc4932d375f5023563455aebd18b6721ed (patch) | |
tree | 130a815d434f3a89ca4b9d3673ddc30e87ac8116 | |
parent | c5df753cfa71ad76a6e042362662f03148158f8a (diff) | |
download | ATCD-dcfd08cc4932d375f5023563455aebd18b6721ed.tar.gz |
ChangeLogTag:Thu Jul 26 16:50:54 2001 Carlos O'Ryan <coryan@uci.edu>
-rw-r--r-- | ChangeLog | 58 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-02a | 58 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 58 | ||||
-rw-r--r-- | ace/Intrusive_List.cpp | 103 | ||||
-rw-r--r-- | ace/Intrusive_List.h | 119 | ||||
-rw-r--r-- | ace/Intrusive_List.inl | 7 | ||||
-rw-r--r-- | ace/Intrusive_List_Node.cpp | 25 | ||||
-rw-r--r-- | ace/Intrusive_List_Node.h | 81 | ||||
-rw-r--r-- | ace/Intrusive_List_Node.inl | 25 | ||||
-rw-r--r-- | ace/Makefile | 2 | ||||
-rw-r--r-- | ace/Makefile.am | 6 | ||||
-rw-r--r-- | ace/Makefile.bor | 2 |
12 files changed, 484 insertions, 60 deletions
diff --git a/ChangeLog b/ChangeLog index 18db2ed14c8..9b6f180caf1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +Thu Jul 26 16:50:54 2001 Carlos O'Ryan <coryan@uci.edu> + + * ace/Makefile: + * ace/Makefile.am: + * ace/Makefile.bor: + * ace/Intrusive_List.h: + * ace/Intrusive_List.inl: + * ace/Intrusive_List.cpp: + Add new template to implement intrusive lists, i.e. lists that + assume their elements implement the next() and prev() methods. + + * ace/Intrusive_List_Node.h: + * ace/Intrusive_List_Node.inl: + * ace/Intrusive_List_Node.cpp: + Helper class to add the requirements of ACE_Intrusive_List to + any other class, simply do: + class Foo : public ACE_Intrusive_List_Node<Foo> + Wed Jul 25 23:49:43 2001 Krishnakumar B <kitty@cs.wustl.edu> * include/makeinclude/platform_tru64_g++.GNU: @@ -16,35 +34,35 @@ Wed Jul 25 23:49:00 2001 Craig Rodrigues <crodrigu@bbn.com> Wed Jul 25 18:53:18 2001 Ossama Othman <ossama@uci.edu> - * html/index.html: + * html/index.html: - Added CORBA Security Service main page link to the list of - documentation. + Added CORBA Security Service main page link to the list of + documentation. Wed Jul 25 17:41:43 2001 Ossama Othman <ossama@uci.edu> - * ltcf-c.sh: - * ltcf-cxx.sh: - * ltconfig: + * ltcf-c.sh: + * ltcf-cxx.sh: + * ltconfig: - Removed these libtool related files. New versions of libtool - (GNU libtool >= 1.4b) no longer use them. + Removed these libtool related files. New versions of libtool + (GNU libtool >= 1.4b) no longer use them. - * config.guess: - * config.sub: - * ltmain.sh: + * config.guess: + * config.sub: + * ltmain.sh: - Removed these files. We no longer need to keep custom copies - lieing around since libtool 1.4b includes all of our local - changes (i.e. our changes have been folded into the upstream - libtool sources). + Removed these files. We no longer need to keep custom copies + lieing around since libtool 1.4b includes all of our local + changes (i.e. our changes have been folded into the upstream + libtool sources). - * install-sh: - * missing: - * mkinstalldirs: + * install-sh: + * missing: + * mkinstalldirs: - Removed these files. Automake will automatically add these when - necessary. + Removed these files. Automake will automatically add these when + necessary. Wed Jul 25 16:29:48 2001 Steve Huston <shuston@riverace.com> diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index 18db2ed14c8..9b6f180caf1 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,3 +1,21 @@ +Thu Jul 26 16:50:54 2001 Carlos O'Ryan <coryan@uci.edu> + + * ace/Makefile: + * ace/Makefile.am: + * ace/Makefile.bor: + * ace/Intrusive_List.h: + * ace/Intrusive_List.inl: + * ace/Intrusive_List.cpp: + Add new template to implement intrusive lists, i.e. lists that + assume their elements implement the next() and prev() methods. + + * ace/Intrusive_List_Node.h: + * ace/Intrusive_List_Node.inl: + * ace/Intrusive_List_Node.cpp: + Helper class to add the requirements of ACE_Intrusive_List to + any other class, simply do: + class Foo : public ACE_Intrusive_List_Node<Foo> + Wed Jul 25 23:49:43 2001 Krishnakumar B <kitty@cs.wustl.edu> * include/makeinclude/platform_tru64_g++.GNU: @@ -16,35 +34,35 @@ Wed Jul 25 23:49:00 2001 Craig Rodrigues <crodrigu@bbn.com> Wed Jul 25 18:53:18 2001 Ossama Othman <ossama@uci.edu> - * html/index.html: + * html/index.html: - Added CORBA Security Service main page link to the list of - documentation. + Added CORBA Security Service main page link to the list of + documentation. Wed Jul 25 17:41:43 2001 Ossama Othman <ossama@uci.edu> - * ltcf-c.sh: - * ltcf-cxx.sh: - * ltconfig: + * ltcf-c.sh: + * ltcf-cxx.sh: + * ltconfig: - Removed these libtool related files. New versions of libtool - (GNU libtool >= 1.4b) no longer use them. + Removed these libtool related files. New versions of libtool + (GNU libtool >= 1.4b) no longer use them. - * config.guess: - * config.sub: - * ltmain.sh: + * config.guess: + * config.sub: + * ltmain.sh: - Removed these files. We no longer need to keep custom copies - lieing around since libtool 1.4b includes all of our local - changes (i.e. our changes have been folded into the upstream - libtool sources). + Removed these files. We no longer need to keep custom copies + lieing around since libtool 1.4b includes all of our local + changes (i.e. our changes have been folded into the upstream + libtool sources). - * install-sh: - * missing: - * mkinstalldirs: + * install-sh: + * missing: + * mkinstalldirs: - Removed these files. Automake will automatically add these when - necessary. + Removed these files. Automake will automatically add these when + necessary. Wed Jul 25 16:29:48 2001 Steve Huston <shuston@riverace.com> diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index 18db2ed14c8..9b6f180caf1 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,21 @@ +Thu Jul 26 16:50:54 2001 Carlos O'Ryan <coryan@uci.edu> + + * ace/Makefile: + * ace/Makefile.am: + * ace/Makefile.bor: + * ace/Intrusive_List.h: + * ace/Intrusive_List.inl: + * ace/Intrusive_List.cpp: + Add new template to implement intrusive lists, i.e. lists that + assume their elements implement the next() and prev() methods. + + * ace/Intrusive_List_Node.h: + * ace/Intrusive_List_Node.inl: + * ace/Intrusive_List_Node.cpp: + Helper class to add the requirements of ACE_Intrusive_List to + any other class, simply do: + class Foo : public ACE_Intrusive_List_Node<Foo> + Wed Jul 25 23:49:43 2001 Krishnakumar B <kitty@cs.wustl.edu> * include/makeinclude/platform_tru64_g++.GNU: @@ -16,35 +34,35 @@ Wed Jul 25 23:49:00 2001 Craig Rodrigues <crodrigu@bbn.com> Wed Jul 25 18:53:18 2001 Ossama Othman <ossama@uci.edu> - * html/index.html: + * html/index.html: - Added CORBA Security Service main page link to the list of - documentation. + Added CORBA Security Service main page link to the list of + documentation. Wed Jul 25 17:41:43 2001 Ossama Othman <ossama@uci.edu> - * ltcf-c.sh: - * ltcf-cxx.sh: - * ltconfig: + * ltcf-c.sh: + * ltcf-cxx.sh: + * ltconfig: - Removed these libtool related files. New versions of libtool - (GNU libtool >= 1.4b) no longer use them. + Removed these libtool related files. New versions of libtool + (GNU libtool >= 1.4b) no longer use them. - * config.guess: - * config.sub: - * ltmain.sh: + * config.guess: + * config.sub: + * ltmain.sh: - Removed these files. We no longer need to keep custom copies - lieing around since libtool 1.4b includes all of our local - changes (i.e. our changes have been folded into the upstream - libtool sources). + Removed these files. We no longer need to keep custom copies + lieing around since libtool 1.4b includes all of our local + changes (i.e. our changes have been folded into the upstream + libtool sources). - * install-sh: - * missing: - * mkinstalldirs: + * install-sh: + * missing: + * mkinstalldirs: - Removed these files. Automake will automatically add these when - necessary. + Removed these files. Automake will automatically add these when + necessary. Wed Jul 25 16:29:48 2001 Steve Huston <shuston@riverace.com> diff --git a/ace/Intrusive_List.cpp b/ace/Intrusive_List.cpp new file mode 100644 index 00000000000..bf208d01130 --- /dev/null +++ b/ace/Intrusive_List.cpp @@ -0,0 +1,103 @@ +// $Id$ + +#ifndef ACE_INTRUSIVE_LIST_C +#define ACE_INTRUSIVE_LIST_C + +#include "ace/Intrusive_List.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (__ACE_INLINE__) +#include "ace/Intrusive_List.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, Intrusive_List, "$Id$") + +template <class T> +ACE_Intrusive_List<T>::ACE_Intrusive_List (void) + : head_ (0) + , tail_ (0) +{ +} + +template<class T> +ACE_Intrusive_List<T>::~ACE_Intrusive_List (void) +{ +} + +template<class T> void +ACE_Intrusive_List<T>::push_back (T *node) +{ + if (this->tail_ == 0) + { + this->tail_ = node; + this->head_ = node; + node->next (0); + node->prev (0); + return; + } + + this->tail_->next (node); + node->prev (this->tail_); + node->next (0); + this->tail_ = node; +} + +template<class T> void +ACE_Intrusive_List<T>::push_front (T *node) +{ + if (this->head_ == 0) + { + this->tail_ = node; + this->head_ = node; + node->next (0); + node->prev (0); + return; + } + + this->head_->prev (node); + node->next (this->head_); + node->prev (0); + this->head_ = node; +} + +template<class T> T * +ACE_Intrusive_List<T>::pop_front (void) +{ + T *node = this->head_; + if (node == 0) + return 0; + this->remove (node); + return node; +} + +template<class T> T * +ACE_Intrusive_List<T>::pop_back (void) +{ + T *node = this->tail_; + if (node == 0) + return 0; + this->remove (node); + return node; +} + +template<class T> void +ACE_Intrusive_List<T>::remove (T *node) +{ + if (node->prev () != 0) + node->prev ()->next (node->next ()); + else + this->head_ = node->next (); + + if (node->next () != 0) + node->next ()->prev (node->prev ()); + else + this->tail_ = node->prev (); + + node->next (0); + node->prev (0); +} + +#endif /* ACE_INTRUSIVE_LIST_C */ diff --git a/ace/Intrusive_List.h b/ace/Intrusive_List.h new file mode 100644 index 00000000000..3520eed2f2a --- /dev/null +++ b/ace/Intrusive_List.h @@ -0,0 +1,119 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Intrusive_List.h + * + * $Id$ + * + * @author Carlos O'Ryan <coryan@uci.edu> + */ +//============================================================================= + +#ifndef ACE_INTRUSIVE_LIST_H +#define ACE_INTRUSIVE_LIST_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +/** + * @class ACE_Intrusive_List + * + * @brief Implement an intrusive double linked list + * + * Intrusive lists assume that the elements they contain the pointers + * required to build the list. They are useful as light-weight + * containers and free-lists. + * + * The template argument T must implement the following methods: + * + * - T* T::next () const; + * - void T::next (T *); + * - T* T::prev () const; + * - void T::prev (T* ); + * + * A simple way to satisfy the Intrusive_List requirements would be to + * implement a helper class: + * + * class My_Object : public ACE_Intrusive_List_Node<My_Object> {<BR> + * ....<BR> + * };<BR> + * + * typedef ACE_Intrusive_List<My_Object> My_Object_List; + * + * However, ACE is supported on platforms that would surely get + * confused using such templates. + * + * @todo The ACE_Message_Queue is an example of an intrusive list (or + * queue) but it is not implemented in terms of this class. + * + */ +template <class T> +class ACE_Intrusive_List +{ +public: + // = Initialization and termination methods. + /// Constructor. Use user specified allocation strategy + /// if specified. + ACE_Intrusive_List (void); + + /// Destructor. + ~ACE_Intrusive_List (void); + + // = Check boundary conditions. + + /// Returns 1 if the container is empty, otherwise returns 0. + int empty (void) const; + + /// Insert an element at the beginning of the list + void push_front (T *node); + + /// Insert an element at the end of the list + void push_back (T *node); + + /// Remove the element at the beginning of the list + T *pop_front (void); + + /// Remove the element at the end of the list + T *pop_back (void); + + /// Remove a element from the list + /** + * No attempts are performed to check if T* really belongs to the + * list. The effects of removing an invalid element are unspecified + */ + void remove (T *node); + +private: + /** @name Disallow copying + * + */ + //@{ + ACE_Intrusive_List (const ACE_Intrusive_List<T> &); + ACE_Intrusive_List<T>& operator= (const ACE_Intrusive_List<T> &); + //@} + +private: + /// Head and tail of the list + T *head_; + T *tail_; +}; + +#if defined (__ACE_INLINE__) +#include "ace/Intrusive_List.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Intrusive_List.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Intrusive_List.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include "ace/post.h" +#endif /* ACE_INTRUSIVE_LIST_H */ diff --git a/ace/Intrusive_List.inl b/ace/Intrusive_List.inl new file mode 100644 index 00000000000..57fc91662d0 --- /dev/null +++ b/ace/Intrusive_List.inl @@ -0,0 +1,7 @@ +// $Id$ + +template<class T> ACE_INLINE int +ACE_Intrusive_List<T>::empty (void) const +{ + return this->head_ == 0; +} diff --git a/ace/Intrusive_List_Node.cpp b/ace/Intrusive_List_Node.cpp new file mode 100644 index 00000000000..58002653d2e --- /dev/null +++ b/ace/Intrusive_List_Node.cpp @@ -0,0 +1,25 @@ +// $Id$ + +#ifndef ACE_INTRUSIVE_LIST_NODE_C +#define ACE_INTRUSIVE_LIST_NODE_C + +#include "ace/Intrusive_List_Node.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (__ACE_INLINE__) +#include "ace/Intrusive_List_Node.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(ace, Intrusive_List_Node, "$Id$") + +template<class T> +ACE_Intrusive_List_Node<T>::ACE_Intrusive_List_Node (void) + : prev_ (0) + , next_ (0) +{ +} + +#endif /* ACE_INTRUSIVE_LIST_NODE_C */ diff --git a/ace/Intrusive_List_Node.h b/ace/Intrusive_List_Node.h new file mode 100644 index 00000000000..b376b3f97d2 --- /dev/null +++ b/ace/Intrusive_List_Node.h @@ -0,0 +1,81 @@ +/* -*- C++ -*- */ + +//============================================================================= +/** + * @file Intrusive_List_Node.h + * + * $Id$ + * + * @author Carlos O'Ryan <coryan@uci.edu> + */ +//============================================================================= + +#ifndef ACE_INTRUSIVE_LIST_NODE_H +#define ACE_INTRUSIVE_LIST_NODE_H +#include "ace/pre.h" + +#include "ace/config-all.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +/** + * @class ACE_Intrusive_List_Node + * + * @brief Implement the requirements for ACE_Intrusive_List + * + * The class should be used as follows: + * + * class My_Object : public ACE_Intrusive_List_Node_Node<My_Object> {<BR> + * ....<BR> + * };<BR> + * + * However, ACE is supported on platforms that would surely get + * confused using such templates, the class is provided as a helper + * for our lucky users that only need portability to modern C++ + * compilers. + * + */ +template <class T> +class ACE_Intrusive_List_Node +{ +public: + /** @name Accesors and modifiers to the next and previous pointers + * + */ + //@{ + T *prev (void) const; + void prev (T *); + T *next (void) const; + void next (T *); + //@} + +protected: + /// Constructor + /** + * The constructor is protected, because only derived classes should + * be instantiated. + */ + ACE_Intrusive_List_Node (void); + +private: + /// Head and tail of the list + T *prev_; + T *next_; +}; + +#if defined (__ACE_INLINE__) +#include "ace/Intrusive_List_Node.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "ace/Intrusive_List_Node.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Intrusive_List_Node.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include "ace/post.h" +#endif /* ACE_INTRUSIVE_LIST_NODE_H */ diff --git a/ace/Intrusive_List_Node.inl b/ace/Intrusive_List_Node.inl new file mode 100644 index 00000000000..e7f2c5ee3eb --- /dev/null +++ b/ace/Intrusive_List_Node.inl @@ -0,0 +1,25 @@ +// $Id$ + +template<class T> ACE_INLINE T* +ACE_Intrusive_List_Node<T>::prev (void) const +{ + return this->prev_; +} + +template<class T> ACE_INLINE void +ACE_Intrusive_List_Node<T>::prev (T *x) +{ + this->prev_ = x; +} + +template<class T> ACE_INLINE T* +ACE_Intrusive_List_Node<T>::next (void) const +{ + return this->next_; +} + +template<class T> ACE_INLINE void +ACE_Intrusive_List_Node<T>::next (T *x) +{ + this->next_ = x; +} diff --git a/ace/Makefile b/ace/Makefile index 84e99420cf3..7eeed6d7c11 100644 --- a/ace/Makefile +++ b/ace/Makefile @@ -263,6 +263,8 @@ TEMPLATE_FILES = \ Hash_Map_With_Allocator_T \ Hash_Cache_Map_Manager_T \ IOStream_T \ + Intrusive_List \ + Intrusive_List_Node \ LOCK_SOCK_Acceptor \ Local_Name_Space_T \ Malloc_T \ diff --git a/ace/Makefile.am b/ace/Makefile.am index 78d4bfd1f7b..21ea41fcd52 100644 --- a/ace/Makefile.am +++ b/ace/Makefile.am @@ -476,6 +476,8 @@ TEMPLATE_FILES = \ Hash_Map_With_Allocator_T.cpp \ Hash_Cache_Map_Manager_T.cpp \ IOStream_T.cpp \ + Intrusive_List.cpp \ + Intrusive_List_Node.cpp \ LOCK_SOCK_Acceptor.cpp \ Local_Name_Space_T.cpp \ Malloc_T.cpp \ @@ -603,6 +605,8 @@ HEADER_FILES = \ IO_SAP.h \ IPC_SAP.h \ Init_ACE.h \ + Intrusive_List.h \ + Intrusive_List_Node.h \ LOCK_SOCK_Acceptor.h \ LSOCK.h \ LSOCK_Acceptor.h \ @@ -869,6 +873,8 @@ INLINE_FILES = \ IO_SAP.i \ IPC_SAP.i \ Init_ACE.i \ + Intrusive_List.inl \ + Intrusive_List_Node.inl \ LSOCK.i \ LSOCK_CODgram.i \ LSOCK_Connector.i \ diff --git a/ace/Makefile.bor b/ace/Makefile.bor index 9275f3a9a25..830ab235cfb 100644 --- a/ace/Makefile.bor +++ b/ace/Makefile.bor @@ -249,6 +249,8 @@ INCLUDES = \ Free_List.cpp \ Future.cpp \ Future_Set.cpp \ + Intrusive_List.cpp \ + Intrusive_List_Node.cpp \ LOCK_SOCK_Acceptor.cpp \ Managed_Object.cpp \ Map_Manager.cpp \ |