author | hegyi |
Mon, 25 Sep 2006 15:30:04 +0000 | |
changeset 154 | 65c1b103443d |
parent 98 | f60f89147531 |
child 174 | 95872af46fc4 |
permissions | -rw-r--r-- |
1 #ifndef XYMAP_H
2 #define XYMAP_H
4 #include <lemon/list_graph.h>
5 #include <lemon/dim2.h>
7 template<class M>
8 class XYMap
9 {
10 private:
11 M *xmap, *ymap;
13 public:
14 typedef typename M::Key Key;
15 typedef lemon::dim2::Point<typename M::Value> Value;
16 XYMap() {}
17 XYMap(M &_xmap, M &_ymap) : xmap(&_xmap), ymap(&_ymap) {}
18 void setXMap(M &_xmap) { xmap = &_xmap; }
19 void setYMap(M &_ymap) { ymap = &_ymap; }
20 Value operator[](Key k) const
21 {
22 Value v(xmap->operator[](k), ymap->operator[](k));
23 return v;
24 }
25 void set(Key k, Value v)
26 {
27 xmap->set(k, v.x);
28 ymap->set(k, v.y);
29 }
30 };
32 #endif