COIN-OR::LEMON - Graph Library

Changeset 571:9632ea8be6ca in lemon-0.x for src/work/deba/map_registry.h


Ignore:
Timestamp:
05/07/04 10:18:30 (20 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@746
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/deba/map_registry.h

    r378 r571  
    2929          Container container;
    3030
    31                 Graph* graph;           
    32                
    3331               
    3432        public:
    3533       
    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                }
    3745                               
    3846                ~MapRegistry() {
    3947                        typename Container::iterator it;
    4048                        for (it = container.begin(); it != container.end(); ++it) {
    41                                 (*it)->destroy(*graph);
     49                                (*it)->destroy();
    4250                                (*it)->registry = 0;
     51                                (*it)->graph = 0;
    4352                        }
    4453                }
    4554       
    46         private:
    47                 MapRegistry(const MapRegistry& ) {}
    48                 MapRegistry& operator=(const MapRegistry& ) {}
    4955       
    5056        public:
    5157       
    52                 void add(Map& map) {
     58                void attach(Map& map) {
    5359                        if (map.registry) {
    54                                 map.registry->erase(map);
     60                                map.registry->detach(map);
    5561                        }
    5662                        container.push_back(&map);
    5763                        map.registry = this;
    5864                        map.registry_index = container.size()-1;
    59                         map.init(*graph);
     65                        map.init();
    6066                }
    6167       
    62                 void erase(Map& map_base) {
    63                         map_base.destroy(*graph);
     68                void detach(Map& map_base) {
     69                        map_base.destroy();
    6470                        container.back()->registry_index = map_base.registry_index;
    6571                        container[map_base.registry_index] = container.back();
    6672                        container.pop_back();
    6773                        map_base.registry = 0;
     74                        map_base.graph = 0;
    6875                }
    6976       
     
    8390                }
    8491
    85                 Graph& getGraph() {
    86                         return *graph;
    87                 }
    88 
    89 
    9092        };
    9193
Note: See TracChangeset for help on using the changeset viewer.