alpar@906: /* -*- C++ -*- alpar@906: * src/hugo/map_bits.h - Part of HUGOlib, 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: marci@901: #ifndef HUGO_MAP_BITS_H marci@901: #define HUGO_MAP_BITS_H deba@844: deba@844: ///\ingroup graphmaps deba@844: ///\file deba@844: ///\brief Some utils to help implement maps. deba@844: deba@844: namespace hugo { 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) { deba@844: return graph.maxEdgeId() >> 1; deba@844: } deba@844: static int id(const Graph& graph, const typename Graph::Edge& edge) { deba@844: return graph.id(edge) >> 1; deba@844: } deba@844: }; deba@844: deba@844: /// @} deba@844: } deba@844: deba@844: #endif