src/hugo/sym_map_factory.h
changeset 830 89dfa3bece81
parent 829 ef91373d37a8
child 831 b6ae3446098a
     1.1 --- a/src/hugo/sym_map_factory.h	Thu Sep 09 09:40:45 2004 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,112 +0,0 @@
     1.4 -// -*- c++ -*-
     1.5 -#ifndef SYM_MAP_FACTORY_H
     1.6 -#define SYM_MAP_FACTORY_H
     1.7 -
     1.8 -namespace hugo {
     1.9 -
    1.10 -  template <typename Graph, typename Edge, typename EdgeIt>
    1.11 -  class SymEdgeIt : public EdgeIt {
    1.12 -  public:
    1.13 -
    1.14 -    SymEdgeIt() 
    1.15 -      : EdgeIt() {}
    1.16 -
    1.17 -    SymEdgeIt(const Graph& graph) 
    1.18 -      : EdgeIt(graph) {
    1.19 -      while ( n != -1 && (n & 1)) {
    1.20 -	EdgeIt::operator++();
    1.21 -      }
    1.22 -    }
    1.23 -
    1.24 -    SymEdgeIt(Invalid invalid) 
    1.25 -      : EdgeIt(invalid) {}
    1.26 -
    1.27 -    SymEdgeIt(const Graph& graph, Edge edge)
    1.28 -      : EdgeIt(graph, edge) {}
    1.29 -
    1.30 -    SymEdgeIt& operator++() {
    1.31 -      EdgeIt::operator++();
    1.32 -      while ( n != -1 && (n & 1)) {
    1.33 -	EdgeIt::operator++();
    1.34 -      }
    1.35 -      return *this;
    1.36 -    }
    1.37 -  };
    1.38 -
    1.39 -  template <typename MapRegistry, template <typename> class MapFactory>
    1.40 -  class SymMapFactory {
    1.41 -
    1.42 -  public:
    1.43 -		
    1.44 -    typedef typename MapRegistry::Graph Graph;
    1.45 -    typedef typename MapRegistry::KeyType KeyType;
    1.46 -    typedef typename MapRegistry::KeyIt KeyIt;
    1.47 -
    1.48 -    typedef typename MapRegistry::MapBase MapBase;
    1.49 -
    1.50 -    template <typename V>
    1.51 -    class Map : public MapFactory<MapRegistry>::template Map<V> {
    1.52 -
    1.53 -      typedef typename MapFactory<MapRegistry>::template Map<V> MapImpl;
    1.54 -    public:
    1.55 -
    1.56 -      typedef V Value;
    1.57 -
    1.58 -      Map() : MapImpl() {}
    1.59 -
    1.60 -      Map(const Graph& g, MapRegistry& r) : MapImpl(g, r) {}
    1.61 -
    1.62 -      Map(const Graph& g, MapRegistry& r, const Value& v) 
    1.63 -	: MapImpl(g, r, v) {}
    1.64 -
    1.65 -      Map(const Map& copy) : MapImpl(static_cast<const MapImpl&>(copy)) {}
    1.66 -
    1.67 -      template <typename CMap> Map(const CMap& copy) : MapImpl(copy) {}
    1.68 -
    1.69 -      Map& operator=(const Map& copy) {
    1.70 -	MapImpl::operator=(static_cast<const MapImpl&>(copy));
    1.71 -	return *this;
    1.72 -      }
    1.73 -
    1.74 -      template <typename CMap> Map& operator=(const CMap& copy) {
    1.75 -	MapImpl::operator=(copy);
    1.76 -	return *this;
    1.77 -      }
    1.78 -   
    1.79 -      Value& operator[](const KeyType& key) {
    1.80 -	int id = MapBase::getGraph()->id(key);	
    1.81 -	return MapImpl::operator[](id >> 1);
    1.82 -      } 
    1.83 -		
    1.84 -      const Value& operator[](const KeyType& key) const {
    1.85 -	int id = MapBase::getGraph()->id(key);
    1.86 -	return MapImpl::operator[](id >> 1);
    1.87 -      }
    1.88 -	
    1.89 -      const Value& get(const KeyType& key) const {
    1.90 -	int id = MapBase::getGraph()->id(key);
    1.91 -	return MapImpl::operator[](id >> 1);
    1.92 -      } 
    1.93 -		
    1.94 -      void set(const KeyType& key, const Value& val) {
    1.95 -	int id = MapBase::getGraph()->id(key);
    1.96 -	MapImpl::operator[](id >> 1) = val;
    1.97 -      }
    1.98 -		
    1.99 -      void add(const KeyType& key) {
   1.100 -	int id = MapBase::getGraph()->id(key);
   1.101 -	if (id & 1) return;
   1.102 -	MapImpl::add(key);
   1.103 -      }
   1.104 -		
   1.105 -      void erase(const KeyType& key) {
   1.106 -	int id = MapBase::getGraph()->id(key);
   1.107 -	if (id & 1) return;
   1.108 -	MapImpl::add(key);
   1.109 -      }
   1.110 -
   1.111 -
   1.112 -    };  
   1.113 -  };
   1.114 -}
   1.115 -#endif