2 * src/lemon/map_bits.h - Part of LEMON, a generic C++ optimization library
4 * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
5 * (Egervary Combinatorial Optimization Research Group, EGRES).
7 * Permission to use, modify and distribute this software is granted
8 * provided that this copyright notice appears in all copies. For
9 * precise terms see the accompanying LICENSE file.
11 * This software is provided "AS IS" with no warranty of any kind,
12 * express or implied, and with no claim as to its suitability for any
17 #ifndef LEMON_MAP_BITS_H
18 #define LEMON_MAP_BITS_H
22 ///\brief Some utils to help implement maps.
27 /// \addtogroup graphmaps
30 /// Helper class to get information about the key type.
31 template <typename Graph, typename KeyIt>
34 template <typename Graph>
35 struct KeyInfo<Graph, typename Graph::NodeIt> {
36 static int maxId(const Graph& graph) {
37 return graph.maxNodeId();
39 static int id(const Graph& graph, const typename Graph::Node& node) {
40 return graph.id(node);
44 template <typename Graph>
45 struct KeyInfo<Graph, typename Graph::EdgeIt> {
46 static int maxId(const Graph& graph) {
47 return graph.maxEdgeId();
49 static int id(const Graph& graph, const typename Graph::Edge& edge) {
50 return graph.id(edge);
54 template <typename Graph>
55 struct KeyInfo<Graph, typename Graph::SymEdgeIt> {
56 static int maxId(const Graph& graph) {
57 return graph.maxSymEdgeId();
59 static int id(const Graph& graph, const typename Graph::SymEdge& edge) {
60 return graph.id(edge);