# HG changeset patch # User alpar # Date 1094138473 0 # Node ID d7b3b13b9df6f0796b9b6066bd301991c2536b42 # Parent a9b0863c226542512256b7e53e6c01f9b195e823 Change 'Key' to 'KeyType' (possibly temporarily). diff -r a9b0863c2265 -r d7b3b13b9df6 src/hugo/array_map_factory.h --- a/src/hugo/array_map_factory.h Thu Sep 02 15:13:21 2004 +0000 +++ b/src/hugo/array_map_factory.h Thu Sep 02 15:21:13 2004 +0000 @@ -22,7 +22,7 @@ public: typedef typename MapRegistry::Graph Graph; - typedef typename MapRegistry::Key Key; + typedef typename MapRegistry::KeyType KeyType; typedef typename MapRegistry::KeyIt KeyIt; typedef typename MapRegistry::MapBase MapBase; @@ -113,27 +113,27 @@ } - Value& operator[](const Key& key) { + Value& operator[](const KeyType& key) { int id = MapBase::getGraph()->id(key); return values[id]; } - const Value& operator[](const Key& key) const { + const Value& operator[](const KeyType& key) const { int id = MapBase::getGraph()->id(key); return values[id]; } - const Value& get(const Key& key) const { + const Value& get(const KeyType& key) const { int id = MapBase::getGraph()->id(key); return values[id]; } - void set(const Key& key, const Value& val) { + void set(const KeyType& key, const Value& val) { int id = MapBase::getGraph()->id(key); values[id] = val; } - void add(const Key& key) { + void add(const KeyType& key) { int id = MapBase::getGraph()->id(key); if (id >= capacity) { int new_capacity = (capacity == 0 ? 1 : capacity); @@ -155,7 +155,7 @@ allocator.construct(&(values[id]), Value()); } - void erase(const Key& key) { + void erase(const KeyType& key) { int id = MapBase::getGraph()->id(key); allocator.destroy(&(values[id])); } @@ -184,7 +184,7 @@ */ iterator() {} - typedef extended_pair Reference; /** Dereference operator for map. @@ -197,7 +197,7 @@ friend class iterator; private: Reference data; - Pointer(const Key& key, Value& val) : data(key, val) {} + Pointer(const KeyType& key, Value& val) : data(key, val) {} public: Reference* operator->() {return &data;} }; @@ -274,7 +274,7 @@ */ const_iterator(iterator p_it) : map(p_it.map), it(p_it.it) {} - typedef extended_pair Reference; /** Dereference operator for map. @@ -288,7 +288,7 @@ friend class const_iterator; private: Reference data; - Pointer(const Key& key, const Value& val) : data(key, val) {} + Pointer(const KeyType& key, const Value& val) : data(key, val) {} public: Reference* operator->() {return &data;} }; diff -r a9b0863c2265 -r d7b3b13b9df6 src/hugo/map_registry.h --- a/src/hugo/map_registry.h Thu Sep 02 15:13:21 2004 +0000 +++ b/src/hugo/map_registry.h Thu Sep 02 15:21:13 2004 +0000 @@ -25,7 +25,7 @@ class MapRegistry { public: typedef G Graph; - typedef K Key; + typedef K KeyType; typedef KIt KeyIt; @@ -38,7 +38,7 @@ class MapBase { public: typedef G Graph; - typedef K Key; + typedef K KeyType; typedef KIt KeyIt; typedef MapRegistry Registry; @@ -135,13 +135,13 @@ \e Add extends the map with the new node. */ - virtual void add(const Key&) = 0; + virtual void add(const KeyType&) = 0; /** The erase member function should be overloaded in the subclasses. \e Erase removes the node from the map. */ - virtual void erase(const Key&) = 0; + virtual void erase(const KeyType&) = 0; /** * The clear member function should be overloaded in the subclasses. @@ -240,7 +240,7 @@ /** * Notify all the registered maps about a Key added. */ - void add(Key& key) { + void add(KeyType& key) { typename Container::iterator it; for (it = container.begin(); it != container.end(); ++it) { (*it)->add(key); @@ -250,7 +250,7 @@ /** * Notify all the registered maps about a Key erased. */ - void erase(Key& key) { + void erase(KeyType& key) { typename Container::iterator it; for (it = container.begin(); it != container.end(); ++it) { (*it)->erase(key); diff -r a9b0863c2265 -r d7b3b13b9df6 src/hugo/sym_map_factory.h --- a/src/hugo/sym_map_factory.h Thu Sep 02 15:13:21 2004 +0000 +++ b/src/hugo/sym_map_factory.h Thu Sep 02 15:21:13 2004 +0000 @@ -35,7 +35,7 @@ public: typedef typename MapRegistry::Graph Graph; - typedef typename MapRegistry::Key Key; + typedef typename MapRegistry::KeyType KeyType; typedef typename MapRegistry::KeyIt KeyIt; typedef typename MapRegistry::MapBase MapBase; @@ -68,33 +68,33 @@ return *this; } - Value& operator[](const Key& key) { + Value& operator[](const KeyType& key) { int id = MapBase::getGraph()->id(key); return MapImpl::operator[](id >> 1); } - const Value& operator[](const Key& key) const { + const Value& operator[](const KeyType& key) const { int id = MapBase::getGraph()->id(key); return MapImpl::operator[](id >> 1); } - const Value& get(const Key& key) const { + const Value& get(const KeyType& key) const { int id = MapBase::getGraph()->id(key); return MapImpl::operator[](id >> 1); } - void set(const Key& key, const Value& val) { + void set(const KeyType& key, const Value& val) { int id = MapBase::getGraph()->id(key); MapImpl::operator[](id >> 1) = val; } - void add(const Key& key) { + void add(const KeyType& key) { int id = MapBase::getGraph()->id(key); if (id & 1) return; MapImpl::add(key); } - void erase(const Key& key) { + void erase(const KeyType& key) { int id = MapBase::getGraph()->id(key); if (id & 1) return; MapImpl::add(key); diff -r a9b0863c2265 -r d7b3b13b9df6 src/hugo/vector_map_factory.h --- a/src/hugo/vector_map_factory.h Thu Sep 02 15:13:21 2004 +0000 +++ b/src/hugo/vector_map_factory.h Thu Sep 02 15:21:13 2004 +0000 @@ -30,7 +30,7 @@ /// The graph type of the maps. typedef typename MapRegistry::Graph Graph; /// The key type of the maps. - typedef typename MapRegistry::Key Key; + typedef typename MapRegistry::KeyType KeyType; /// The iterator to iterate on the keys. typedef typename MapRegistry::KeyIt KeyIt; @@ -112,7 +112,7 @@ * The subscript operator. The map can be subscripted by the * actual keys of the graph. */ - typename Container::reference operator[](const Key& key) { + typename Container::reference operator[](const KeyType& key) { int id = getGraph()->id(key); return container[id]; } @@ -121,7 +121,7 @@ * The const subscript operator. The map can be subscripted by the * actual keys of the graph. */ - typename Container::const_reference operator[](const Key& key) const { + typename Container::const_reference operator[](const KeyType& key) const { int id = getGraph()->id(key); return container[id]; } @@ -129,14 +129,14 @@ /** Setter function of the map. Equivalent with map[key] = val. * This is a compatibility feature with the not dereferable maps. */ - void set(const Key& key, const Value& val) { + void set(const KeyType& key, const Value& 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 Key& key) { + void add(const KeyType& key) { int id = getGraph()->id(key); if (id >= container.size()) { container.resize(id + 1); @@ -145,7 +145,7 @@ /** Erase a key from the map. It called by the map registry. */ - void erase(const Key& key) {} + void erase(const KeyType& key) {} /** Clear the data structure. */ @@ -172,7 +172,7 @@ */ iterator() {} - typedef extended_pair Reference; /** Dereference operator for map. @@ -185,7 +185,7 @@ friend class iterator; private: Reference data; - Pointer(const Key& key, Value& val) : data(key, val) {} + Pointer(const KeyType& key, Value& val) : data(key, val) {} public: Reference* operator->() {return &data;} }; @@ -262,7 +262,7 @@ */ const_iterator(iterator p_it) : map(p_it.map), it(p_it.it) {} - typedef extended_pair Reference; /** Dereference operator for map. @@ -276,7 +276,7 @@ friend class const_iterator; private: Reference data; - Pointer(const Key& key, const Value& val) : data(key, val) {} + Pointer(const KeyType& key, const Value& val) : data(key, val) {} public: Reference* operator->() {return &data;} };