src/lemon/map_bits.h
author ladanyi
Thu, 04 Nov 2004 18:52:31 +0000
changeset 958 75f749682240
parent 921 818510fa3d99
permissions -rw-r--r--
Updated because of the recent changes in simann.h.
alpar@906
     1
/* -*- C++ -*-
alpar@921
     2
 * src/lemon/map_bits.h - Part of LEMON, a generic C++ optimization library
alpar@906
     3
 *
alpar@906
     4
 * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
alpar@906
     5
 * (Egervary Combinatorial Optimization Research Group, EGRES).
alpar@906
     6
 *
alpar@906
     7
 * Permission to use, modify and distribute this software is granted
alpar@906
     8
 * provided that this copyright notice appears in all copies. For
alpar@906
     9
 * precise terms see the accompanying LICENSE file.
alpar@906
    10
 *
alpar@906
    11
 * This software is provided "AS IS" with no warranty of any kind,
alpar@906
    12
 * express or implied, and with no claim as to its suitability for any
alpar@906
    13
 * purpose.
alpar@906
    14
 *
alpar@906
    15
 */
alpar@906
    16
alpar@921
    17
#ifndef LEMON_MAP_BITS_H
alpar@921
    18
#define LEMON_MAP_BITS_H
deba@844
    19
deba@844
    20
///\ingroup graphmaps
deba@844
    21
///\file
deba@844
    22
///\brief Some utils to help implement maps.
deba@844
    23
alpar@921
    24
namespace lemon {
deba@844
    25
deba@844
    26
deba@844
    27
  /// \addtogroup graphmaps
deba@844
    28
  /// @{
deba@844
    29
deba@844
    30
  /// Helper class to get information about the key type.
deba@844
    31
  template <typename Graph, typename KeyIt>
deba@844
    32
  struct KeyInfo {};
deba@844
    33
deba@844
    34
  template <typename Graph>
deba@844
    35
  struct KeyInfo<Graph, typename Graph::NodeIt> {
deba@844
    36
    static int maxId(const Graph& graph) {
deba@844
    37
      return graph.maxNodeId();
deba@844
    38
    }
deba@844
    39
    static int id(const Graph& graph, const typename Graph::Node& node) {
deba@844
    40
      return graph.id(node);
deba@844
    41
    }
deba@844
    42
  };
deba@844
    43
deba@844
    44
  template <typename Graph>
deba@844
    45
  struct KeyInfo<Graph, typename Graph::EdgeIt> {
deba@844
    46
    static int maxId(const Graph& graph) {
deba@844
    47
      return graph.maxEdgeId();
deba@844
    48
    }
deba@844
    49
    static int id(const Graph& graph, const typename Graph::Edge& edge) {
deba@844
    50
      return graph.id(edge);
deba@844
    51
    }
deba@844
    52
  };
deba@844
    53
deba@844
    54
  template <typename Graph>
deba@844
    55
  struct KeyInfo<Graph, typename Graph::SymEdgeIt> {
deba@844
    56
    static int maxId(const Graph& graph) {
deba@937
    57
      return graph.maxSymEdgeId();
deba@844
    58
    }
deba@937
    59
    static int id(const Graph& graph, const typename Graph::SymEdge& edge) {
deba@937
    60
      return graph.id(edge);
deba@844
    61
    }
deba@844
    62
  };
deba@844
    63
deba@844
    64
  /// @}
deba@844
    65
}
deba@844
    66
deba@844
    67
#endif