Changeset 980:0f1044b7a3af in lemon-0.x for src/lemon/default_map.h
- Timestamp:
- 11/11/04 10:31:55 (18 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1368
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/lemon/default_map.h
r979 r980 43 43 44 44 45 template <typename _Graph, typename _Item, typename _ItemIt, typename _ IdMap, typename _Value>45 template <typename _Graph, typename _Item, typename _ItemIt, typename _Value> 46 46 struct DefaultMapSelector { 47 typedef ArrayMap<_Graph, _Item, _ItemIt, _ IdMap, _Value> Map;47 typedef ArrayMap<_Graph, _Item, _ItemIt, _Value> Map; 48 48 }; 49 49 50 50 // bool 51 template <typename _Graph, typename _Item, typename _ItemIt , typename _IdMap>52 struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap,bool> {53 typedef VectorMap<_Graph, _Item, _IdMap,bool> Map;51 template <typename _Graph, typename _Item, typename _ItemIt> 52 struct DefaultMapSelector<_Graph, _Item, _ItemIt, bool> { 53 typedef VectorMap<_Graph, _Item, bool> Map; 54 54 }; 55 55 56 56 // char 57 template <typename _Graph, typename _Item, typename _ItemIt , typename _IdMap>58 struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap,char> {59 typedef VectorMap<_Graph, _Item, _IdMap,char> Map;60 }; 61 62 template <typename _Graph, typename _Item, typename _ItemIt , typename _IdMap>63 struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap,signed char> {64 typedef VectorMap<_Graph, _Item, _IdMap,signed char> Map;65 }; 66 67 template <typename _Graph, typename _Item, typename _ItemIt , typename _IdMap>68 struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap,unsigned char> {69 typedef VectorMap<_Graph, _Item, _IdMap,unsigned char> Map;57 template <typename _Graph, typename _Item, typename _ItemIt> 58 struct DefaultMapSelector<_Graph, _Item, _ItemIt, char> { 59 typedef VectorMap<_Graph, _Item, char> Map; 60 }; 61 62 template <typename _Graph, typename _Item, typename _ItemIt> 63 struct DefaultMapSelector<_Graph, _Item, _ItemIt, signed char> { 64 typedef VectorMap<_Graph, _Item, signed char> Map; 65 }; 66 67 template <typename _Graph, typename _Item, typename _ItemIt> 68 struct DefaultMapSelector<_Graph, _Item, _ItemIt, unsigned char> { 69 typedef VectorMap<_Graph, _Item, unsigned char> Map; 70 70 }; 71 71 72 72 73 73 // int 74 template <typename _Graph, typename _Item, typename _ItemIt , typename _IdMap>75 struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap,signed int> {76 typedef VectorMap<_Graph, _Item, _IdMap,signed int> Map;77 }; 78 79 template <typename _Graph, typename _Item, typename _ItemIt , typename _IdMap>80 struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap,unsigned int> {81 typedef VectorMap<_Graph, _Item, _IdMap,unsigned int> Map;74 template <typename _Graph, typename _Item, typename _ItemIt> 75 struct DefaultMapSelector<_Graph, _Item, _ItemIt, signed int> { 76 typedef VectorMap<_Graph, _Item, signed int> Map; 77 }; 78 79 template <typename _Graph, typename _Item, typename _ItemIt> 80 struct DefaultMapSelector<_Graph, _Item, _ItemIt, unsigned int> { 81 typedef VectorMap<_Graph, _Item, unsigned int> Map; 82 82 }; 83 83 84 84 85 85 // short 86 template <typename _Graph, typename _Item, typename _ItemIt , typename _IdMap>87 struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap,signed short> {88 typedef VectorMap<_Graph, _Item, _IdMap,signed short> Map;89 }; 90 91 template <typename _Graph, typename _Item, typename _ItemIt , typename _IdMap>92 struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap,unsigned short> {93 typedef VectorMap<_Graph, _Item, _IdMap,unsigned short> Map;86 template <typename _Graph, typename _Item, typename _ItemIt> 87 struct DefaultMapSelector<_Graph, _Item, _ItemIt, signed short> { 88 typedef VectorMap<_Graph, _Item, signed short> Map; 89 }; 90 91 template <typename _Graph, typename _Item, typename _ItemIt> 92 struct DefaultMapSelector<_Graph, _Item, _ItemIt, unsigned short> { 93 typedef VectorMap<_Graph, _Item, unsigned short> Map; 94 94 }; 95 95 96 96 97 97 // long 98 template <typename _Graph, typename _Item, typename _ItemIt , typename _IdMap>99 struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap,signed long> {100 typedef VectorMap<_Graph, _Item, _IdMap,signed long> Map;101 }; 102 103 template <typename _Graph, typename _Item, typename _ItemIt , typename _IdMap>104 struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap,unsigned long> {105 typedef VectorMap<_Graph, _Item, _IdMap,unsigned long> Map;98 template <typename _Graph, typename _Item, typename _ItemIt> 99 struct DefaultMapSelector<_Graph, _Item, _ItemIt, signed long> { 100 typedef VectorMap<_Graph, _Item, signed long> Map; 101 }; 102 103 template <typename _Graph, typename _Item, typename _ItemIt> 104 struct DefaultMapSelector<_Graph, _Item, _ItemIt, unsigned long> { 105 typedef VectorMap<_Graph, _Item, unsigned long> Map; 106 106 }; 107 107 … … 110 110 111 111 // float 112 template <typename _Graph, typename _Item, typename _ItemIt , typename _IdMap>113 struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap,float> {114 typedef VectorMap<_Graph, _Item, _IdMap,float> Map;112 template <typename _Graph, typename _Item, typename _ItemIt> 113 struct DefaultMapSelector<_Graph, _Item, _ItemIt, float> { 114 typedef VectorMap<_Graph, _Item, float> Map; 115 115 }; 116 116 117 117 118 118 // double 119 template <typename _Graph, typename _Item, typename _ItemIt , typename _IdMap>120 struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap,double> {121 typedef VectorMap<_Graph, _Item, _IdMap,double> Map;119 template <typename _Graph, typename _Item, typename _ItemIt> 120 struct DefaultMapSelector<_Graph, _Item, _ItemIt, double> { 121 typedef VectorMap<_Graph, _Item, double> Map; 122 122 }; 123 123 124 124 125 125 // long double 126 template <typename _Graph, typename _Item, typename _ItemIt , typename _IdMap>127 struct DefaultMapSelector<_Graph, _Item, _ItemIt, _IdMap,long double> {128 typedef VectorMap<_Graph, _Item, _IdMap,long double> Map;126 template <typename _Graph, typename _Item, typename _ItemIt> 127 struct DefaultMapSelector<_Graph, _Item, _ItemIt, long double> { 128 typedef VectorMap<_Graph, _Item, long double> Map; 129 129 }; 130 130 131 131 132 132 // pointer 133 template <typename _Graph, typename _Item, typename _ItemIt, typename _ IdMap, typename _Ptr>134 struct DefaultMapSelector<_Graph, _Item, _ItemIt, _ IdMap, _Ptr*> {135 typedef VectorMap<_Graph, _Item, _ IdMap, _Ptr*> Map;133 template <typename _Graph, typename _Item, typename _ItemIt, typename _Ptr> 134 struct DefaultMapSelector<_Graph, _Item, _ItemIt, _Ptr*> { 135 typedef VectorMap<_Graph, _Item, _Ptr*> Map; 136 136 }; 137 137 … … 141 141 typename _Item, 142 142 typename _ItemIt, 143 typename _IdMap,144 143 typename _Value> 145 class DefaultMap : public DefaultMapSelector<_Graph, _Item, _ItemIt, _ IdMap, _Value>::Map {144 class DefaultMap : public DefaultMapSelector<_Graph, _Item, _ItemIt, _Value>::Map { 146 145 public: 147 typedef typename DefaultMapSelector<_Graph, _Item, _ItemIt, _ IdMap, _Value>::Map Parent;148 typedef DefaultMap<_Graph, _Item, _ItemIt, _ IdMap, bool> Map;146 typedef typename DefaultMapSelector<_Graph, _Item, _ItemIt, _Value>::Map Parent; 147 typedef DefaultMap<_Graph, _Item, _ItemIt, _Value> Map; 149 148 150 149 typedef typename Parent::Graph Graph; 151 typedef typename Parent::Registry Registry;152 150 typedef typename Parent::ValueType ValueType; 153 151 154 DefaultMap(const Graph& _g , Registry& _r) : Parent(_g, _r) {}155 DefaultMap(const Graph& _g, Registry& _r, const ValueType& _v) : Parent(_g, _r, _v) {}152 DefaultMap(const Graph& _g) : Parent(_g) {} 153 DefaultMap(const Graph& _g, const ValueType& _v) : Parent(_g, _v) {} 156 154 }; 157 155 … … 167 165 typedef typename Parent::Node Node; 168 166 typedef typename Parent::NodeIt NodeIt; 169 typedef typename Parent::NodeIdMap NodeIdMap;170 typedef typename Parent::NodeObserverRegistry NodeObserverRegistry;171 167 172 168 typedef typename Parent::Edge Edge; 173 169 typedef typename Parent::EdgeIt EdgeIt; 174 typedef typename Parent::EdgeIdMap EdgeIdMap;175 typedef typename Parent::EdgeObserverRegistry EdgeObserverRegistry;176 170 177 171 178 179 172 template <typename _Value> 180 class NodeMap : public DefaultMap<Graph, Node, NodeIt, NodeIdMap,_Value> {173 class NodeMap : public DefaultMap<Graph, Node, NodeIt, _Value> { 181 174 public: 182 175 typedef DefaultMappableGraphExtender<_Base> Graph; … … 184 177 typedef typename Graph::Node Node; 185 178 typedef typename Graph::NodeIt NodeIt; 186 typedef typename Graph::NodeIdMap NodeIdMap; 187 188 typedef DefaultMap<Graph, Node, NodeIt, NodeIdMap, _Value> Parent; 179 180 typedef DefaultMap<Graph, Node, NodeIt, _Value> Parent; 189 181 190 182 //typedef typename Parent::Graph Graph; 191 183 typedef typename Parent::ValueType ValueType; 192 184 193 NodeMap(const Graph& g)194 : Parent( g, g.getNodeObserverRegistry()) {}195 NodeMap(const Graph& g, const ValueType&v)196 : Parent( g, g.getNodeObserverRegistry(),v) {}185 NodeMap(const Graph& _g) 186 : Parent(_g) {} 187 NodeMap(const Graph& _g, const ValueType& _v) 188 : Parent(_g, _v) {} 197 189 198 190 }; 199 191 200 192 template <typename _Value> 201 class EdgeMap : public DefaultMap<Graph, Edge, EdgeIt, EdgeIdMap,_Value> {193 class EdgeMap : public DefaultMap<Graph, Edge, EdgeIt, _Value> { 202 194 public: 203 195 typedef DefaultMappableGraphExtender<_Base> Graph; … … 205 197 typedef typename Graph::Edge Edge; 206 198 typedef typename Graph::EdgeIt EdgeIt; 207 typedef typename Graph::EdgeIdMap EdgeIdMap; 208 209 typedef DefaultMap<Graph, Edge, EdgeIt, EdgeIdMap, _Value> Parent; 199 200 typedef DefaultMap<Graph, Edge, EdgeIt, _Value> Parent; 210 201 211 202 //typedef typename Parent::Graph Graph; 212 203 typedef typename Parent::ValueType ValueType; 213 204 214 EdgeMap(const Graph& g)215 : Parent( g, g.getEdgeObserverRegistry()) {}216 EdgeMap(const Graph& g, const ValueType&v)217 : Parent( g, g.getEdgeObserverRegistry(),v) {}205 EdgeMap(const Graph& _g) 206 : Parent(_g) {} 207 EdgeMap(const Graph& _g, const ValueType& _v) 208 : Parent(_g, _v) {} 218 209 219 210 };
Note: See TracChangeset
for help on using the changeset viewer.