From 88be07cd84fcbc1f5bf883e72c05adfce8e38bb1 Mon Sep 17 00:00:00 2001 From: irfan Date: Sat, 9 Nov 1996 11:36:13 +0000 Subject: New Iterators added --- ace/Map_Manager.h | 46 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) (limited to 'ace/Map_Manager.h') diff --git a/ace/Map_Manager.h b/ace/Map_Manager.h index 74f142ffcef..4f089ade988 100644 --- a/ace/Map_Manager.h +++ b/ace/Map_Manager.h @@ -48,6 +48,10 @@ struct ACE_Map_Entry template class ACE_Map_Iterator; +// Forward decl. +template +class ACE_Map_Reverse_Iterator; + template class ACE_Map_Manager // = TITLE @@ -62,7 +66,14 @@ class ACE_Map_Manager // ACE_Allocator with a persistable memory pool { friend class ACE_Map_Iterator; +friend class ACE_Map_Reverse_Iterator; public: + + typedef ACE_Map_Entry ENTRY; + typedef ACE_Map_Iterator ITERATOR; + typedef ACE_Map_Reverse_Iterator REVERSE_ITERATOR; + // Traits + enum {DEFAULT_SIZE = ACE_DEFAULT_MAP_SIZE}; // = Initialization and termination methods. @@ -218,7 +229,6 @@ class ACE_Map_Iterator // Iterator for the ACE_Map_Manager. // // = DESCRIPTION - // Allows deletions while iteration is occurring. { public: // = Initialization method. @@ -247,6 +257,40 @@ private: // Keeps track of how far we've advanced... }; +template +class ACE_Map_Reverse_Iterator + // = TITLE + // Reverse Iterator for the ACE_Map_Manager. + // + // = DESCRIPTION +{ +public: + // = Initialization method. + ACE_Map_Reverse_Iterator (ACE_Map_Manager &mm); + + // = Iteration methods. + + int next (ACE_Map_Entry *&next_entry); + // Pass back the 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. + + void dump (void) const; + // Dump the state of an object. + + ACE_ALLOC_HOOK_DECLARE; + // Declare the dynamic allocation hooks. + +private: + ACE_Map_Manager &map_man_; + // Map we are iterating over. + + ssize_t next_; + // Keeps track of how far we've advanced... +}; + #if defined (__ACE_INLINE__) #include "ace/Map_Manager.i" #endif /* __ACE_INLINE__ */ -- cgit v1.2.1