/* -*- C++ -*-
 * src/hugo/map_bits.h - Part of HUGOlib, a generic C++ optimization library
 *
 * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
 * (Egervary Combinatorial Optimization Research Group, EGRES).
 *
 * Permission to use, modify and distribute this software is granted
 * provided that this copyright notice appears in all copies. For
 * precise terms see the accompanying LICENSE file.
 *
 * This software is provided "AS IS" with no warranty of any kind,
 * express or implied, and with no claim as to its suitability for any
 * purpose.
 *
 */

#ifndef HUGO_MAP_BITS_H
#define HUGO_MAP_BITS_H

///\ingroup graphmaps
///\file
///\brief Some utils to help implement maps.

namespace hugo {


  /// \addtogroup graphmaps
  /// @{

  /// Helper class to get information about the key type.
  template <typename Graph, typename KeyIt>
  struct KeyInfo {};

  template <typename Graph>
  struct KeyInfo<Graph, typename Graph::NodeIt> {
    static int maxId(const Graph& graph) {
      return graph.maxNodeId();
    }
    static int id(const Graph& graph, const typename Graph::Node& node) {
      return graph.id(node);
    }
  };

  template <typename Graph>
  struct KeyInfo<Graph, typename Graph::EdgeIt> {
    static int maxId(const Graph& graph) {
      return graph.maxEdgeId();
    }
    static int id(const Graph& graph, const typename Graph::Edge& edge) {
      return graph.id(edge);
    }
  };

  template <typename Graph>
  struct KeyInfo<Graph, typename Graph::SymEdgeIt> {
    static int maxId(const Graph& graph) {
      return graph.maxSymEdgeId();
    }
    static int id(const Graph& graph, const typename Graph::SymEdge& edge) {
      return graph.id(edge);
    }
  };

  /// @}
}

#endif
