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