diff -r 0015642b0990 -r 6cc21a9c9fda src/work/deba/vector_map_factory.h --- a/src/work/deba/vector_map_factory.h Wed May 12 14:07:00 2004 +0000 +++ b/src/work/deba/vector_map_factory.h Thu May 13 08:20:39 2004 +0000 @@ -3,73 +3,73 @@ #include -#include "map_base.h" +#include "map_registry.h" namespace hugo { - template - class VectorMapFactory { + template + class VectorMapFactory { + public: + + typedef typename MapRegistry::Graph Graph; + typedef typename MapRegistry::Key Key; + typedef typename MapRegistry::KeyIt KeyIt; + + typedef typename MapRegistry::MapBase MapBase; + + template + class Map : public MapBase { + public: + typedef V Value; + Map() {} + + Map(Graph& g, MapRegistry& r) : MapBase(g, r) { + init(); + } + + + virtual ~Map() { + destroy(); + } - public: + + Value& operator[](const Key& key) { + int id = graph->id(key); + return container[id]; + } - typedef G Graph; - typedef K Key; - typedef KIt KeyIt; + const Value& operator[](const Key& key) const { + int id = graph->id(key); + return container[id]; + } + + const Value& get(const Key& key) const { + int id = graph->id(key); + return container[id]; + } - template - class Map : public MapBase { - public: - typedef V Value; + void set(const Key& key, const Value& val) { + int id = graph->id(key); + container[id] = val; + } + + void add(const Key& key) { + int id = graph->id(key); + if (id >= container.size()) { + container.resize(id + 1); + } + } + + void erase(const Key& key) {} - Map() {} - - Map(Graph& g, MapRegistry& r) - : MapBase(g, r) { - init(); - } - - virtual ~Map() { - destroy(); - } - - - Value& operator[](const K& key) { - int id = graph->id(key); - return container[id]; - } + private: + typedef std::vector Container; - const Value& operator[](const K& key) const { - int id = graph->id(key); - return container[id]; - } - - const Value& get(const K& key) const { - int id = graph->id(key); - return container[id]; - } + Container container; + }; - void set(const K& key, const Value& val) { - int id = graph->id(key); - container[id] = val; - } - - void add(const K& key) { - int id = graph->id(key); - if (id >= container.size()) { - container.resize(id + 1); - } - } - - void erase(const K& key) {} - - private: - typedef std::vector Container; - - Container container; - }; - - }; + }; } #endif