deba@844: // -*- c++ -*- deba@844: #ifndef MAP_BITS_H deba@844: #define 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