1.1 --- a/src/work/deba/map_base.h Fri May 07 08:02:17 2004 +0000
1.2 +++ b/src/work/deba/map_base.h Fri May 07 08:18:30 2004 +0000
1.3 @@ -39,17 +39,17 @@
1.4 Simple constructor to register into a graph registry.
1.5 */
1.6
1.7 - MapBase(Registry& r) : registry(0) {
1.8 - registry->add(*this);
1.9 + MapBase(Graph& g, Registry& r) : graph(&g), registry(0) {
1.10 + registry->attach(*this);
1.11 }
1.12
1.13 /**
1.14 Copy constructor with registering into the map.
1.15 */
1.16
1.17 - MapBase(const MapBase& copy) : registry(0) {
1.18 - if (registry) {
1.19 - registry->add(*this);
1.20 + MapBase(const MapBase& copy) : registry(0), graph(copy.graph) {
1.21 + if (copy.registry) {
1.22 + copy.registry->attach(*this);
1.23 }
1.24 }
1.25
1.26 @@ -59,11 +59,11 @@
1.27
1.28 const MapBase& operator=(const MapBase& copy) {
1.29 if (registry) {
1.30 - registry->erase(*this);
1.31 + registry->detach(*this);
1.32 }
1.33 - registry = copy.registry;
1.34 - if (registry) {
1.35 - registry->add(*this);
1.36 + graph = copy.graph;
1.37 + if (copy.registry) {
1.38 + copy.registry->attach(*this);
1.39 }
1.40 }
1.41
1.42 @@ -74,13 +74,14 @@
1.43
1.44 virtual ~MapBase() {
1.45 if (registry) {
1.46 - registry->erase(*this);
1.47 + registry->detach(*this);
1.48 }
1.49 }
1.50
1.51 protected:
1.52
1.53 Registry* registry;
1.54 + Graph* graph;
1.55
1.56 int registry_index;
1.57
1.58 @@ -88,9 +89,9 @@
1.59 Helper function to implement the default constructor in the subclasses.
1.60 */
1.61
1.62 - virtual void init(Graph& g) {
1.63 + virtual void init() {
1.64
1.65 - for (KeyIt it(g); g.valid(it); g.next(it)) {
1.66 + for (KeyIt it(*graph); graph->valid(it); graph->next(it)) {
1.67 add(it);
1.68 }
1.69 }
1.70 @@ -99,8 +100,8 @@
1.71 Helper function to implement the destructor in the subclasses.
1.72 */
1.73
1.74 - virtual void destroy(Graph& g) {
1.75 - for (KeyIt it(g); g.valid(it); g.next(it)) {
1.76 + virtual void destroy() {
1.77 + for (KeyIt it(*graph); graph->valid(it); graph->next(it)) {
1.78 erase(it);
1.79 }
1.80 }