diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | ace/RB_Tree.cpp | 14 | ||||
-rw-r--r-- | ace/RB_Tree.h | 20 |
3 files changed, 39 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog index 2d64b336a2c..31e501ca558 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Mon Sep 13 14:56:53 2004 Balachandran Natarajan <bala@dre.vanderbilt.edu> + + * ace/RB_Tree.h (class ACE_RB_Tree): + * ace/RB_Tree.cpp: + + Added a special constructor useful for providing a valid vtable + and allocator if the tree is reconstructed from shared + memory. Thanks to Lothar Werzinger for the patches. + Mon Sep 13 12:49:22 2004 Steve Huston <shuston@riverace.com> * ace/config-aix-4.x.h: Alter the value of ACE_SIZEOF_WCHAR based diff --git a/ace/RB_Tree.cpp b/ace/RB_Tree.cpp index 52f37cbd799..3c903ee8efd 100644 --- a/ace/RB_Tree.cpp +++ b/ace/RB_Tree.cpp @@ -98,6 +98,20 @@ ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tree (const ACE_RB_T *(iter.item ())); } +template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK> +ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK>::ACE_RB_Tree ( + void *location, + ACE_Allocator *alloc +) +{ + if (location != this) + { + this->root_ = 0; + this->current_size_ = 0; + } + + this->allocator_ = alloc; +} // Destructor. template <class EXT_ID, class INT_ID, class COMPARE_KEYS, class ACE_LOCK> diff --git a/ace/RB_Tree.h b/ace/RB_Tree.h index f5e6dc84b12..e2ba71cee94 100644 --- a/ace/RB_Tree.h +++ b/ace/RB_Tree.h @@ -208,6 +208,7 @@ public: /// Constructor. ACE_RB_Tree (ACE_Allocator *alloc = 0); + /// Copy constructor. ACE_RB_Tree (const ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> &rbt); @@ -361,10 +362,10 @@ public: size_t current_size (void) const; /// Assignment operator. - void operator= (const ACE_RB_Tree<EXT_ID, INT_ID, COMPARE_KEYS, ACE_LOCK> &rbt); - - /// Less than comparison function for keys, using comparison functor. - virtual int lessthan (const EXT_ID &k1, const EXT_ID &k2); + void operator= (const ACE_RB_Tree<EXT_ID, + INT_ID, + COMPARE_KEYS, + ACE_LOCK> &rbt); /** * Returns a reference to the underlying <ACE_LOCK>. This makes it @@ -440,6 +441,14 @@ public: void clear (void); protected: + /// Reinitialize constructor. + /** + * This constructor is used to provide a valid vtable and allocator + * if the tree is reconstructed from shared memory. Constructor + * used by the derived class that has an allocator + */ + ACE_RB_Tree (void *location, + ACE_Allocator *alloc); // = Protected methods. These should only be called with locks held. @@ -549,6 +558,9 @@ protected: /// provide definitions for various EXT_ID and INT_ID types. void dump_node_i (ACE_RB_Tree_Node<EXT_ID, INT_ID> &node) const; + /// Less than comparison function for keys, using comparison functor. + int lessthan (const EXT_ID &k1, const EXT_ID &k2); + private: // = Private members. |