[Lemon-commits] [lemon_svn] deba: r1118 - hugo/trunk/src/hugo

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:43:21 CET 2006


Author: deba
Date: Wed Sep  8 14:06:45 2004
New Revision: 1118

Added:
   hugo/trunk/src/hugo/array_map.h
      - copied, changed from r1113, /hugo/trunk/src/hugo/array_map_factory.h
   hugo/trunk/src/hugo/default_map.h
      - copied, changed from r1113, /hugo/trunk/src/hugo/default_map_factory.h
   hugo/trunk/src/hugo/map_iterator.h
   hugo/trunk/src/hugo/sym_map.h
      - copied, changed from r1113, /hugo/trunk/src/hugo/sym_map_factory.h
   hugo/trunk/src/hugo/vector_map.h
      - copied, changed from r1113, /hugo/trunk/src/hugo/vector_map_factory.h
Removed:
   hugo/trunk/src/hugo/array_map_factory.h
   hugo/trunk/src/hugo/default_map_factory.h
   hugo/trunk/src/hugo/vector_map_factory.h
Modified:
   hugo/trunk/src/hugo/full_graph.h
   hugo/trunk/src/hugo/list_graph.h
   hugo/trunk/src/hugo/map_defines.h
   hugo/trunk/src/hugo/map_registry.h
   hugo/trunk/src/hugo/smart_graph.h

Log:
The MapFactories have been removed from the code because
if we use macros then they increases only the complexity.

The pair iterators of the maps are separeted from the maps.

Some macros and comments has been changed.



Copied: hugo/trunk/src/hugo/array_map.h (from r1113, /hugo/trunk/src/hugo/array_map_factory.h)
==============================================================================
--- /hugo/trunk/src/hugo/array_map_factory.h	(original)
+++ hugo/trunk/src/hugo/array_map.h	Wed Sep  8 14:06:45 2004
@@ -1,12 +1,12 @@
 // -*- c++ -*-
-#ifndef ARRAY_MAP_FACTORY_H
-#define ARRAY_MAP_FACTORY_H
+#ifndef ARRAY_MAP_H
+#define ARRAY_MAP_H
 
 #include <memory>
 
-#include <hugo/extended_pair.h>
+#include <hugo/map_iterator.h>
 
-///\ingroup graphmapfactory
+///\ingroup graphmaps
 ///\file
 ///\brief Graph maps that construates and destruates
 ///their elements dynamically.
@@ -14,19 +14,20 @@
 namespace hugo {
 
 
-/// \addtogroup graphmapfactory
-/// @{
+  /// \addtogroup graphmaps
+  /// @{
 	
-  /** The ArrayMapFactory template class is a factory class
-   *  to create maps for the edge and nodes. This map factory
-   *  uses the allocators to implement the container function.
+  /** The ArrayMap template class is graph map structure what
+   *  automatically updates the map when a key is added to or erased from
+   *  the map. This map factory uses the allocators to implement 
+   *  the container functionality.
    *
    *  The template parameter is the MapRegistry that the maps
-   *  will belong to.
+   *  will belong to and the ValueType.
    */
 
-  template <typename MapRegistry> 
-  class ArrayMapFactory {
+  template <typename MapRegistry, typename Value> 
+  class ArrayMap : public MapRegistry::MapBase {
 		
   public:
 		
@@ -40,402 +41,242 @@
     /// The MapBase of the Map which imlements the core regisitry function.
     typedef typename MapRegistry::MapBase MapBase;
 		
-    /** The template Map type.
-     */
-    template <typename V, typename A = std::allocator<V> > 
-    class Map : public MapBase {
     
-      public:
-
-      /// The value type of the map.
-      typedef V ValueType;
+  public:
 
-      /// The value type of the map.
-      typedef V Value;
-      /// The reference type of the map;
-      typedef Value& Reference;
-      /// The pointer type of the map;
-      typedef Value* Pointer;
-
-      /// The const value type of the map.
-      typedef const Value ConstValue;
-      /// The const reference type of the map;
-      typedef const Value& ConstReference;
-      /// The pointer type of the map;
-      typedef const Value* ConstPointer;
+    /// The value type of the map.
+    typedef Value ValueType;
+    /// The reference type of the map;
+    typedef Value& ReferenceType;
+    /// The pointer type of the map;
+    typedef Value* PointerType;
+
+    /// The const value type of the map.
+    typedef const Value ConstValueType;
+    /// The const reference type of the map;
+    typedef const Value& ConstReferenceType;
+    /// The pointer type of the map;
+    typedef const Value* ConstPointerType;
 
 
-      typedef A Allocator;
+    typedef std::allocator<Value> Allocator;
 
 	
-      /** Default constructor for the map.
-       */
-      Map() : values(0), capacity(0) {}
+    /** Default constructor for the map.
+     */
+    ArrayMap() : values(0), capacity(0) {}
 			
-      /** Graph and Registry initialized map constructor.
-       */
-      Map(const Graph& g, MapRegistry& r) : MapBase(g, r) {
-	allocate_memory();
-	for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
-	  int id = MapBase::getGraph()->id(it);
-	  allocator.construct(&(values[id]), Value());
-	}								
-      }
+    /** Graph and Registry initialized map constructor.
+     */
+    ArrayMap(const Graph& g, MapRegistry& r) : MapBase(g, r) {
+      allocate_memory();
+      for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
+	int id = MapBase::getGraph()->id(it);
+	allocator.construct(&(values[id]), Value());
+      }								
+    }
 
-      /** Constructor to use default value to initialize the map. 
-       */
-      Map(const Graph& g, MapRegistry& r, const Value& v) : MapBase(g, r) {
-	allocate_memory();
-	for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
-	  int id = MapBase::getGraph()->id(it);
-	  allocator.construct(&(values[id]), v);
-	}								
+    /** Constructor to use default value to initialize the map. 
+     */
+    ArrayMap(const Graph& g, MapRegistry& r, const Value& v) 
+      : MapBase(g, r) {
+      allocate_memory();
+      for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
+	int id = MapBase::getGraph()->id(it);
+	allocator.construct(&(values[id]), v);
+      }								
+    }
+
+    /** Constructor to copy a map of the same map type.
+     */
+    ArrayMap(const ArrayMap& copy) : MapBase(*copy.graph, *copy.registry) {
+      capacity = copy.capacity;
+      if (capacity == 0) return;
+      values = allocator.allocate(capacity);
+      for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
+	int id = MapBase::getGraph()->id(it);
+	allocator.construct(&(values[id]), copy.values[id]);
       }
+    }
 
-      /** Constructor to copy a map of the same map type.
-       */
-      Map(const Map& copy) : MapBase(*copy.graph, *copy.registry) {
-	capacity = copy.capacity;
-	if (capacity == 0) return;
-	values = allocator.allocate(capacity);
+    /** Constructor to copy a map of an other map type.
+     */
+    template <typename CMap> ArrayMap(const CMap& copy) 
+      : MapBase(copy), capacity(0), values(0) {
+      if (MapBase::getGraph()) {
+	allocate_memory();
 	for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
-	  int id = MapBase::getGraph()->id(it);
-	  allocator.construct(&(values[id]), copy.values[id]);
+	  set(it, copy[it]);
 	}
       }
+    }
 
-      /** Constructor to copy a map of an other map type.
-       */
-      template <typename CMap> Map(const CMap& copy) 
-	: MapBase(copy), capacity(0), values(0) {
-	if (MapBase::getGraph()) {
-	  allocate_memory();
-	  for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
-	    set(it, copy[it]);
-	  }
-	}
+    /** Assign operator to copy a map of the same map type.
+     */
+    ArrayMap& operator=(const ArrayMap& copy) {
+      if (&copy == this) return *this;
+      if (capacity != 0) {
+	MapBase::destroy();
+	allocator.deallocate(values, capacity);
+      }
+      capacity = copy.capacity;
+      if (capacity == 0) return *this;
+      values = allocator.allocate(capacity);
+      for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
+	int id = MapBase::getGraph()->id(it);
+	allocator.construct(&(values[id]), copy.values[id]);
       }
+      return *this;
+    }
 
-      /** Assign operator to copy a map of the same map type.
-       */
-      Map& operator=(const Map& copy) {
-	if (&copy == this) return *this;
-	if (capacity != 0) {
-	  MapBase::destroy();
-	  allocator.deallocate(values, capacity);
-	}
-	capacity = copy.capacity;
-	if (capacity == 0) return *this;
-	values = allocator.allocate(capacity);
+    /** Assign operator to copy a map an other map type.
+     */
+    template <typename CMap> ArrayMap& operator=(const CMap& copy) {
+      if (MapBase::getGraph()) {
+	MapBase::destroy();
+      } 
+      MapBase::operator=(copy);
+      if (MapBase::getGraph()) {
+	allocate_memory();
 	for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
-	  int id = MapBase::getGraph()->id(it);
-	  allocator.construct(&(values[id]), copy.values[id]);
-	}
-	return *this;
-      }
-
-      /** Assign operator to copy a map an other map type.
-       */
-      template <typename CMap> Map& operator=(const CMap& copy) {
-	if (MapBase::getGraph()) {
-	  MapBase::destroy();
-	} 
-	MapBase::operator=(copy);
-	if (MapBase::getGraph()) {
-	  allocate_memory();
-	  for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
-	    set(it, copy[it]);
-	  }
+	  set(it, copy[it]);
 	}
-	return *this;
       }
+      return *this;
+    }
 				
-      /** The destructor of the map.
-       */
-      virtual ~Map() {
-	if (capacity != 0) {
-	  MapBase::destroy();
-	  allocator.deallocate(values, capacity);
-	}
+    /** The destructor of the map.
+     */
+    virtual ~ArrayMap() {
+      if (capacity != 0) {
+	MapBase::destroy();
+	allocator.deallocate(values, capacity);
       }
+    }
 	
 	
-      /**
-       * The subscript operator. The map can be subscripted by the
-       * actual keys of the graph. 
-       */
-      Value& operator[](const KeyType& key) {
-	int id = MapBase::getGraph()->id(key);
-	return values[id];
-      } 
+    /**
+     * The subscript operator. The map can be subscripted by the
+     * actual keys of the graph. 
+     */
+    ReferenceType operator[](const KeyType& key) {
+      int id = MapBase::getGraph()->id(key);
+      return values[id];
+    } 
 		
-      /**
-       * The const subscript operator. The map can be subscripted by the
-       * actual keys of the graph. 
-       */
-      const Value& operator[](const KeyType& key) const {
-	int id = MapBase::getGraph()->id(key);
-	return values[id];
-      }
+    /**
+     * The const subscript operator. The map can be subscripted by the
+     * actual keys of the graph. 
+     */
+    ConstReferenceType operator[](const KeyType& key) const {
+      int id = MapBase::getGraph()->id(key);
+      return values[id];
+    }
 	
-      /** Setter function of the map. Equivalent with map[key] = val.
-       *  This is a compatibility feature with the not dereferable maps.
-       */
-      void set(const KeyType& key, const Value& val) {
-	int id = MapBase::getGraph()->id(key);
-	values[id] = val;
-      }
+    /** Setter function of the map. Equivalent with map[key] = val.
+     *  This is a compatibility feature with the not dereferable maps.
+     */
+    void set(const KeyType& key, const ValueType& val) {
+      int id = MapBase::getGraph()->id(key);
+      values[id] = val;
+    }
 		
-      /** Add a new key to the map. It called by the map registry.
-       */
-      void add(const KeyType& key) {
-	int id = MapBase::getGraph()->id(key);
-	if (id >= capacity) {
-	  int new_capacity = (capacity == 0 ? 1 : capacity);
-	  while (new_capacity <= id) {
-	    new_capacity <<= 1;
-	  }
-	  Value* new_values = allocator.allocate(new_capacity);;
-	  for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
-	    int jd = MapBase::getGraph()->id(it);
-	    if (id != jd) {
-	      allocator.construct(&(new_values[jd]), values[jd]);
-	      allocator.destroy(&(values[jd]));
-	    }
+    /** Add a new key to the map. It called by the map registry.
+     */
+    void add(const KeyType& key) {
+      int id = MapBase::getGraph()->id(key);
+      if (id >= capacity) {
+	int new_capacity = (capacity == 0 ? 1 : capacity);
+	while (new_capacity <= id) {
+	  new_capacity <<= 1;
+	}
+	Value* new_values = allocator.allocate(new_capacity);;
+	for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
+	  int jd = MapBase::getGraph()->id(it);
+	  if (id != jd) {
+	    allocator.construct(&(new_values[jd]), values[jd]);
+	    allocator.destroy(&(values[jd]));
 	  }
-	  if (capacity != 0) allocator.deallocate(values, capacity);
-	  values = new_values;
-	  capacity = new_capacity;
 	}
-	allocator.construct(&(values[id]), Value());
+	if (capacity != 0) allocator.deallocate(values, capacity);
+	values = new_values;
+	capacity = new_capacity;
       }
+      allocator.construct(&(values[id]), Value());
+    }
 		
-      /** Erase a key from the map. It called by the map registry.
-       */
-      void erase(const KeyType& key) {
-	int id = MapBase::getGraph()->id(key);
-	allocator.destroy(&(values[id]));
-      }
-
-      /** Clear the data structure.
-       */
-      void clear() {	
-	if (capacity != 0) {
-	  MapBase::destroy();
-	  allocator.deallocate(values, capacity);
-	  capacity = 0;
-	}
-      }
-
-      class iterator;
-      class const_iterator;
-	
-      /** Compatible iterator with the stl maps' iterators.
-       *  It iterates on pairs of a key and a value.
-       */
-      class iterator {
-	friend class Map;
-	friend class const_iterator;
-      private:
-
-	/** Private constructor to initalize the the iterators returned
-	 *  by the begin() and end().
-	 */
-	iterator (Map& pmap, const KeyIt& pit) : map(&pmap), it(pit) {}
-
-      public:
-
-	/** Default constructor. 
-	 */
-	iterator() {}
-
-	typedef extended_pair<const KeyType&, const KeyType&, 
-			      Value&, Value&> Reference;
-
-	/** Dereference operator for map.
-	 */	 
-	Reference operator*() {
-	  return Reference(it, (*map)[it]);
-	}
-
-	class Pointer {
-	  friend class iterator;
-	private:
-	  Reference data;
-	  Pointer(const KeyType& key, Value& val) : data(key, val) {}
-	public:
-	  Reference* operator->() {return &data;}
-	};
-
-	/** Arrow operator for map.
-	 */	 
-	Pointer operator->() {
-	  return Pointer(it, ((*map)[it])); 
-	}
-
-	/** The pre increment operator of the map.
-	 */
-	iterator& operator++() { 
-	  ++it; 
-	  return *this; 
-	}
-
-	/** The post increment operator of the map.
-	 */
-	iterator operator++(int) { 
-	  iterator tmp(it); 
-	  ++it; 
-	  return tmp; 
-	}
-
-	/** The equality operator of the map.
-	 */
-	bool operator==(const_iterator p_it) {
-	  return p_it.it == it;
-	}
-	
-	/** The not-equality operator of the map.
-	 */
-	bool operator!=(const_iterator p_it) {
-	  return !(*this == p_it);
-	}
-
-	
-      private:
-	Map* map;
-	KeyIt it;
-      };
-
-      /** Returns the begin iterator of the map.
-       */
-      iterator begin() {
-	return iterator(*this, KeyIt(*MapBase::getGraph()));
-      }
-
-      /** Returns the end iterator of the map.
-       */
-      iterator end() {
-	return iterator(*this, INVALID);
-      }
-
-      class const_iterator {
-	friend class Map;
-	friend class iterator;
-      private:
-
-	/** Private constructor to initalize the the iterators returned
-	 *  by the begin() and end().
-	 */
-	const_iterator (const Map& pmap, const KeyIt& pit) 
-	  : map(&pmap), it(pit) {}
-
-      public:
-
-	/** Default constructor. 
-	 */
-	const_iterator() {}
-
-	/** Constructor to convert iterator to const_iterator.
-	 */
-	const_iterator(iterator p_it) : map(p_it.map), it(p_it.it) {}
-      
-	typedef extended_pair<const KeyType&, const KeyType&, 
-	  const Value&, const Value&> Reference;
-
-	/** Dereference operator for map.
-	 */	 
-	Reference operator*() {
-	  return Reference(it, (*map)[it]);
-	}
-
-
-	class Pointer {
-	  friend class const_iterator;
-	private:
-	  Reference data;
-	  Pointer(const KeyType& key, const Value& val) : data(key, val) {}
-	public:
-	  Reference* operator->() {return &data;}
-	};
-
-	/** Arrow operator for map.
-	 */	 
-	Pointer operator->() {
-	  return Pointer(it, ((*map)[it])); 
-	}
-
-	/** The pre increment operator of the map.
-	 */
-	const_iterator& operator++() { 
-	  ++it; 
-	  return *this; 
-	}
+    /** Erase a key from the map. It called by the map registry.
+     */
+    void erase(const KeyType& key) {
+      int id = MapBase::getGraph()->id(key);
+      allocator.destroy(&(values[id]));
+    }
 
-	/** The post increment operator of the map.
-	 */
-	const_iterator operator++(int) { 
-	  const_iterator tmp(it); 
-	  ++it; 
-	  return tmp; 
-	}
+    /** Clear the data structure.
+     */
+    void clear() {	
+      if (capacity != 0) {
+	MapBase::destroy();
+	allocator.deallocate(values, capacity);
+	capacity = 0;
+      }
+    }
+
+    /// The stl compatible pair iterator of the map.
+    typedef MapIterator<ArrayMap> Iterator;
+    /// The stl compatible const pair iterator of the map.
+    typedef MapConstIterator<ArrayMap> ConstIterator;
 
-	/** The equality operator of the map.
-	 */
-	bool operator==(const_iterator p_it) {
-	  return p_it.it == it;
-	}
-	
-	/** The not-equality operator of the map.
-	 */
-	bool operator!=(const_iterator p_it) {
-	  return !(*this == p_it);
-	}
-	
+    /** Returns the begin iterator of the map.
+     */
+    Iterator begin() {
+      return Iterator(*this, KeyIt(*MapBase::getGraph()));
+    }
 
-      private:
-	const Map* map;
-	KeyIt it;
-      };
+    /** Returns the end iterator of the map.
+     */
+    Iterator end() {
+      return Iterator(*this, INVALID);
+    }
 
-      /** Returns the begin const_iterator of the map.
-       */
-      const_iterator begin() const {
-	return const_iterator(*this, KeyIt(*MapBase::getGraph()));
-      }
+    /** Returns the begin ConstIterator of the map.
+     */
+    ConstIterator begin() const {
+      return ConstIterator(*this, KeyIt(*MapBase::getGraph()));
+    }
 
-      /** Returns the end const_iterator of the map.
-       */
-      const_iterator end() const {
-	return const_iterator(*this, INVALID);
-      }
+    /** Returns the end const_iterator of the map.
+     */
+    ConstIterator end() const {
+      return ConstIterator(*this, INVALID);
+    }
 
-    private:
+  private:
       
-      void allocate_memory() {
-	int max_id = -1;
-	for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
-	  int id = MapBase::getGraph()->id(it);
-	  if (id > max_id) {
-	    max_id = id;
-	  }			
-	}
-	if (max_id == -1) {
-	  capacity = 0;
-	  values = 0;
-	  return;
-	}
-	capacity = 1;
-	while (capacity <= max_id) {
-	  capacity <<= 1;
-	}
-	values = allocator.allocate(capacity);	
-      }      
-
-      int capacity;
-      Value* values;
-      Allocator allocator;
-    };		
-  };
+    void allocate_memory() {
+      int max_id = -1;
+      for (KeyIt it(*MapBase::getGraph()); it != INVALID; ++it) {
+	int id = MapBase::getGraph()->id(it);
+	if (id > max_id) {
+	  max_id = id;
+	}			
+      }
+      if (max_id == -1) {
+	capacity = 0;
+	values = 0;
+	return;
+      }
+      capacity = 1;
+      while (capacity <= max_id) {
+	capacity <<= 1;
+      }
+      values = allocator.allocate(capacity);	
+    }      
+
+    int capacity;
+    Value* values;
+    Allocator allocator;
+  };		
 
 /// @}
 

Copied: hugo/trunk/src/hugo/default_map.h (from r1113, /hugo/trunk/src/hugo/default_map_factory.h)
==============================================================================
--- /hugo/trunk/src/hugo/default_map_factory.h	(original)
+++ hugo/trunk/src/hugo/default_map.h	Wed Sep  8 14:06:45 2004
@@ -1,33 +1,40 @@
 // -*- c++ -*-
-#ifndef DEFAULT_MAP_FACTORY_H
-#define DEFAULT_MAP_FACTORY_H
+#ifndef DEFAULT_MAP_H
+#define DEFAULT_MAP_H
 
 
-#include <hugo/array_map_factory.h>
-#include <hugo/vector_map_factory.h>
+#include <hugo/array_map.h>
+#include <hugo/vector_map.h>
 
-///\ingroup graphmapfactory
+///\ingroup graphmaps
 ///\file
 ///\brief Graph maps that construates and destruates
 ///their elements dynamically.
 
 namespace hugo {
 
-/// \addtogroup graphmapfactory
+/// \addtogroup graphmaps
 /// @{
 
-#define DEFAULT_MAP_BODY(Factory, Val) \
+  /** The ArrayMap template class is graph map structure what
+   *  automatically updates the map when a key is added to or erased from
+   *  the map. This map uses the VectorMap if the ValueType is a primitive
+   *  type and the ArrayMap for the other cases.
+   *
+   *  The template parameter is the MapRegistry that the maps
+   *  will belong to and the ValueType.
+   */
+
+
+  /** Macro to implement the DefaultMap.
+   */
+#define DEFAULT_MAP_BODY(DynMap, Value) \
   { \
-    typedef typename Factory<MapRegistry>::template Map<Val> MapImpl; \
+    typedef DynMap<MapRegistry, Value> MapImpl; \
   \
   public: \
   \
     typedef typename MapRegistry::Graph Graph; \
-    typedef typename MapRegistry::KeyType KeyType; \
-    typedef typename MapRegistry::KeyIt KeyIt; \
-    typedef Val Value; \
-  \
-    typedef typename MapRegistry::MapBase MapBase; \
   \
     DefaultMap() : MapImpl() {} \
   \
@@ -55,127 +62,54 @@
 
 
   template <typename MapRegistry, typename Type>
-  class DefaultMap : public ArrayMapFactory<MapRegistry>::template Map<Type> 
-  DEFAULT_MAP_BODY(ArrayMapFactory, Type);
+  class DefaultMap : public ArrayMap<MapRegistry, Type> 
+  DEFAULT_MAP_BODY(ArrayMap, Type);
 
   template <typename MapRegistry>
   class DefaultMap<MapRegistry, bool> 
-    : public VectorMapFactory<MapRegistry>::template Map<bool> 
-  DEFAULT_MAP_BODY(VectorMapFactory, bool);
+    : public VectorMap<MapRegistry, bool> 
+  DEFAULT_MAP_BODY(VectorMap, bool);
 
   template <typename MapRegistry>
   class DefaultMap<MapRegistry, char> 
-    : public VectorMapFactory<MapRegistry>::template Map<char> 
-  DEFAULT_MAP_BODY(VectorMapFactory, char);
+    : public VectorMap<MapRegistry, char> 
+  DEFAULT_MAP_BODY(VectorMap, char);
 
   template <typename MapRegistry>
   class DefaultMap<MapRegistry, int> 
-    : public VectorMapFactory<MapRegistry>::template Map<int> 
-  DEFAULT_MAP_BODY(VectorMapFactory, int);
+    : public VectorMap<MapRegistry, int> 
+  DEFAULT_MAP_BODY(VectorMap, int);
 
   template <typename MapRegistry>
   class DefaultMap<MapRegistry, short> 
-    : public VectorMapFactory<MapRegistry>::template Map<short> 
-  DEFAULT_MAP_BODY(VectorMapFactory, short);
+    : public VectorMap<MapRegistry, short> 
+  DEFAULT_MAP_BODY(VectorMap, short);
 
   template <typename MapRegistry>
   class DefaultMap<MapRegistry, long> 
-    : public VectorMapFactory<MapRegistry>::template Map<long> 
-  DEFAULT_MAP_BODY(VectorMapFactory, long);
+    : public VectorMap<MapRegistry, long> 
+  DEFAULT_MAP_BODY(VectorMap, long);
 
   template <typename MapRegistry>
   class DefaultMap<MapRegistry, float> 
-    : public VectorMapFactory<MapRegistry>::template Map<float> 
-  DEFAULT_MAP_BODY(VectorMapFactory, float);
+    : public VectorMap<MapRegistry, float> 
+  DEFAULT_MAP_BODY(VectorMap, float);
 
   template <typename MapRegistry>
   class DefaultMap<MapRegistry, double> 
-    : public VectorMapFactory<MapRegistry>::template Map<double> 
-  DEFAULT_MAP_BODY(VectorMapFactory, double);
+    : public VectorMap<MapRegistry, double> 
+  DEFAULT_MAP_BODY(VectorMap, double);
 
   template <typename MapRegistry>
   class DefaultMap<MapRegistry, long double> 
-    : public VectorMapFactory<MapRegistry>::template Map<long double> 
-  DEFAULT_MAP_BODY(VectorMapFactory, long double);
+    : public VectorMap<MapRegistry, long double> 
+  DEFAULT_MAP_BODY(VectorMap, long double);
 
   template <typename MapRegistry, typename Type>
   class DefaultMap<MapRegistry, Type*>
-    : public VectorMapFactory<MapRegistry>::template Map<Type*> 
-  DEFAULT_MAP_BODY(VectorMapFactory, Type*);
-
+    : public VectorMap<MapRegistry, Type*> 
+  DEFAULT_MAP_BODY(VectorMap, Type*);
 
-  /** The DefaultMapFactory template class is a factory class
-   *  to create maps for the edge and nodes. This map factory
-   *  uses the VectorMapFactory if the ValueType is a primitive
-   *  type and the ArrayMapFactory for the other cases.
-   *
-   *  The template parameter is the MapRegistry that the maps
-   *  will belong to.
-   */
-
-  template <typename MapRegistry>
-  class DefaultMapFactory {
-		
-  public:
-    /// The graph type of the maps. 
-    typedef typename MapRegistry::Graph Graph;
-    /// The key type of the maps.
-    typedef typename MapRegistry::KeyType KeyType;
-    /// The iterator to iterate on the keys.
-    typedef typename MapRegistry::KeyIt KeyIt;
-
-    /// The MapBase of the Map which imlements the core regisitry function.
-    typedef typename MapRegistry::MapBase MapBase;
-		
-
-    /** The template Map type.
-     */
-    template <typename V> 
-    class Map : public DefaultMap<MapRegistry, V> {
-
-      typedef DefaultMap<MapRegistry, V> MapImpl;
-
-    public:
-      
-      typedef V Value;
-
-      /** Default constructor for the map.
-       */
-      Map() : MapImpl() {}
-
-      /** Graph and Registry initialized map constructor.
-       */
-      Map(const Graph& g, MapRegistry& r) : MapImpl(g, r) {}
-
-      /** Constructor to use default value to initialize the map. 
-       */
-      Map(const Graph& g, MapRegistry& r, const Value& v) : MapImpl(g, r, v) {}
-
-      /** Constructor to copy a map of the same map type.
-       */
-      Map(const Map& copy) : MapImpl(static_cast<const MapImpl&>(copy)) {}
-
-      /** Constructor to copy a map of an other map type.
-       */
-      template <typename CMap> Map(const CMap& copy) : MapImpl(copy) {}
-
-      /** Assign operator to copy a map of the same map type.
-       */
-      Map& operator=(const Map& copy) {
-	MapImpl::operator=(static_cast<const MapImpl&>(copy));
-	return *this;
-      }
-
-      /** Assign operator to copy a map an other map type.
-       */
-      template <typename CMap> Map& operator=(const CMap& copy) {
-	MapImpl::operator=(copy);
-	return *this;
-      }
-
-    };
-
-  };
 }
 
 #endif

Modified: hugo/trunk/src/hugo/full_graph.h
==============================================================================
--- hugo/trunk/src/hugo/full_graph.h	(original)
+++ hugo/trunk/src/hugo/full_graph.h	Wed Sep  8 14:06:45 2004
@@ -13,7 +13,9 @@
 #include <hugo/invalid.h>
 
 #include <hugo/map_registry.h>
-#include <hugo/default_map_factory.h>
+#include <hugo/default_map.h>
+
+#include <hugo/map_defines.h>
 
 namespace hugo {
 
@@ -47,8 +49,11 @@
     class OutEdgeIt;
     class InEdgeIt;
     
+
+    /// Creating map registries.
     CREATE_MAP_REGISTRIES;
-    CREATE_MAPS(DefaultMapFactory);
+    /// Creating node and edge maps.
+    CREATE_MAPS(DefaultMap);
     
   public:
 

Modified: hugo/trunk/src/hugo/list_graph.h
==============================================================================
--- hugo/trunk/src/hugo/list_graph.h	(original)
+++ hugo/trunk/src/hugo/list_graph.h	Wed Sep  8 14:06:45 2004
@@ -13,9 +13,9 @@
 #include <hugo/invalid.h>
 
 #include <hugo/map_registry.h>
-#include <hugo/default_map_factory.h>
+#include <hugo/default_map.h>
 
-#include <hugo/sym_map_factory.h>
+#include <hugo/sym_map.h>
 
 #include <hugo/map_defines.h>
 
@@ -79,8 +79,10 @@
     class OutEdgeIt;
     class InEdgeIt;
 
+    /// Creating map registries.
     CREATE_MAP_REGISTRIES;
-    CREATE_MAPS(DefaultMapFactory);
+    /// Creating node and edge maps.
+    CREATE_MAPS(DefaultMap);
 
   public:
 
@@ -443,12 +445,13 @@
 
     typedef SymListGraph Graph;
 
-    KEEP_NODE_MAP(ListGraph);
-    KEEP_EDGE_MAP(ListGraph);
+    /// Importing maps from the base class ListGraph.
+    KEEP_MAPS(ListGraph, SymListGraph);
 
+    /// Creating symmetric map registry.
     CREATE_SYM_EDGE_MAP_REGISTRY;
-    CREATE_SYM_EDGE_MAP_FACTORY(DefaultMapFactory);
-    IMPORT_SYM_EDGE_MAP(SymEdgeMapFactory);
+    /// Creating symmetric edge map.
+    CREATE_SYM_EDGE_MAP(DefaultMap);
 
     SymListGraph() : ListGraph() { }
     SymListGraph(const ListGraph &_g) : ListGraph(_g) { }
@@ -529,8 +532,40 @@
     class OutEdgeIt;
     class InEdgeIt;
     
-    CREATE_MAP_REGISTRIES;
-    CREATE_MAPS(DefaultMapFactory);
+    /// Creating node map registry.
+    CREATE_NODE_MAP_REGISTRY;
+    /// Creating node maps.
+    CREATE_NODE_MAP(DefaultMap);
+
+    /// Creating empty map structure for edges.
+    template <typename Value>
+    class EdgeMap {
+    public:
+      EdgeMap() {}
+      EdgeMap(const Graph&) {}
+      EdgeMap(const Graph&, const Value&) {}
+
+      EdgeMap(const EdgeMap&) {}
+      template <typename CMap> EdgeMap(const CMap&) {}
+
+      EdgeMap& operator=(const EdgeMap&) {}
+      template <typename CMap> EdgeMap& operator=(const CMap&) {}
+      
+      class ConstIterator {
+      public:
+	bool operator==(const ConstIterator&) {return true;}
+	bool operator!=(const ConstIterator&) {return false;}
+      };
+
+      typedef ConstIterator Iterator;
+      
+      Iterator begin() { return Iterator();}
+      Iterator end() { return Iterator();}
+
+      ConstIterator begin() const { return ConstIterator();}
+      ConstIterator end() const { return ConstIterator();}
+
+    };
     
   public:
 
@@ -848,9 +883,13 @@
     class InEdgeIt;
 
 
+    /// Creating edge map registry.
     CREATE_EDGE_MAP_REGISTRY;
-    CREATE_EDGE_MAP_FACTORY(DefaultMapFactory);
-    IMPORT_EDGE_MAP(EdgeMapFactory);
+    /// Creating edge maps.
+    CREATE_EDGE_MAP(DefaultMap);
+
+    /// Importing node maps from the NodeGraphType.
+    IMPORT_NODE_MAP(NodeGraphType, graph.G, EdgeSet, graph);
     
     
   public:
@@ -1090,42 +1129,7 @@
 	: Edge(_G.nodes[v].first_in), G(&_G) { }
       InEdgeIt &operator++() { n=G->edges[n].next_in; return *this; }
     };
-
     
-    template <typename V> class NodeMap 
-      : public NodeGraphType::template NodeMap<V>
-    {
-      //This is a must, the constructors need it.
-      typedef typename NodeGraphType::template NodeMap<V> MapImpl;
-      typedef V Value;
-    public:
-      NodeMap() : MapImpl() {}
-      
-      NodeMap(const EdgeSet& graph) 
-	: MapImpl(graph.G) { }
-
-      NodeMap(const EdgeSet& graph, const Value& value) 
-	: MapImpl(graph.G, value) { }
-
-      NodeMap(const NodeMap& copy) 
-	: MapImpl(static_cast<const MapImpl&>(copy)) {}
-
-      template<typename CMap>
-      NodeMap(const CMap& copy)
-	: MapImpl(copy) { }
-
-      NodeMap& operator=(const NodeMap& copy) {
-	MapImpl::operator=(static_cast<const MapImpl&>(copy));
-	return *this;
-      }
-
-      template <typename CMap>
-      NodeMap& operator=(const CMap& copy) {
-	MapImpl::operator=(copy);
-	return *this;
-      }
-
-    };
   };
 
   template<typename GG>

Modified: hugo/trunk/src/hugo/map_defines.h
==============================================================================
--- hugo/trunk/src/hugo/map_defines.h	(original)
+++ hugo/trunk/src/hugo/map_defines.h	Wed Sep  8 14:06:45 2004
@@ -2,7 +2,7 @@
 #ifndef MAP_DEFINES_H
 #define MAP_DEFINES_H
 
-///\ingroup graphmapfactory
+///\ingroup graphmaps
 ///\file
 ///\brief Defines to help creating graph maps.
 
@@ -29,38 +29,22 @@
 CREATE_NODE_MAP_REGISTRY \
 CREATE_EDGE_MAP_REGISTRY
 
-/** Creates a concrete factory type from a template map
- *  factory to use as node map factory.
- */
-#define CREATE_NODE_MAP_FACTORY(TemplateFactory) \
-typedef TemplateFactory<NodeMapRegistry> NodeMapFactory;
-
-/** Creates a concrete factory type from a template map
- *  factory to use as edge map factory.
- */
-#define CREATE_EDGE_MAP_FACTORY(TemplateFactory) \
-typedef TemplateFactory<EdgeMapRegistry> EdgeMapFactory;
-
-/** Creates both map factories.
- */
-#define CREATE_MAP_FACTORIES(TemplateFactory) \
-CREATE_NODE_MAP_FACTORY(TemplateFactory) \
-CREATE_EDGE_MAP_FACTORY(TemplateFactory) 
-
-/** Import a map from a concrete map factory. The import method is
+/** Creates a map from a template map. The import method is
  *  an overloading of the map type.
  *  The reason to use these macro is that the c++ does not support
  *  the template typedefs. If a future release of the c++ 
  *  supports this feature it should be fixed.
  */
-#define IMPORT_NODE_MAP(Factory) \
-template <typename V> \
-class NodeMap : public Factory::template Map<V> { \
-typedef typename Factory::template Map<V> MapImpl; \
+#define CREATE_NODE_MAP(DynMap) \
+template <typename Value> \
+class NodeMap : public DynMap<NodeMapRegistry, Value> { \
+typedef DynMap<NodeMapRegistry, Value> MapImpl; \
 public: \
 NodeMap() {} \
-NodeMap(const Graph& g) : MapImpl(g, g.node_maps) {} \
-NodeMap(const Graph& g, const V& v) : MapImpl(g, g.node_maps, v) {} \
+NodeMap(const typename MapImpl::Graph& g) \
+  : MapImpl(g, g.node_maps) {} \
+NodeMap(const typename MapImpl::Graph& g, const Value& v) \
+  : MapImpl(g, g.node_maps, v) {} \
 NodeMap(const NodeMap& copy) : MapImpl(static_cast<const MapImpl&>(copy)) {} \
 template <typename CMap> NodeMap(const CMap& copy) : MapImpl(copy) {} \
 NodeMap& operator=(const NodeMap& copy) { \
@@ -73,20 +57,22 @@
 } \
 };
 
-/** Import a map from a concrete map factory. The import method is
+/** Creates a map from a template map. The import method is
  *  an overloading of the map type.
  *  The reason to use these macro is that the c++ does not support
  *  the template typedefs. If a future release of the c++ 
  *  supports this feature it should be fixed.
  */
-#define IMPORT_EDGE_MAP(Factory) \
-template <typename V> \
-class EdgeMap : public Factory::template Map<V> { \
-typedef typename Factory::template Map<V> MapImpl; \
+#define CREATE_EDGE_MAP(DynMap) \
+template <typename Value> \
+class EdgeMap : public DynMap<EdgeMapRegistry, Value> { \
+typedef DynMap<EdgeMapRegistry, Value> MapImpl; \
 public: \
 EdgeMap() {} \
-EdgeMap(const Graph& g) : MapImpl(g, g.edge_maps) {} \
-EdgeMap(const Graph& g, const V& v) : MapImpl(g, g.edge_maps, v) {} \
+EdgeMap(const typename MapImpl::Graph& g) \
+  : MapImpl(g, g.edge_maps) {} \
+EdgeMap(const typename MapImpl::Graph& g, const Value& v) \
+  : MapImpl(g, g.edge_maps, v) {} \
 EdgeMap(const EdgeMap& copy) : MapImpl(static_cast<const MapImpl&>(copy)) {} \
 template <typename CMap> EdgeMap(const CMap& copy) : MapImpl(copy) {} \
 EdgeMap& operator=(const EdgeMap& copy) { \
@@ -99,12 +85,11 @@
 } \
 };
 
-/** This macro creates both map factories and imports both maps.
+/** This macro creates both maps.
  */
-#define CREATE_MAPS(TemplateFactory) \
-CREATE_MAP_FACTORIES(TemplateFactory) \
-IMPORT_NODE_MAP(NodeMapFactory) \
-IMPORT_EDGE_MAP(EdgeMapFactory)
+#define CREATE_MAPS(DynMap) \
+CREATE_NODE_MAP(DynMap) \
+CREATE_EDGE_MAP(DynMap)
 
 /** This macro creates MapRegistry for Symmetric Edge Maps.
  */
@@ -113,109 +98,119 @@
 typedef MapRegistry<Graph, Edge, SymEdgeIt> SymEdgeMapRegistry; \
 mutable EdgeMapRegistry sym_edge_maps;
 
-/** Creates a concrete factory type from a template map
- *  factory to use as edge map factory.
- */
-#define CREATE_SYM_EDGE_MAP_FACTORY(TemplateFactory) \
-typedef SymMapFactory<SymEdgeMapRegistry, TemplateFactory > \
-SymEdgeMapFactory;
 
-/** Import a map from a concrete map factory. The import method is
+/** Creates a map from a template map. The import method is
  *  an overloading of the map type.
  *  The reason to use these macro is that the c++ does not support
  *  the template typedefs. If a future release of the c++ 
  *  supports this feature it should be fixed.
  */
-#define IMPORT_SYM_EDGE_MAP(Factory) \
-template <typename V> \
-class SymEdgeMap : public Factory::template Map<V> { \
-typedef typename Factory::template Map<V> MapImpl; \
-public: \
-SymEdgeMap() {} \
-SymEdgeMap(const Graph& g) : MapImpl(g, g.sym_edge_maps) {} \
-SymEdgeMap(const Graph& g, const V& v) : MapImpl(g, g.sym_edge_maps, v) {} \
-SymEdgeMap(const SymEdgeMap& copy) \
-  : MapImpl(static_cast<const MapImpl&>(copy)) {} \
-template <typename CMap> SymEdgeMap(const CMap& copy) : MapImpl(copy) {} \
-SymEdgeMap& operator=(const SymEdgeMap& copy) { \
-  MapImpl::operator=(static_cast<const MapImpl&>(copy));\
-  return *this; \
-} \
-template <typename CMap> SymEdgeMap& operator=(const CMap& copy) { \
-  MapImpl::operator=(copy);\
-  return *this; \
-} \
+#define CREATE_SYM_EDGE_MAP(DynMap) \
+template <typename Value> \
+class SymEdgeMap : public SymMap<DynMap, SymEdgeMapRegistry, Value> { \
+  typedef SymMap<DynMap, SymEdgeMapRegistry, Value> MapImpl; \
+ public: \
+\
+  SymEdgeMap() {} \
+\
+  SymEdgeMap(const typename MapImpl::Graph& g) \
+    : MapImpl(g, g.sym_edge_maps) {} \
+\
+  SymEdgeMap(const typename MapImpl::Graph& g, const Value& v) \
+    : MapImpl(g, g.sym_edge_maps, v) {} \
+\
+  SymEdgeMap(const SymEdgeMap& copy) \
+    : MapImpl(static_cast<const MapImpl&>(copy)) {} \
+\
+  template <typename CMap> SymEdgeMap(const CMap& copy) : MapImpl(copy) {} \
+  SymEdgeMap& operator=(const SymEdgeMap& copy) { \
+    MapImpl::operator=(static_cast<const MapImpl&>(copy));\
+    return *this; \
+  } \
+\
+  template <typename CMap> SymEdgeMap& operator=(const CMap& copy) { \
+    MapImpl::operator=(copy);\
+    return *this; \
+  } \
+};
+
+
+/** This is a macro to import an node map into a graph class.
+ */
+#define IMPORT_NODE_MAP(From, from, To, to) \
+template <typename Value> \
+class NodeMap \
+  : public From::template NodeMap<Value> { \
+  typedef typename From::template NodeMap<Value> MapImpl; \
+ public: \
+   NodeMap() : MapImpl() {} \
+\
+   NodeMap(const To& to) \
+     : MapImpl(static_cast<const From&>(from)) { } \
+\
+   NodeMap(const To& to, const Value& value) \
+     : MapImpl(static_cast<const From&>(from), value) { } \
+\
+   NodeMap(const NodeMap& copy) \
+     : MapImpl(static_cast<const MapImpl&>(copy)) {} \
+\
+   template<typename CMap> \
+   NodeMap(const CMap& copy) \
+     : MapImpl(copy) {} \
+\
+   NodeMap& operator=(const NodeMap& copy) { \
+     MapImpl::operator=(static_cast<const MapImpl&>(copy)); \
+     return *this; \
+   } \
+\
+   template <typename CMap> \
+   NodeMap& operator=(const CMap& copy) { \
+     MapImpl::operator=(copy); \
+     return *this; \
+   } \
 };
 
+/** This is a macro to import an edge map into a graph class.
+ */
+#define IMPORT_EDGE_MAP(From, from, To, to) \
+template <typename Value> \
+class EdgeMap \
+  : public From::template EdgeMap<Value> { \
+  typedef typename From::template EdgeMap<Value> MapImpl; \
+ public: \
+   EdgeMap() : MapImpl() {} \
+\
+   EdgeMap(const To& to) \
+     : MapImpl(static_cast<const From&>(from)) { } \
+\
+   EdgeMap(const To& to, const Value& value) \
+     : MapImpl(static_cast<const From&>(from), value) { } \
+\
+   EdgeMap(const EdgeMap& copy) \
+     : MapImpl(static_cast<const MapImpl&>(copy)) {} \
+\
+   template<typename CMap> \
+   EdgeMap(const CMap& copy) \
+     : MapImpl(copy) {} \
+\
+   EdgeMap& operator=(const EdgeMap& copy) { \
+     MapImpl::operator=(static_cast<const MapImpl&>(copy)); \
+     return *this; \
+   } \
+\
+   template <typename CMap> \
+   EdgeMap& operator=(const CMap& copy) { \
+     MapImpl::operator=(copy); \
+     return *this; \
+   } \
+};
 
-#define KEEP_NODE_MAP(GraphBase) \
-    template <typename V> class NodeMap \
-      : public GraphBase::template NodeMap<V> \
-    { \
-      typedef typename GraphBase::template NodeMap<V> MapImpl; \
-      typedef V Value; \
-    public: \
-      NodeMap() : MapImpl() {} \
-\
-      NodeMap(const Graph& graph) \
-	: MapImpl(static_cast<const GraphBase&>(graph)) { } \
-\
-      NodeMap(const Graph& graph, const Value& value) \
-	: MapImpl(static_cast<const GraphBase&>(graph), value) { } \
-\
-      NodeMap(const NodeMap& copy) \
-	: MapImpl(static_cast<const MapImpl&>(copy)) {} \
-\
-      template<typename CMap> \
-      NodeMap(const CMap& copy) \
-	: MapImpl(copy) {} \
-\
-      NodeMap& operator=(const NodeMap& copy) { \
-	MapImpl::operator=(static_cast<const MapImpl&>(copy)); \
-	return *this; \
-      } \
-\
-      template <typename CMap> \
-      NodeMap& operator=(const CMap& copy) { \
-	MapImpl::operator=(copy); \
-	return *this; \
-      } \
-    };
-
-#define KEEP_EDGE_MAP(GraphBase) \
-    template <typename V> class EdgeMap \
-      : public GraphBase::template EdgeMap<V> \
-    { \
-      typedef typename GraphBase::template EdgeMap<V> MapImpl; \
-      typedef V Value; \
-    public: \
-      EdgeMap() : MapImpl() {} \
-\
-      EdgeMap(const Graph& graph) \
-	: MapImpl(static_cast<const GraphBase&>(graph)) { } \
-\
-      EdgeMap(const Graph& graph, const Value& value) \
-	: MapImpl(static_cast<const GraphBase&>(graph), value) { } \
-\
-      EdgeMap(const EdgeMap& copy) \
-	: MapImpl(static_cast<const MapImpl&>(copy)) {} \
-\
-      template<typename CMap> \
-      EdgeMap(const CMap& copy) \
-	: MapImpl(copy) {} \
-\
-      EdgeMap& operator=(const EdgeMap& copy) { \
-	MapImpl::operator=(static_cast<const MapImpl&>(copy)); \
-	return *this; \
-      } \
-\
-      template <typename CMap> \
-      EdgeMap& operator=(const CMap& copy) { \
-	MapImpl::operator=(copy); \
-	return *this; \
-      } \
-    };
 
+/** This is a macro to keep the node and edge maps for a graph class.
+ */
+#define KEEP_MAPS(From, To) \
+IMPORT_EDGE_MAP(From, graph, To, graph) \
+IMPORT_NODE_MAP(From, graph, To, graph)
   
 /// @}
   

Added: hugo/trunk/src/hugo/map_iterator.h
==============================================================================
--- (empty file)
+++ hugo/trunk/src/hugo/map_iterator.h	Wed Sep  8 14:06:45 2004
@@ -0,0 +1,243 @@
+// -*- c++ -*-
+#ifndef MAP_ITERATOR_H
+#define MAP_ITERATOR_H
+
+#include <hugo/extended_pair.h>
+
+namespace hugo {
+
+
+  template <typename Map>
+  class MapIterator;
+
+  template <typename Map>
+  class MapConstIterator;
+
+  /** Compatible iterator with the stl maps' iterators.
+   *  It iterates on pairs of a key and a value.
+   */
+  template <typename Map>  
+  class MapIterator {
+    //    friend class Map;
+    friend class MapConstIterator<Map>;
+
+  public:
+
+    /// The key type of the iterator.
+    typedef typename Map::KeyType KeyType;
+    /// The iterator to iterate on the keys.
+    typedef typename Map::KeyIt KeyIt;
+
+    /// The value type of the iterator.
+    typedef typename Map::ValueType ValueType;
+    /// The reference type of the iterator.
+    typedef typename Map::ReferenceType ReferenceType;
+    /// The pointer type of the iterator.
+    typedef typename Map::PointerType PointerType;
+
+    /// The const value type of the iterator.
+    typedef typename Map::ConstValueType ConstValueType;
+    /// The const reference type of the iterator.
+    typedef typename Map::ConstReferenceType ConstReferenceType;
+    /// The pointer type of the iterator.
+    typedef typename Map::ConstPointerType ConstPointerType;
+    
+  public:
+
+    /** Constructor to initalize the the iterators returned
+     *  by the begin() and end().
+     */
+    MapIterator (Map& pmap, const KeyIt& pit) 
+      : map(&pmap), it(pit) {}
+
+  public:
+
+    /** Default constructor. 
+     */
+    MapIterator() {}
+
+    typedef extended_pair<const KeyType&, const KeyType&, 
+      ReferenceType, ReferenceType> PairReferenceType;
+
+    /** Dereference operator for map.
+     */	 
+    PairReferenceType operator*() {
+      return PairReferenceType(it, (*map)[it]);
+    }
+
+    class PairPointerType {
+      friend class MapIterator;
+    private:
+      PairReferenceType data;
+      PairPointerType(const KeyType& key, ReferenceType val) 
+	: data(key, val) {}
+    public:
+      PairReferenceType* operator->() {return &data;}
+    };
+
+    /** Arrow operator for map.
+     */	 
+    PairPointerType operator->() {
+      return PairPointerType(it, ((*map)[it])); 
+    }
+
+    /** The pre increment operator of the map.
+     */
+    MapIterator& operator++() { 
+      ++it; 
+      return *this; 
+    }
+
+    /** The post increment operator of the map.
+     */
+    MapIterator operator++(int) { 
+      MapIterator tmp(it); 
+      ++it; 
+      return tmp; 
+    }
+
+    /** The equality operator of the map.
+     */
+    bool operator==(const MapIterator& p_it) const {
+      return p_it.it == it;
+    }
+	
+    /** The not-equality operator of the map.
+     */
+    bool operator!=(const MapIterator& p_it) const {
+      return !(*this == p_it);
+    }
+
+    /** The equality operator of the map.
+     */
+    bool operator==(const MapConstIterator<Map>& p_it) const {
+      return p_it.it == it;
+    }
+	
+    /** The not-equality operator of the map.
+     */
+    bool operator!=(const MapConstIterator<Map>& p_it) const {
+      return !(*this == p_it);
+    }
+	
+  private:
+    Map* map;
+    KeyIt it;
+  };
+
+  /** Compatible iterator with the stl maps' iterators.
+   *  It iterates on pairs of a key and a value.
+   */
+  template <typename Map>
+  class MapConstIterator {
+    // friend class Map;
+    friend class MapIterator<Map>;
+
+  public:
+
+    /// The key type of the iterator.
+    typedef typename Map::KeyType KeyType;
+    /// The iterator to iterate on the keys.
+    typedef typename Map::KeyIt KeyIt;
+
+    /// The value type of the iterator.
+    typedef typename Map::ValueType ValueType;
+    /// The reference type of the iterator.
+    typedef typename Map::ReferenceType ReferenceType;
+    /// The pointer type of the iterator.
+    typedef typename Map::PointerType PointerType;
+
+    /// The const value type of the iterator.
+    typedef typename Map::ConstValueType ConstValueType;
+    /// The const reference type of the iterator.
+    typedef typename Map::ConstReferenceType ConstReferenceType;
+    /// The pointer type of the iterator.
+    typedef typename Map::ConstPointerType ConstPointerType;
+
+  public:    
+
+    /** Constructor to initalize the the iterators returned
+     *  by the begin() and end().
+     */
+
+    MapConstIterator (const Map& pmap, const KeyIt& pit) 
+      : map(&pmap), it(pit) {}
+
+  public:
+
+    /** Default constructor. 
+     */
+    MapConstIterator() {}
+
+    typedef extended_pair<const KeyType&, const KeyType&, 
+      ConstReferenceType, ConstReferenceType> PairReferenceType;
+
+    /** Dereference operator for map.
+     */	 
+    PairReferenceType operator*() {
+      return PairReferenceType(it, (*map)[it]);
+    }
+
+    class PairPointerType {
+      friend class MapConstIterator;
+    private:
+      PairReferenceType data;
+      PairPointerType(const KeyType& key, ConstReferenceType val) 
+	: data(key, val) {}
+    public:
+      PairReferenceType* operator->() {return &data;}
+    };
+
+    /** Arrow operator for map.
+     */	 
+    PairPointerType operator->() {
+      return PairPointerType(it, ((*map)[it])); 
+    }
+
+    /** The pre increment operator of the map.
+     */
+    MapConstIterator& operator++() { 
+      ++it; 
+      return *this; 
+    }
+
+    /** The post increment operator of the map.
+     */
+    MapConstIterator operator++(int) { 
+      MapConstIterator<Map> tmp(it); 
+      ++it; 
+      return tmp; 
+    }
+
+    /** The equality operator of the map.
+     */
+    bool operator==(const MapIterator<Map>& p_it) const {
+      return p_it.it == it;
+    }
+	
+    /** The not-equality operator of the map.
+     */
+    bool operator!=(const MapIterator<Map>& p_it) const {
+      return !(*this == p_it);
+    }
+
+    /** The equality operator of the map.
+     */
+    bool operator==(const MapConstIterator& p_it) const {
+      return p_it.it == it;
+    }
+	
+    /** The not-equality operator of the map.
+     */
+    bool operator!=(const MapConstIterator& p_it) const {
+      return !(*this == p_it);
+    }
+	
+  private:
+    const Map* map;
+    KeyIt it;
+  };
+
+}
+
+#endif

Modified: hugo/trunk/src/hugo/map_registry.h
==============================================================================
--- hugo/trunk/src/hugo/map_registry.h	(original)
+++ hugo/trunk/src/hugo/map_registry.h	Wed Sep  8 14:06:45 2004
@@ -28,8 +28,6 @@
     typedef K KeyType;
     typedef KIt KeyIt;
 	
-
-
     /**
      * MapBase is the base class of the registered maps.
      * It defines the core modification operations on the maps and

Modified: hugo/trunk/src/hugo/smart_graph.h
==============================================================================
--- hugo/trunk/src/hugo/smart_graph.h	(original)
+++ hugo/trunk/src/hugo/smart_graph.h	Wed Sep  8 14:06:45 2004
@@ -12,8 +12,9 @@
 
 #include <hugo/invalid.h>
 
-#include <hugo/default_map_factory.h>
-#include <hugo/sym_map_factory.h>
+#include <hugo/default_map.h>
+#include <hugo/sym_map.h>
+
 #include <hugo/map_registry.h>
 
 #include <hugo/map_defines.h>
@@ -72,8 +73,10 @@
     class OutEdgeIt;
     class InEdgeIt;
     
+    /// Creating map registries.
     CREATE_MAP_REGISTRIES;
-    CREATE_MAPS(DefaultMapFactory);
+    /// Creating node and edge maps.
+    CREATE_MAPS(DefaultMap);
     
   public:
 
@@ -314,12 +317,14 @@
   public:
     typedef SymSmartGraph Graph;
 
-    KEEP_NODE_MAP(SmartGraph);
-    KEEP_EDGE_MAP(SmartGraph);
+    /// Importing maps from the base class ListGraph.
+    KEEP_MAPS(SmartGraph, SymSmartGraph);
 
+    /// Creating symmetric map registry.
     CREATE_SYM_EDGE_MAP_REGISTRY;
-    CREATE_SYM_EDGE_MAP_FACTORY(DefaultMapFactory);
-    IMPORT_SYM_EDGE_MAP(SymEdgeMapFactory);
+    /// Creating symmetric edge map.
+    CREATE_SYM_EDGE_MAP(DefaultMap);
+
 
     SymSmartGraph() : SmartGraph() { }
     SymSmartGraph(const SmartGraph &_g) : SmartGraph(_g) { }

Copied: hugo/trunk/src/hugo/sym_map.h (from r1113, /hugo/trunk/src/hugo/sym_map_factory.h)
==============================================================================
--- /hugo/trunk/src/hugo/sym_map_factory.h	(original)
+++ hugo/trunk/src/hugo/sym_map.h	Wed Sep  8 14:06:45 2004
@@ -1,112 +1,170 @@
 // -*- c++ -*-
-#ifndef SYM_MAP_FACTORY_H
-#define SYM_MAP_FACTORY_H
+#ifndef SYM_MAP_H
+#define SYM_MAP_H
+
+///\ingroup graphmaps
+///\file
+///\brief Graph maps that construates and destruates
+///their elements dynamically.
 
 namespace hugo {
 
+/// \addtogroup graphmaps
+/// @{
+
+  /** The SymEdgeIt is wrapper class for the EdgeIt. It can be used to
+   *  iterate on the symmetric maps when all of the edge - reverse edge pair
+   *  has different parity.
+   */
+
   template <typename Graph, typename Edge, typename EdgeIt>
   class SymEdgeIt : public EdgeIt {
   public:
 
+    /** Default constructor.
+     */
     SymEdgeIt() 
       : EdgeIt() {}
 
+    /** Graph initialized constructor.
+     */
     SymEdgeIt(const Graph& graph) 
       : EdgeIt(graph) {
-      while ( n != -1 && (n & 1)) {
+      while ( (n & 1) && n != -1) {
 	EdgeIt::operator++();
       }
     }
 
+    /** Creating invelid SymEdgeIt.
+     */
     SymEdgeIt(Invalid invalid) 
       : EdgeIt(invalid) {}
 
-    SymEdgeIt(const Graph& graph, Edge edge)
-      : EdgeIt(graph, edge) {}
+    /** SymEdgeIt from the given Edge.
+     */
+    SymEdgeIt(const Graph& graph, const Edge& edge)
+      : EdgeIt(graph, edge) {
+      while ( (n & 1) && n != -1) {
+	EdgeIt::operator++();
+      }
+    }
 
+    /** Increase operator.
+     */
     SymEdgeIt& operator++() {
       EdgeIt::operator++();
-      while ( n != -1 && (n & 1)) {
+      while ( (n & 1) && n != -1) {
 	EdgeIt::operator++();
       }
       return *this;
     }
   };
 
-  template <typename MapRegistry, template <typename> class MapFactory>
-  class SymMapFactory {
+  /** The SymMap template class is graph map structure what
+   *  wraps an other map structure to use as symmetric map structure.
+   *
+   *  The template parameter is the MapRegistry that the maps
+   *  will belong to and the ValueType.
+   */
+  template <template <typename, typename> class DynMap, 
+	    typename MapRegistry, typename Value>
+  class SymMap : public DynMap<MapRegistry, Value>{
+
+  private:
+
+    typedef DynMap<MapRegistry, Value> MapImpl;
 
   public:
 		
+    /// The graph type of the maps. 
     typedef typename MapRegistry::Graph Graph;
-    typedef typename MapRegistry::KeyType KeyType;
-    typedef typename MapRegistry::KeyIt KeyIt;
-
-    typedef typename MapRegistry::MapBase MapBase;
 
-    template <typename V>
-    class Map : public MapFactory<MapRegistry>::template Map<V> {
+    typedef typename MapImpl::KeyType KeyType;
 
-      typedef typename MapFactory<MapRegistry>::template Map<V> MapImpl;
-    public:
-
-      typedef V Value;
-
-      Map() : MapImpl() {}
-
-      Map(const Graph& g, MapRegistry& r) : MapImpl(g, r) {}
-
-      Map(const Graph& g, MapRegistry& r, const Value& v) 
-	: MapImpl(g, r, v) {}
-
-      Map(const Map& copy) : MapImpl(static_cast<const MapImpl&>(copy)) {}
+  public:
 
-      template <typename CMap> Map(const CMap& copy) : MapImpl(copy) {}
 
-      Map& operator=(const Map& copy) {
-	MapImpl::operator=(static_cast<const MapImpl&>(copy));
-	return *this;
-      }
+    /** Default constructor for the map.
+     */
+    SymMap() : MapImpl() {}
+
+    /** Graph and Registry initialized map constructor.
+     */
+    SymMap(const Graph& g, MapRegistry& r) : MapImpl(g, r) {}
+
+    /** Constructor to use default value to initialize the map. 
+     */
+    SymMap(const Graph& g, MapRegistry& r, const Value& v) 
+      : MapImpl(g, r, v) {}
+
+    /** Constructor to copy a map of the same map type.
+     */
+    SymMap(const SymMap& copy) 
+      : MapImpl(static_cast<const MapImpl&>(copy)) {}
+
+    /** Constructor to copy a map of an other map type.
+     */
+    template <typename CMap> SymMap(const CMap& copy) 
+      : MapImpl(copy) {}
+
+    /** Assign operator to copy a map of the same map type.
+     */
+    SymMap& operator=(const SymMap& copy) {
+      MapImpl::operator=(static_cast<const MapImpl&>(copy));
+      return *this;
+    }
 
-      template <typename CMap> Map& operator=(const CMap& copy) {
-	MapImpl::operator=(copy);
-	return *this;
-      }
+    /** Assign operator to copy a map of an other map type.
+     */
+    template <typename CMap> SymMap& operator=(const CMap& copy) {
+      MapImpl::operator=(copy);
+      return *this;
+    }
    
-      Value& operator[](const KeyType& key) {
-	int id = MapBase::getGraph()->id(key);	
-	return MapImpl::operator[](id >> 1);
-      } 
+    /**
+     * The subscript operator. The map can be subscripted by the
+     * actual keys of the graph. 
+     */
+    typename MapImpl::ReferenceType operator[](const KeyType& key) {
+      int id = MapImpl::getGraph()->id(key);	
+      return MapImpl::operator[](id >> 1);
+    } 
 		
-      const Value& operator[](const KeyType& key) const {
-	int id = MapBase::getGraph()->id(key);
-	return MapImpl::operator[](id >> 1);
-      }
+    /**
+     * The const subscript operator. The map can be subscripted by the
+     * actual keys of the graph. 
+     */
+    typename MapImpl::ConstReferenceType operator[](const KeyType& key) const {
+      int id = MapImpl::getGraph()->id(key);
+      return MapImpl::operator[](id >> 1);
+    }
 	
-      const Value& get(const KeyType& key) const {
-	int id = MapBase::getGraph()->id(key);
-	return MapImpl::operator[](id >> 1);
-      } 
-		
-      void set(const KeyType& key, const Value& val) {
-	int id = MapBase::getGraph()->id(key);
-	MapImpl::operator[](id >> 1) = val;
-      }
+    /** Setter function of the map. Equivalent with map[key] = val.
+     *  This is a compatibility feature with the not dereferable maps.
+     */
+    void set(const KeyType& key, const typename MapImpl::ValueType& val) {
+      int id = MapImpl::getGraph()->id(key);
+      MapImpl::operator[](id >> 1) = val;
+    }
 		
-      void add(const KeyType& key) {
-	int id = MapBase::getGraph()->id(key);
-	if (id & 1) return;
-	MapImpl::add(key);
-      }
+    /** Add a new key to the map. It called by the map registry.
+     */
+    void add(const KeyType& key) {
+      int id = MapImpl::getGraph()->id(key);
+      if (id & 1) return;
+      MapImpl::add(key);
+    }
 		
-      void erase(const KeyType& key) {
-	int id = MapBase::getGraph()->id(key);
-	if (id & 1) return;
-	MapImpl::add(key);
-      }
-
-
-    };  
+    /** Erase a key from the map. It called by the map registry.
+     */
+    void erase(const KeyType& key) {
+      int id = MapImpl::getGraph()->id(key);
+      if (id & 1) return;
+      MapImpl::add(key);
+    }
   };
+
+  /// @}
 }
+
 #endif

Copied: hugo/trunk/src/hugo/vector_map.h (from r1113, /hugo/trunk/src/hugo/vector_map_factory.h)
==============================================================================
--- /hugo/trunk/src/hugo/vector_map_factory.h	(original)
+++ hugo/trunk/src/hugo/vector_map.h	Wed Sep  8 14:06:45 2004
@@ -4,31 +4,33 @@
 
 #include <vector>
 
-#include <hugo/extended_pair.h>
+#include <hugo/map_iterator.h>
 
-///\ingroup graphmapfactory
+///\ingroup graphmaps
 ///\file
 ///\brief Vector based graph maps.
 
 namespace hugo {
   
-  /// \addtogroup graphmapfactory
+  /// \addtogroup graphmaps
   /// @{
   
-  /** The VectorMapFactory template class is a factory class
-   *  to create maps for the edge and nodes. This map factory
+  /** The ArrayMap template class is graph map structure what
+   *  automatically updates the map when a key is added to or erased from
+   *  the map. This map factory uses the allocators to implement 
+   *  the container functionality. This map factory
    *  uses the std::vector to implement the container function.
    *
    *  The template parameter is the MapRegistry that the maps
-   *  will belong to.
+   *  will belong to and the ValueType.
    * 
    * \todo It should use a faster initialization using the maxNodeId() or
-   * maxEdgeId() function of the graph istead of iterating through each
+   * maxEdgeId() function of the graph instead of iterating through each
    * edge/node.
    */
 	
-  template <typename MapRegistry>
-  class VectorMapFactory {
+  template <typename MapRegistry, typename Value>
+  class VectorMap : public MapRegistry::MapBase {
   public:
 		
     /// The graph type of the maps. 
@@ -38,336 +40,177 @@
     /// The iterator to iterate on the keys.
     typedef typename MapRegistry::KeyIt KeyIt;
 
-    /// The MapBase of the Map which imlements the core regisitry function.
+    /// The map type.
+    typedef VectorMap Map;
+    /// The MapBase of the Map which implements the core regisitry function.
     typedef typename MapRegistry::MapBase MapBase;
 
+  private:
 		
-    /** The template Map type.
-     */
-    template <typename V> 
-    class Map : public MapBase {
+    /// The container type of the map.
+    typedef std::vector<Value> Container;	
+
+  public:
 
-      typedef std::vector<V> Container;	
 
-    public:
+    /// The value type of the map.
+    typedef Value ValueType;
+    /// The reference type of the map;
+    typedef typename Container::reference ReferenceType;
+    /// The pointer type of the map;
+    typedef typename Container::pointer PointerType;
+
+    /// The const value type of the map.
+    typedef const Value ConstValueType;
+    /// The const reference type of the map;
+    typedef typename Container::const_reference ConstReferenceType;
+    /// The pointer type of the map;
+    typedef typename Container::const_pointer ConstPointerType;
 
-      /// The value type of the map.
-      typedef V ValueType;
-
-      /// The value type of the map.
-      typedef V Value;
-      /// The reference type of the map;
-      typedef typename Container::reference Reference;
-      /// The pointer type of the map;
-      typedef typename Container::pointer Pointer;
-
-      /// The const value type of the map.
-      typedef const Value ConstValue;
-      /// The const reference type of the map;
-      typedef typename Container::const_reference ConstReference;
-      /// The pointer type of the map;
-      typedef typename Container::const_pointer ConstPointer;
-
-      /** Default constructor for the map.
-       */
-      Map() {}
+    /** Default constructor for the map.
+     */
+    VectorMap() {}
 		
-      /** Graph and Registry initialized map constructor.
-       */
-      Map(const Graph& g, MapRegistry& r) : MapBase(g, r) {
-	init();
+    /** Graph and Registry initialized map constructor.
+     */
+    VectorMap(const Graph& g, MapRegistry& r) : MapBase(g, r) {
+      init();
+    }
+
+    /** Constructor to use default value to initialize the map. 
+     */
+    VectorMap(const Graph& g, MapRegistry& r, const Value& v) 
+      : MapBase(g, r) {
+      for (KeyIt it(*getGraph()); it != INVALID; ++it) {
+	int id = getGraph()->id(it);
+	if (id >= (int)container.size()) {
+	  container.resize(id + 1);
+	}
+	set(it, v);
       }
+    }
 
-      /** Constructor to use default value to initialize the map. 
-       */
-      Map(const Graph& g, MapRegistry& r, const Value& v) : MapBase(g, r) {
+    /** Constructor to copy a map of an other map type.
+     */
+    template <typename CMap> VectorMap(const CMap& copy) : MapBase(copy) {
+      if (getGraph()) {
 	for (KeyIt it(*getGraph()); it != INVALID; ++it) {
-          int id = getGraph()->id(it);
+	  int id = getGraph()->id(it);
 	  if (id >= (int)container.size()) {
 	    container.resize(id + 1);
 	  }
-	  set(it, v);
-        }
-      }
-
-      /** Constructor to copy a map of an other map type.
-       */
-      template <typename CMap> Map(const CMap& copy) : MapBase(copy) {
-	if (getGraph()) {
-	  for (KeyIt it(*getGraph()); it != INVALID; ++it) {
-	    int id = getGraph()->id(it);
-	    if (id >= (int)container.size()) {
-	      container.resize(id + 1);
-	    }
-	    set(it, copy[it]);
-	  }
+	  set(it, copy[it]);
 	}
       }
+    }
 
-      /** Assign operator to copy a map an other map type.
-       */
-      template <typename CMap> Map& operator=(const CMap& copy) {
-	if (getGraph()) {
-	  destroy();
-	} 
-	this->MapBase::operator=(copy);
-	if (getGraph()) {
-	  for (KeyIt it(*getGraph()); it != INVALID; ++it) {
-	    int id = getGraph()->id(it);
-	    if (id >= (int)container.size()) {
-	      container.resize(id + 1);
-	    }
-	    set(it, copy[it]);
+    /** Assign operator to copy a map an other map type.
+     */
+    template <typename CMap> VectorMap& operator=(const CMap& copy) {
+      if (getGraph()) {
+	destroy();
+      } 
+      this->MapBase::operator=(copy);
+      if (getGraph()) {
+	for (KeyIt it(*getGraph()); it != INVALID; ++it) {
+	  int id = getGraph()->id(it);
+	  if (id >= (int)container.size()) {
+	    container.resize(id + 1);
 	  }
+	  set(it, copy[it]);
 	}
-	return *this;
       }
+      return *this;
+    }
 
-      /** The destructor of the map.
-       */
-      virtual ~Map() {
-      }
-		
-      /**
-       * The subscript operator. The map can be subscripted by the
-       * actual keys of the graph. 
-       */
-      Reference operator[](const KeyType& key) {
-	int id = getGraph()->id(key);
-	return container[id];
-      } 
+    /** The destructor of the map.
+     */
+    virtual ~VectorMap() {
+    }
 		
-      /**
-       * The const subscript operator. The map can be subscripted by the
-       * actual keys of the graph. 
-       */
-      ConstReference operator[](const KeyType& key) const {
-	int id = getGraph()->id(key);
-	return container[id];
-      }
+    /**
+     * The subscript operator. The map can be subscripted by the
+     * actual keys of the graph. 
+     */
+    ReferenceType operator[](const KeyType& key) {
+      int id = getGraph()->id(key);
+      return container[id];
+    } 
+		
+    /**
+     * The const subscript operator. The map can be subscripted by the
+     * actual keys of the graph. 
+     */
+    ConstReferenceType operator[](const KeyType& key) const {
+      int id = getGraph()->id(key);
+      return container[id];
+    }
 
-      /** Setter function of the map. Equivalent with map[key] = val.
-       *  This is a compatibility feature with the not dereferable maps.
-       */
-      void set(const KeyType& key, const Value& val) {
-	int id = getGraph()->id(key);
-	container[id] = val;
-      }
+    /** Setter function of the map. Equivalent with map[key] = val.
+     *  This is a compatibility feature with the not dereferable maps.
+     */
+    void set(const KeyType& key, const ValueType& val) {
+      int id = getGraph()->id(key);
+      container[id] = val;
+    }
 		
-      /** Add a new key to the map. It called by the map registry.
-       */
-      void add(const KeyType& key) {
-	int id = getGraph()->id(key);
-	if (id >= (int)container.size()) {
-	  container.resize(id + 1);
-	}
+    /** Add a new key to the map. It called by the map registry.
+     */
+    void add(const KeyType& key) {
+      int id = getGraph()->id(key);
+      if (id >= (int)container.size()) {
+	container.resize(id + 1);
       }
+    }
 		
-      /** Erase a key from the map. It called by the map registry.
-       */
-      void erase(const KeyType& key) {}
-
-      /** Clear the data structure.
-       */
-      void clear() { 
-	container.clear();
-      }
-
-      class iterator;
-      class const_iterator;
-
-      /** Compatible iterator with the stl maps' iterators.
-       *  It iterates on pairs of a key and a value.
-       */
-      class iterator {
-	friend class Map;
-	friend class const_iterator;
-      private:
-
-	/** Private constructor to initalize the the iterators returned
-	 *  by the begin() and end().
-	 */
-	iterator (Map& pmap, const KeyIt& pit) : map(&pmap), it(pit) {}
-
-      public:
-
-	/** Default constructor. 
-	 */
-	iterator() {}
-
-	typedef extended_pair<const KeyType&, const KeyType&, 
-			      Map::Reference, Map::Reference> Reference;
-
-	/** Dereference operator for map.
-	 */	 
-	Reference operator*() {
-	  return Reference(it, (*map)[it]);
-	}
-
-	class Pointer {
-	  friend class iterator;
-	private:
-	  Reference data;
-	  Pointer(const KeyType& key, Map::Reference val) : data(key, val) {}
-	public:
-	  Reference* operator->() {return &data;}
-	};
-
-	/** Arrow operator for map.
-	 */	 
-	Pointer operator->() {
-	  return Pointer(it, ((*map)[it])); 
-	}
-
-	/** The pre increment operator of the map.
-	 */
-	iterator& operator++() { 
-	  ++it; 
-	  return *this; 
-	}
-
-	/** The post increment operator of the map.
-	 */
-	iterator operator++(int) { 
-	  iterator tmp(it); 
-	  ++it; 
-	  return tmp; 
-	}
-
-	/** The equality operator of the map.
-	 */
-	bool operator==(const_iterator p_it) {
-	  return p_it.it == it;
-	}
-	
-	/** The not-equality operator of the map.
-	 */
-	bool operator!=(const_iterator p_it) {
-	  return !(*this == p_it);
-	}
-
-	
-      private:
-	Map* map;
-	KeyIt it;
-      };
-
-      /** Returns the begin iterator of the map.
-       */
-      iterator begin() {
-	return iterator(*this, KeyIt(*getGraph()));
-      }
-
-      /** Returns the end iterator of the map.
-       */
-      iterator end() {
-	return iterator(*this, INVALID);
-      }
-
-      class const_iterator {
-	friend class Map;
-	friend class iterator;
-      private:
-
-	/** Private constructor to initalize the the iterators returned
-	 *  by the begin() and end().
-	 */
-	const_iterator (const Map& pmap, const KeyIt& pit) 
-	  : map(&pmap), it(pit) {}
-
-      public:
-
-	/** Default constructor. 
-	 */
-	const_iterator() {}
-
-	/** Constructor to convert iterator to const_iterator.
-	 */
-	const_iterator(iterator p_it) : map(p_it.map), it(p_it.it) {}
-      
-	typedef extended_pair<const KeyType&, const KeyType&, 
-	  Map::ConstReference, Map::ConstReference> Reference;
-
-	/** Dereference operator for map.
-	 */	 
-	Reference operator*() {
-	  return Reference(it, (*map)[it]);
-	}
-
-
-	class Pointer {
-	  friend class const_iterator;
-	private:
-	  Reference data;
-	  Pointer(const KeyType& key, Map::ConstReference val) 
-	    : data(key, val) {}
-	public:
-	  Reference* operator->() {return &data;}
-	};
-
-	/** Arrow operator for map.
-	 */	 
-	Pointer operator->() {
-	  return Pointer(it, ((*map)[it])); 
-	}
+    /** Erase a key from the map. It called by the map registry.
+     */
+    void erase(const KeyType& key) {}
 
-	/** The pre increment operator of the map.
-	 */
-	const_iterator& operator++() { 
-	  ++it; 
-	  return *this; 
-	}
+    /** Clear the data structure.
+     */
+    void clear() { 
+      container.clear();
+    }
+
+    /// The stl compatible pair iterator of the map.
+    typedef MapIterator<VectorMap> Iterator;
+    /// The stl compatible const pair iterator of the map.
+    typedef MapConstIterator<VectorMap> ConstIterator;
 
-	/** The post increment operator of the map.
-	 */
-	const_iterator operator++(int) { 
-	  const_iterator tmp(it); 
-	  ++it; 
-	  return tmp; 
-	}
+    /** Returns the begin iterator of the map.
+     */
+    Iterator begin() {
+      return Iterator(*this, KeyIt(*MapBase::getGraph()));
+    }
 
-	/** The equality operator of the map.
-	 */
-	bool operator==(const_iterator p_it) {
-	  return p_it.it == it;
-	}
-	
-	/** The not-equality operator of the map.
-	 */
-	bool operator!=(const_iterator p_it) {
-	  return !(*this == p_it);
-	}
-	
+    /** Returns the end iterator of the map.
+     */
+    Iterator end() {
+      return Iterator(*this, INVALID);
+    }
 
-      private:
-	const Map* map;
-	KeyIt it;
-      };
-
-      /** Returns the begin const_iterator of the map.
-       */
-      const_iterator begin() const {
-	return const_iterator(*this, KeyIt(*getGraph()));
-      }
+    /** Returns the begin ConstIterator of the map.
+     */
+    ConstIterator begin() const {
+      return ConstIterator(*this, KeyIt(*MapBase::getGraph()));
+    }
 
-      /** Returns the end const_iterator of the map.
-       */
-      const_iterator end() const {
-	return const_iterator(*this, INVALID);
-      }
+    /** Returns the end const_iterator of the map.
+     */
+    ConstIterator end() const {
+      return ConstIterator(*this, INVALID);
+    }
 
-      private:
+  private:
 		
-      Container container;
+    Container container;
 
-    };
 		
   };
-
   
   /// @}
   
-
 }
 
 #endif



More information about the Lemon-commits mailing list