diff -r d56fad02dc55 -r 9bf990cb066d src/hugo/map_bits.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hugo/map_bits.h Mon Sep 13 20:05:13 2004 +0000 @@ -0,0 +1,52 @@ +// -*- c++ -*- +#ifndef MAP_BITS_H +#define 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