[Lemon-commits] [lemon_svn] alpar: r1079 - hugo/trunk/src/hugo
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:43:08 CET 2006
Author: alpar
Date: Thu Sep 2 17:21:13 2004
New Revision: 1079
Modified:
hugo/trunk/src/hugo/array_map_factory.h
hugo/trunk/src/hugo/map_registry.h
hugo/trunk/src/hugo/sym_map_factory.h
hugo/trunk/src/hugo/vector_map_factory.h
Log:
Change 'Key' to 'KeyType' (possibly temporarily).
Modified: hugo/trunk/src/hugo/array_map_factory.h
==============================================================================
--- hugo/trunk/src/hugo/array_map_factory.h (original)
+++ hugo/trunk/src/hugo/array_map_factory.h Thu Sep 2 17:21:13 2004
@@ -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<const Key&, const Key&,
+ typedef extended_pair<const KeyType&, const KeyType&,
Value&, Value&> 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<const Key&, const Key&,
+ typedef extended_pair<const KeyType&, const KeyType&,
const Value&, const Value&> 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;}
};
Modified: hugo/trunk/src/hugo/map_registry.h
==============================================================================
--- hugo/trunk/src/hugo/map_registry.h (original)
+++ hugo/trunk/src/hugo/map_registry.h Thu Sep 2 17:21:13 2004
@@ -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<G, K, KIt> 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);
Modified: hugo/trunk/src/hugo/sym_map_factory.h
==============================================================================
--- hugo/trunk/src/hugo/sym_map_factory.h (original)
+++ hugo/trunk/src/hugo/sym_map_factory.h Thu Sep 2 17:21:13 2004
@@ -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);
Modified: hugo/trunk/src/hugo/vector_map_factory.h
==============================================================================
--- hugo/trunk/src/hugo/vector_map_factory.h (original)
+++ hugo/trunk/src/hugo/vector_map_factory.h Thu Sep 2 17:21:13 2004
@@ -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<const Key&, const Key&,
+ typedef extended_pair<const KeyType&, const KeyType&,
Value&, Value&> 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<const Key&, const Key&,
+ typedef extended_pair<const KeyType&, const KeyType&,
const Value&, const Value&> 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;}
};
More information about the Lemon-commits
mailing list