Changeset 571:9632ea8be6ca in lemon-0.x for src/work/deba/map_registry.h
- Timestamp:
- 05/07/04 10:18:30 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@746
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/deba/map_registry.h
r378 r571 29 29 Container container; 30 30 31 Graph* graph;32 33 31 34 32 public: 35 33 36 MapRegistry(Graph& g) : container(0), graph(&g) {} 34 MapRegistry() {} 35 36 MapRegistry(const MapRegistry&) {} 37 38 MapRegistry& operator=(const MapRegistry&) { 39 for (it = container.begin(); it != container.end(); ++it) { 40 (*it)->destroy(); 41 (*it)->graph = 0; 42 (*it)->registry = 0; 43 } 44 } 37 45 38 46 ~MapRegistry() { 39 47 typename Container::iterator it; 40 48 for (it = container.begin(); it != container.end(); ++it) { 41 (*it)->destroy( *graph);49 (*it)->destroy(); 42 50 (*it)->registry = 0; 51 (*it)->graph = 0; 43 52 } 44 53 } 45 54 46 private:47 MapRegistry(const MapRegistry& ) {}48 MapRegistry& operator=(const MapRegistry& ) {}49 55 50 56 public: 51 57 52 void a dd(Map& map) {58 void attach(Map& map) { 53 59 if (map.registry) { 54 map.registry-> erase(map);60 map.registry->detach(map); 55 61 } 56 62 container.push_back(&map); 57 63 map.registry = this; 58 64 map.registry_index = container.size()-1; 59 map.init( *graph);65 map.init(); 60 66 } 61 67 62 void erase(Map& map_base) {63 map_base.destroy( *graph);68 void detach(Map& map_base) { 69 map_base.destroy(); 64 70 container.back()->registry_index = map_base.registry_index; 65 71 container[map_base.registry_index] = container.back(); 66 72 container.pop_back(); 67 73 map_base.registry = 0; 74 map_base.graph = 0; 68 75 } 69 76 … … 83 90 } 84 91 85 Graph& getGraph() {86 return *graph;87 }88 89 90 92 }; 91 93
Note: See TracChangeset
for help on using the changeset viewer.