summaryrefslogtreecommitdiff
path: root/ace/Map_Manager.h
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1996-11-09 11:36:13 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1996-11-09 11:36:13 +0000
commit88be07cd84fcbc1f5bf883e72c05adfce8e38bb1 (patch)
tree5c398cc65226410314216a7cb6cd91b06e940b25 /ace/Map_Manager.h
parentc77fe2a741f053e57cb418f2cc6f3b26e8ac24b1 (diff)
downloadATCD-88be07cd84fcbc1f5bf883e72c05adfce8e38bb1.tar.gz
New Iterators added
Diffstat (limited to 'ace/Map_Manager.h')
-rw-r--r--ace/Map_Manager.h46
1 files changed, 45 insertions, 1 deletions
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 EXT_ID, class INT_ID, class LOCK>
class ACE_Map_Iterator;
+// Forward decl.
+template <class EXT_ID, class INT_ID, class LOCK>
+class ACE_Map_Reverse_Iterator;
+
template <class EXT_ID, class INT_ID, class LOCK>
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<EXT_ID, INT_ID, LOCK>;
+friend class ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, LOCK>;
public:
+
+ typedef ACE_Map_Entry<EXT_ID, INT_ID> ENTRY;
+ typedef ACE_Map_Iterator<EXT_ID, INT_ID, LOCK> ITERATOR;
+ typedef ACE_Map_Reverse_Iterator<EXT_ID, INT_ID, LOCK> 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 EXT_ID, class INT_ID, class LOCK>
+class ACE_Map_Reverse_Iterator
+ // = TITLE
+ // Reverse Iterator for the ACE_Map_Manager.
+ //
+ // = DESCRIPTION
+{
+public:
+ // = Initialization method.
+ ACE_Map_Reverse_Iterator (ACE_Map_Manager <EXT_ID, INT_ID, LOCK> &mm);
+
+ // = Iteration methods.
+
+ int next (ACE_Map_Entry<EXT_ID, INT_ID> *&next_entry);
+ // Pass back the <entry> 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 <EXT_ID, INT_ID, LOCK> &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__ */