deba@340: #ifndef VECTOR_MAP_H
deba@340: #define VECTOR_MAP_H
deba@340: 
deba@340: #include <vector>
deba@378: #include <iostream>
deba@340: 
deba@378: #include "map_base.h"
deba@378: 
deba@378: namespace hugo {
deba@378: 
deba@378: 	template <typename G, typename K, typename KIt, typename V> 
deba@378: 	class VectorMap : public MapBase<G, K, KIt> {
deba@378: 	public:
deba@378: 		typedef V ValueType;
deba@340: 	
deba@378: 		VectorMap() {}
deba@378: 		VectorMap(typename MapBase<G, K, KIt>::Registry& r) : MapBase<G, K, KIt>(r) {}
deba@340: 	
deba@340: 	
deba@378: 		ValueType& operator[](const K& key) {
deba@378: 			int id = registry->getGraph().id(key);
deba@378: 			return container[id];
deba@378: 		} 
deba@340: 	
deba@378: 		const ValueType& operator[](const K& key) const {
deba@378: 			int id = registry->getGraph().id(key);
deba@378: 			return container[id];
deba@378: 		}
deba@340: 	
deba@378: 		const ValueType& get(const K& key) const {
deba@378: 			int id = registry->getGraph().id(key);
deba@378: 			return container[id];
deba@378: 		} 
deba@340: 	
deba@378: 		void set(const K& key, const ValueType& val) {
deba@378: 			int id = registry->getGraph().id(key);
deba@378: 			container[id] = val;
deba@378: 		}
deba@340: 	
deba@378: 		void add(const K& key) {
deba@378: 			int id = registry->getGraph().id(key);
deba@378: 			std::cerr << id << std::endl;
deba@378: 			if (id >= container.size()) {
deba@378: 				container.resize(id + 1);
deba@378: 			}
deba@377: 		}
deba@340: 	
deba@378: 		void erase(const K& key) {}
deba@340: 
deba@378: 	private:
deba@378: 		typedef std::vector<ValueType> Container;
deba@340: 	
deba@378: 		Container container;
deba@378: 	};
deba@378: 
deba@378: }
deba@340: 
deba@340: #endif