src/work/deba/edge_map_base.h
changeset 378 c3f93631cd24
parent 377 33fe0ee01dc5
child 379 a5bff2813c4d
     1.1 --- a/src/work/deba/edge_map_base.h	Thu Apr 22 16:36:57 2004 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,121 +0,0 @@
     1.4 -#ifndef EDGE_MAP_BASE_H
     1.5 -#define EDGE_MAP_BASE_H
     1.6 -
     1.7 -/**
     1.8 -	Template base class for implementing mapping on edges.
     1.9 -	\param The first template parameter is the Graph class. The Graph
    1.10 -		must have an \emp edge_maps member with \emp EdgeMapRegistry class.
    1.11 -	\param The second template parameter is the Edge type of the class.
    1.12 -	
    1.13 -*/
    1.14 -
    1.15 -template <typename G, typename K>
    1.16 -class EdgeMapBase {
    1.17 -
    1.18 -#include "edge_map_registry.h"
    1.19 -
    1.20 -public:
    1.21 -	typedef G Graph;
    1.22 -	friend class EdgeMapRegistry<G, K>;
    1.23 -
    1.24 -	typedef K KeyType;
    1.25 -	
    1.26 -	/** 
    1.27 -		Default constructor.
    1.28 -	*/	
    1.29 -	
    1.30 -	EdgeMapBase() : graph(0) {}
    1.31 -
    1.32 -	/** 
    1.33 -		Simple constructor to register into a graph.
    1.34 -	*/
    1.35 -	
    1.36 -	EdgeMapBase(Graph& g) : graph(&g) {
    1.37 -		graph->edge_maps.add(*this);
    1.38 -	}
    1.39 -
    1.40 -	/** 
    1.41 -		Copy constructor with registering into the map.
    1.42 -	*/	
    1.43 -	
    1.44 -	EdgeMapBase(const EdgeMapBase& copy) : graph(copy.graph) {
    1.45 -		if (graph) {
    1.46 -			graph->edge_maps.add(*this);
    1.47 -		}
    1.48 -	} 
    1.49 -	
    1.50 -	/** 
    1.51 -		Assign operator.
    1.52 -	*/	
    1.53 -
    1.54 -	const EdgeMapBase& operator=(const EdgeMapBase& copy) {
    1.55 -		if (graph) {
    1.56 -			graph.edge_maps.erase(*this);
    1.57 -		}
    1.58 -		graph = copy.graph;
    1.59 -		if (graph) {
    1.60 -			graph->edge_maps.add(*this);
    1.61 -		}
    1.62 -		
    1.63 -	}
    1.64 -	
    1.65 -
    1.66 -	/** 
    1.67 -		Destructor.
    1.68 -	*/	
    1.69 -
    1.70 -	virtual ~EdgeMapBase() {
    1.71 -		if (graph) {
    1.72 -			graph.edge_maps.erase(*this);
    1.73 -		}
    1.74 -	}
    1.75 -	
    1.76 -protected:
    1.77 -	
    1.78 -	Graph* graph;
    1.79 -
    1.80 -	int graph_index;
    1.81 -	
    1.82 -	/**
    1.83 -		Helper function to implement the default constructor in the subclasses.
    1.84 -	*/
    1.85 -	
    1.86 -	void init() {
    1.87 -		for (typename Graph::EdgeIt it(g); g.valid(it); g.next(it)) {
    1.88 -			add(it);
    1.89 -		}
    1.90 -	}
    1.91 -	
    1.92 -	/**
    1.93 -		Helper function to implement the destructor in the subclasses.
    1.94 -	*/
    1.95 -	
    1.96 -	void destroy() {
    1.97 -		for (typename Graph::EdgeIt it(g); g.valid(it); g.next(it)) {
    1.98 -			erase(it);
    1.99 -		}
   1.100 -	}
   1.101 -	
   1.102 -	/** 
   1.103 -		The add member function should be overloaded in the subclasses.
   1.104 -		\e Add extends the map with the new edge.
   1.105 -	*/
   1.106 -	
   1.107 -	virtual void add(const KeyType&) = 0;
   1.108 -	
   1.109 -	/** 
   1.110 -		The erase member function should be overloaded in the subclasses.
   1.111 -		\e Erase removes the edge from the map.
   1.112 -	*/
   1.113 -	
   1.114 -	virtual void erase(const KeyType&) = 0;
   1.115 -	
   1.116 -	/**
   1.117 -		Exception class to throw at unsupported operation.
   1.118 -	*/
   1.119 -	
   1.120 -	class NotSupportedOperationException {};
   1.121 -
   1.122 -};
   1.123 -
   1.124 -#endif