src/lemon/default_map.h
changeset 980 0f1044b7a3af
parent 979 b5fb023cdb7b
child 987 87f7c54892df
     1.1 --- a/src/lemon/default_map.h	Wed Nov 10 21:59:59 2004 +0000
     1.2 +++ b/src/lemon/default_map.h	Thu Nov 11 09:31:55 2004 +0000
     1.3 @@ -42,97 +42,97 @@
     1.4  
     1.5  
     1.6  
     1.7 -  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap, typename _Value>
     1.8 +  template <typename _Graph, typename _Item, typename _ItemIt, typename _Value>
     1.9    struct DefaultMapSelector {
    1.10 -    typedef ArrayMap<_Graph, _Item, _ItemIt, _IdMap, _Value> Map;
    1.11 +    typedef ArrayMap<_Graph, _Item, _ItemIt, _Value> Map;
    1.12    };
    1.13  
    1.14    // bool
    1.15 -  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
    1.16 -  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, bool> {
    1.17 -    typedef VectorMap<_Graph, _Item, _IdMap, bool> Map;
    1.18 +  template <typename _Graph, typename _Item, typename _ItemIt>
    1.19 +  struct DefaultMapSelector<_Graph, _Item, _ItemIt, bool> {
    1.20 +    typedef VectorMap<_Graph, _Item, bool> Map;
    1.21    };
    1.22  
    1.23    // char
    1.24 -  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
    1.25 -  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, char> {
    1.26 -    typedef VectorMap<_Graph, _Item, _IdMap, char> Map;
    1.27 +  template <typename _Graph, typename _Item, typename _ItemIt>
    1.28 +  struct DefaultMapSelector<_Graph, _Item, _ItemIt, char> {
    1.29 +    typedef VectorMap<_Graph, _Item, char> Map;
    1.30    };
    1.31  
    1.32 -  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
    1.33 -  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, signed char> {
    1.34 -    typedef VectorMap<_Graph, _Item, _IdMap, signed char> Map;
    1.35 +  template <typename _Graph, typename _Item, typename _ItemIt>
    1.36 +  struct DefaultMapSelector<_Graph, _Item, _ItemIt, signed char> {
    1.37 +    typedef VectorMap<_Graph, _Item, signed char> Map;
    1.38    };
    1.39  
    1.40 -  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
    1.41 -  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, unsigned char> {
    1.42 -    typedef VectorMap<_Graph, _Item, _IdMap, unsigned char> Map;
    1.43 +  template <typename _Graph, typename _Item, typename _ItemIt>
    1.44 +  struct DefaultMapSelector<_Graph, _Item, _ItemIt, unsigned char> {
    1.45 +    typedef VectorMap<_Graph, _Item, unsigned char> Map;
    1.46    };
    1.47  
    1.48  
    1.49    // int
    1.50 -  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
    1.51 -  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, signed int> {
    1.52 -    typedef VectorMap<_Graph, _Item, _IdMap, signed int> Map;
    1.53 +  template <typename _Graph, typename _Item, typename _ItemIt>
    1.54 +  struct DefaultMapSelector<_Graph, _Item, _ItemIt, signed int> {
    1.55 +    typedef VectorMap<_Graph, _Item, signed int> Map;
    1.56    };
    1.57  
    1.58 -  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
    1.59 -  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, unsigned int> {
    1.60 -    typedef VectorMap<_Graph, _Item, _IdMap, unsigned int> Map;
    1.61 +  template <typename _Graph, typename _Item, typename _ItemIt>
    1.62 +  struct DefaultMapSelector<_Graph, _Item, _ItemIt, unsigned int> {
    1.63 +    typedef VectorMap<_Graph, _Item, unsigned int> Map;
    1.64    };
    1.65  
    1.66  
    1.67    // short
    1.68 -  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
    1.69 -  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, signed short> {
    1.70 -    typedef VectorMap<_Graph, _Item, _IdMap, signed short> Map;
    1.71 +  template <typename _Graph, typename _Item, typename _ItemIt>
    1.72 +  struct DefaultMapSelector<_Graph, _Item, _ItemIt, signed short> {
    1.73 +    typedef VectorMap<_Graph, _Item, signed short> Map;
    1.74    };
    1.75  
    1.76 -  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
    1.77 -  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, unsigned short> {
    1.78 -    typedef VectorMap<_Graph, _Item, _IdMap, unsigned short> Map;
    1.79 +  template <typename _Graph, typename _Item, typename _ItemIt>
    1.80 +  struct DefaultMapSelector<_Graph, _Item, _ItemIt, unsigned short> {
    1.81 +    typedef VectorMap<_Graph, _Item, unsigned short> Map;
    1.82    };
    1.83  
    1.84  
    1.85    // long
    1.86 -  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
    1.87 -  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, signed long> {
    1.88 -    typedef VectorMap<_Graph, _Item, _IdMap, signed long> Map;
    1.89 +  template <typename _Graph, typename _Item, typename _ItemIt>
    1.90 +  struct DefaultMapSelector<_Graph, _Item, _ItemIt, signed long> {
    1.91 +    typedef VectorMap<_Graph, _Item, signed long> Map;
    1.92    };
    1.93  
    1.94 -  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
    1.95 -  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, unsigned long> {
    1.96 -    typedef VectorMap<_Graph, _Item, _IdMap, unsigned long> Map;
    1.97 +  template <typename _Graph, typename _Item, typename _ItemIt>
    1.98 +  struct DefaultMapSelector<_Graph, _Item, _ItemIt, unsigned long> {
    1.99 +    typedef VectorMap<_Graph, _Item, unsigned long> Map;
   1.100    };
   1.101  
   1.102    // \todo handling long long type
   1.103  
   1.104  
   1.105    // float
   1.106 -  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
   1.107 -  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, float> {
   1.108 -    typedef VectorMap<_Graph, _Item, _IdMap, float> Map;
   1.109 +  template <typename _Graph, typename _Item, typename _ItemIt>
   1.110 +  struct DefaultMapSelector<_Graph, _Item, _ItemIt, float> {
   1.111 +    typedef VectorMap<_Graph, _Item, float> Map;
   1.112    };
   1.113  
   1.114  
   1.115    // double
   1.116 -  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
   1.117 -  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, double> {
   1.118 -    typedef VectorMap<_Graph, _Item, _IdMap,  double> Map;
   1.119 +  template <typename _Graph, typename _Item, typename _ItemIt>
   1.120 +  struct DefaultMapSelector<_Graph, _Item, _ItemIt, double> {
   1.121 +    typedef VectorMap<_Graph, _Item,  double> Map;
   1.122    };
   1.123  
   1.124  
   1.125    // long double
   1.126 -  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap>
   1.127 -  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, long double> {
   1.128 -    typedef VectorMap<_Graph, _Item, _IdMap, long double> Map;
   1.129 +  template <typename _Graph, typename _Item, typename _ItemIt>
   1.130 +  struct DefaultMapSelector<_Graph, _Item, _ItemIt, long double> {
   1.131 +    typedef VectorMap<_Graph, _Item, long double> Map;
   1.132    };
   1.133  
   1.134  
   1.135    // pointer
   1.136 -  template <typename _Graph, typename _Item, typename _ItemIt, typename _IdMap, typename _Ptr>
   1.137 -  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, _Ptr*> {
   1.138 -    typedef VectorMap<_Graph, _Item, _IdMap, _Ptr*> Map;
   1.139 +  template <typename _Graph, typename _Item, typename _ItemIt, typename _Ptr>
   1.140 +  struct DefaultMapSelector<_Graph, _Item, _ItemIt, _Ptr*> {
   1.141 +    typedef VectorMap<_Graph, _Item, _Ptr*> Map;
   1.142    };
   1.143  
   1.144  
   1.145 @@ -140,19 +140,17 @@
   1.146    template <typename _Graph, 
   1.147  	    typename _Item,
   1.148  	    typename _ItemIt,
   1.149 -	    typename _IdMap,
   1.150  	    typename _Value>
   1.151 -  class DefaultMap : public DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, _Value>::Map {
   1.152 +  class DefaultMap : public DefaultMapSelector<_Graph, _Item, _ItemIt, _Value>::Map {
   1.153    public:
   1.154 -    typedef typename DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap, _Value>::Map Parent;
   1.155 -    typedef DefaultMap<_Graph, _Item, _ItemIt, _IdMap, bool> Map;
   1.156 +    typedef typename DefaultMapSelector<_Graph, _Item, _ItemIt, _Value>::Map Parent;
   1.157 +    typedef DefaultMap<_Graph, _Item, _ItemIt, _Value> Map;
   1.158      
   1.159      typedef typename Parent::Graph Graph;
   1.160 -    typedef typename Parent::Registry Registry;
   1.161      typedef typename Parent::ValueType ValueType;
   1.162  
   1.163 -    DefaultMap(const Graph& _g, Registry& _r) : Parent(_g, _r) {}
   1.164 -    DefaultMap(const Graph& _g, Registry& _r, const ValueType& _v) : Parent(_g, _r, _v) {}
   1.165 +    DefaultMap(const Graph& _g) : Parent(_g) {}
   1.166 +    DefaultMap(const Graph& _g, const ValueType& _v) : Parent(_g, _v) {}
   1.167    };
   1.168  
   1.169  
   1.170 @@ -166,55 +164,48 @@
   1.171  
   1.172      typedef typename Parent::Node Node;
   1.173      typedef typename Parent::NodeIt NodeIt;
   1.174 -    typedef typename Parent::NodeIdMap NodeIdMap;
   1.175 -    typedef typename Parent::NodeObserverRegistry NodeObserverRegistry;
   1.176  
   1.177      typedef typename Parent::Edge Edge;
   1.178      typedef typename Parent::EdgeIt EdgeIt;
   1.179 -    typedef typename Parent::EdgeIdMap EdgeIdMap;
   1.180 -    typedef typename Parent::EdgeObserverRegistry EdgeObserverRegistry;
   1.181  
   1.182      
   1.183 -
   1.184      template <typename _Value>
   1.185 -    class NodeMap : public DefaultMap<Graph, Node, NodeIt, NodeIdMap, _Value> {
   1.186 +    class NodeMap : public DefaultMap<Graph, Node, NodeIt, _Value> {
   1.187      public:
   1.188        typedef DefaultMappableGraphExtender<_Base> Graph;
   1.189  
   1.190        typedef typename Graph::Node Node;
   1.191        typedef typename Graph::NodeIt NodeIt;
   1.192 -      typedef typename Graph::NodeIdMap NodeIdMap;
   1.193  
   1.194 -      typedef DefaultMap<Graph, Node, NodeIt, NodeIdMap, _Value> Parent;
   1.195 +      typedef DefaultMap<Graph, Node, NodeIt, _Value> Parent;
   1.196  
   1.197        //typedef typename Parent::Graph Graph;
   1.198        typedef typename Parent::ValueType ValueType;
   1.199  
   1.200 -      NodeMap(const Graph& g) 
   1.201 -	: Parent(g, g.getNodeObserverRegistry()) {}
   1.202 -      NodeMap(const Graph& g, const ValueType& v) 
   1.203 -	: Parent(g, g.getNodeObserverRegistry(), v) {}
   1.204 +      NodeMap(const Graph& _g) 
   1.205 +	: Parent(_g) {}
   1.206 +      NodeMap(const Graph& _g, const ValueType& _v) 
   1.207 +	: Parent(_g, _v) {}
   1.208  
   1.209      };
   1.210  
   1.211      template <typename _Value>
   1.212 -    class EdgeMap : public DefaultMap<Graph, Edge, EdgeIt, EdgeIdMap, _Value> {
   1.213 +    class EdgeMap : public DefaultMap<Graph, Edge, EdgeIt, _Value> {
   1.214      public:
   1.215        typedef DefaultMappableGraphExtender<_Base> Graph;
   1.216  
   1.217        typedef typename Graph::Edge Edge;
   1.218        typedef typename Graph::EdgeIt EdgeIt;
   1.219 -      typedef typename Graph::EdgeIdMap EdgeIdMap;
   1.220  
   1.221 -      typedef DefaultMap<Graph, Edge, EdgeIt, EdgeIdMap, _Value> Parent;
   1.222 +      typedef DefaultMap<Graph, Edge, EdgeIt, _Value> Parent;
   1.223  
   1.224        //typedef typename Parent::Graph Graph;
   1.225        typedef typename Parent::ValueType ValueType;
   1.226  
   1.227 -      EdgeMap(const Graph& g) 
   1.228 -	: Parent(g, g.getEdgeObserverRegistry()) {}
   1.229 -      EdgeMap(const Graph& g, const ValueType& v) 
   1.230 -	: Parent(g, g.getEdgeObserverRegistry(), v) {}
   1.231 +      EdgeMap(const Graph& _g) 
   1.232 +	: Parent(_g) {}
   1.233 +      EdgeMap(const Graph& _g, const ValueType& _v) 
   1.234 +	: Parent(_g, _v) {}
   1.235  
   1.236      };
   1.237