equal
deleted
inserted
replaced
|
1 /* -*- C++ -*- |
|
2 * |
|
3 * This file is a part of LEMON, a generic C++ optimization library |
|
4 * |
|
5 * Copyright (C) 2003-2006 |
|
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
|
7 * (Egervary Research Group on Combinatorial Optimization, EGRES). |
|
8 * |
|
9 * Permission to use, modify and distribute this software is granted |
|
10 * provided that this copyright notice appears in all copies. For |
|
11 * precise terms see the accompanying LICENSE file. |
|
12 * |
|
13 * This software is provided "AS IS" with no warranty of any kind, |
|
14 * express or implied, and with no claim as to its suitability for any |
|
15 * purpose. |
|
16 * |
|
17 */ |
|
18 |
|
19 #ifndef XYMAP_H |
|
20 #define XYMAP_H |
|
21 |
|
22 #include <lemon/list_graph.h> |
|
23 #include <lemon/dim2.h> |
|
24 |
|
25 template<class M> |
|
26 class XYMap |
|
27 { |
|
28 private: |
|
29 M *xmap, *ymap; |
|
30 |
|
31 public: |
|
32 typedef typename M::Key Key; |
|
33 typedef lemon::dim2::Point<typename M::Value> Value; |
|
34 XYMap() {} |
|
35 XYMap(M &_xmap, M &_ymap) : xmap(&_xmap), ymap(&_ymap) {} |
|
36 void setXMap(M &_xmap) { xmap = &_xmap; } |
|
37 void setYMap(M &_ymap) { ymap = &_ymap; } |
|
38 Value operator[](Key k) const |
|
39 { |
|
40 Value v(xmap->operator[](k), ymap->operator[](k)); |
|
41 return v; |
|
42 } |
|
43 void set(Key k, Value v) |
|
44 { |
|
45 xmap->set(k, v.x); |
|
46 ymap->set(k, v.y); |
|
47 } |
|
48 }; |
|
49 |
|
50 #endif |