alpar@906: /* -*- C++ -*- alpar@921: * src/lemon/map_bits.h - Part of LEMON, a generic C++ optimization library alpar@906: * alpar@906: * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport alpar@906: * (Egervary Combinatorial Optimization Research Group, EGRES). alpar@906: * alpar@906: * Permission to use, modify and distribute this software is granted alpar@906: * provided that this copyright notice appears in all copies. For alpar@906: * precise terms see the accompanying LICENSE file. alpar@906: * alpar@906: * This software is provided "AS IS" with no warranty of any kind, alpar@906: * express or implied, and with no claim as to its suitability for any alpar@906: * purpose. alpar@906: * alpar@906: */ alpar@906: alpar@921: #ifndef LEMON_MAP_BITS_H alpar@921: #define LEMON_MAP_BITS_H deba@844: deba@844: ///\ingroup graphmaps deba@844: ///\file deba@844: ///\brief Some utils to help implement maps. deba@844: alpar@921: namespace lemon { deba@844: deba@844: deba@844: /// \addtogroup graphmaps deba@844: /// @{ deba@844: deba@844: /// Helper class to get information about the key type. deba@844: template deba@844: struct KeyInfo {}; deba@844: deba@844: template deba@844: struct KeyInfo { deba@844: static int maxId(const Graph& graph) { deba@844: return graph.maxNodeId(); deba@844: } deba@844: static int id(const Graph& graph, const typename Graph::Node& node) { deba@844: return graph.id(node); deba@844: } deba@844: }; deba@844: deba@844: template deba@844: struct KeyInfo { deba@844: static int maxId(const Graph& graph) { deba@844: return graph.maxEdgeId(); deba@844: } deba@844: static int id(const Graph& graph, const typename Graph::Edge& edge) { deba@844: return graph.id(edge); deba@844: } deba@844: }; deba@844: deba@844: template deba@844: struct KeyInfo { deba@844: static int maxId(const Graph& graph) { alpar@919: return graph.maxEdgeId() >> 1; deba@844: } alpar@919: static int id(const Graph& graph, const typename Graph::Edge& edge) { alpar@919: return graph.id(edge) >> 1; deba@844: } deba@844: }; deba@844: deba@844: /// @} deba@844: } deba@844: deba@844: #endif