/* -*- 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 struct KeyInfo {}; template struct KeyInfo { 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 struct KeyInfo { 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 struct KeyInfo { static int maxId(const Graph& graph) { return graph.maxEdgeId() >> 1; } static int id(const Graph& graph, const typename Graph::Edge& edge) { return graph.id(edge) >> 1; } }; /// @} } #endif