diff -r 23a608ba40ab -r e10b5e9419ef src/work/deba/pac_map_factory.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/work/deba/pac_map_factory.h Mon May 10 13:49:35 2004 +0000 @@ -0,0 +1,73 @@ +#ifndef PAC_MAP_FACTORY_H +#define PAC_MAP_FACTORY_H + +#include "map_base.h" + +/** + Converter class to use the standard template + libary's pair associative containers as a graph map. +*/ + +namespace hugo { + + template class PAC> + class PacMapFactory { + + + public: + + typedef G Graph; + typedef K Key; + typedef KIt KeyIt; + + template + class Map : public MapBase { + public: + typedef V Value; + + Map() {} + + Map(Graph& g, MapRegistry& r) + : MapBase(g, r) { + init(); + } + + virtual ~Map() { + destroy(); + } + + + V& operator[](const K& key) { + return container.find(key)->second; + } + + const V& operator[](const K& key) const { + return container.find(key)->second; + } + + const V& get(const K& key) const { + return container.find(key)->second; + } + + void set(const K& key, const V& value) { + container.find(key)->second = value; + } + + void add(const K& key) { + container.insert(key); + } + + void erase(const K& key) { + container.erase(key); + } + + private: + typedef PAC Container; + + Container container; + }; + + }; +} + +#endif \ No newline at end of file