hegyi@1: /* -*- C++ -*- hegyi@1: * hegyi@1: * This file is a part of LEMON, a generic C++ optimization library hegyi@1: * hegyi@1: * Copyright (C) 2003-2006 hegyi@1: * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport hegyi@1: * (Egervary Research Group on Combinatorial Optimization, EGRES). hegyi@1: * hegyi@1: * Permission to use, modify and distribute this software is granted hegyi@1: * provided that this copyright notice appears in all copies. For hegyi@1: * precise terms see the accompanying LICENSE file. hegyi@1: * hegyi@1: * This software is provided "AS IS" with no warranty of any kind, hegyi@1: * express or implied, and with no claim as to its suitability for any hegyi@1: * purpose. hegyi@1: * hegyi@1: */ hegyi@1: hegyi@1: #ifndef XYMAP_H hegyi@1: #define XYMAP_H hegyi@1: hegyi@1: #include hegyi@1: #include hegyi@1: hegyi@1: template hegyi@1: class XYMap hegyi@1: { hegyi@1: private: hegyi@1: M *xmap, *ymap; hegyi@1: hegyi@1: public: hegyi@1: typedef typename M::Key Key; hegyi@1: typedef lemon::dim2::Point Value; hegyi@1: XYMap() {} hegyi@1: XYMap(M &_xmap, M &_ymap) : xmap(&_xmap), ymap(&_ymap) {} hegyi@1: void setXMap(M &_xmap) { xmap = &_xmap; } hegyi@1: void setYMap(M &_ymap) { ymap = &_ymap; } hegyi@1: Value operator[](Key k) const hegyi@1: { hegyi@1: Value v(xmap->operator[](k), ymap->operator[](k)); hegyi@1: return v; hegyi@1: } hegyi@1: void set(Key k, Value v) hegyi@1: { hegyi@1: xmap->set(k, v.x); hegyi@1: ymap->set(k, v.y); hegyi@1: } hegyi@1: }; hegyi@1: hegyi@1: #endif