From 6eec1060ff709103cd49a76d56d7201f8b44b5c3 Mon Sep 17 00:00:00 2001 From: nw1 Date: Tue, 29 Jul 1997 06:55:25 +0000 Subject: Decouple memory allocation strategy for ACE_Unbounded_Stack, ACE_Unbounded_Set, ACE_Unbounded_Queue. --- ace/Containers.h | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'ace/Containers.h') diff --git a/ace/Containers.h b/ace/Containers.h index cffb7258eac..153163c50d3 100644 --- a/ace/Containers.h +++ b/ace/Containers.h @@ -18,6 +18,7 @@ #define ACE_CONTAINERS_H #include "ace/ACE.h" +#include "ace/Malloc_T.h" template class ACE_Bounded_Stack @@ -206,8 +207,9 @@ class ACE_Unbounded_Stack friend class ACE_Unbounded_Stack_Iterator; public: // = Initialization, assignemnt, and termination methods. - ACE_Unbounded_Stack (void); - // Initialize a new stack so that it is empty. + ACE_Unbounded_Stack (ACE_Allocator *alloc = 0); + // Initialize a new stack so that it is empty. Use user defined + // allocation strategy if specified. ACE_Unbounded_Stack (const ACE_Unbounded_Stack &s); // The copy constructor (performs initialization). @@ -278,6 +280,9 @@ private: size_t cur_size_; // Current size of the stack. + + ACE_Allocator *allocator_; + // Allocation strategy of the stack. }; template @@ -367,8 +372,9 @@ class ACE_Unbounded_Queue friend class ACE_Unbounded_Queue_Iterator; public: // = Initialization and termination methods. - ACE_Unbounded_Queue (void); - // construction. + ACE_Unbounded_Queue (ACE_Allocator *alloc = 0); + // construction. Use user specified allocation strategy + // if specified. ACE_Unbounded_Queue (const ACE_Unbounded_Queue &); // Copy constructor. @@ -437,6 +443,9 @@ protected: size_t cur_size_; // Current size of the queue. + + ACE_Allocator *allocator_; + // Allocation Strategy of the queue. }; template @@ -488,8 +497,9 @@ class ACE_Unbounded_Set friend class ACE_Unbounded_Set_Iterator; public: // = Initialization and termination methods. - ACE_Unbounded_Set (void); - // Constructor. + ACE_Unbounded_Set (ACE_Allocator *alloc = 0); + // Constructor. Use user specified allocation strategy + // if specified. ACE_Unbounded_Set (const ACE_Unbounded_Set &); // Copy constructor. @@ -549,6 +559,9 @@ private: size_t cur_size_; // Current size of the set. + + ACE_Allocator *allocator_; + // Allocation strategy of the set. }; // Forward declaration. -- cgit v1.2.1