diff -r 38755a4d4b51 -r 7ec5e7e6c7b4 src/work/deba/map_registry.h --- a/src/work/deba/map_registry.h Fri Jun 04 16:05:20 2004 +0000 +++ b/src/work/deba/map_registry.h Tue Jun 08 06:44:05 2004 +0000 @@ -5,15 +5,14 @@ using namespace std; +namespace hugo { + /** Registry class to register edge or node maps in the graph. The registry helps you to implement an observer pattern. If you add or erase an edge or node you must notify all the maps about the event. */ - -namespace hugo { - template class MapRegistry { public: @@ -23,6 +22,10 @@ + ///. + + ///. + /// class MapBase { public: typedef G Graph; @@ -137,10 +140,13 @@ public: + ///. MapRegistry() {} + ///. MapRegistry(const MapRegistry&) {} + ///. MapRegistry& operator=(const MapRegistry&) { for (it = container.begin(); it != container.end(); ++it) { (*it)->destroy(); @@ -149,6 +155,7 @@ } } + ///. ~MapRegistry() { typename Container::iterator it; for (it = container.begin(); it != container.end(); ++it) { @@ -161,6 +168,7 @@ public: + ///. void attach(MapBase& map) { if (map.registry) { map.registry->detach(map); @@ -170,6 +178,7 @@ map.registry_index = container.size()-1; } + ///. void detach(MapBase& map) { container.back()->registry_index = map.registry_index; container[map.registry_index] = container.back(); @@ -179,6 +188,7 @@ } + ///. virtual void add(Key& key) { typename Container::iterator it; for (it = container.begin(); it != container.end(); ++it) { @@ -186,6 +196,7 @@ } } + ///. virtual void erase(Key& key) { typename Container::iterator it; for (it = container.begin(); it != container.end(); ++it) {