From 4431abaf7ef04ac4a2a2f20dc45e6c04be9d3eec Mon Sep 17 00:00:00 2001 From: bala Date: Mon, 13 Sep 2004 19:58:40 +0000 Subject: ChangelogTag:Mon Sep 13 14:56:53 2004 Balachandran Natarajan --- ChangeLog | 9 +++++++++ ace/RB_Tree.cpp | 14 ++++++++++++++ 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 + + * 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 * 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::ACE_RB_Tree (const ACE_RB_T *(iter.item ())); } +template +ACE_RB_Tree::ACE_RB_Tree ( + void *location, + ACE_Allocator *alloc +) +{ + if (location != this) + { + this->root_ = 0; + this->current_size_ = 0; + } + + this->allocator_ = alloc; +} // Destructor. template 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 &rbt); @@ -361,10 +362,10 @@ public: size_t current_size (void) const; /// Assignment operator. - void operator= (const ACE_RB_Tree &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 &rbt); /** * Returns a reference to the underlying . 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 &node) const; + /// Less than comparison function for keys, using comparison functor. + int lessthan (const EXT_ID &k1, const EXT_ID &k2); + private: // = Private members. -- cgit v1.2.1