COIN-OR::LEMON - Graph Library

source: glemon-0.x/xymap.h @ 174:95872af46fc4

Last change on this file since 174:95872af46fc4 was 174:95872af46fc4, checked in by Alpar Juttner, 18 years ago

Add copyright headers

File size: 1.2 KB
Line 
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
25template<class M>
26class 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
Note: See TracBrowser for help on using the repository browser.