1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/hugo/map_bits.h Mon Sep 13 20:05:13 2004 +0000
1.3 @@ -0,0 +1,52 @@
1.4 +// -*- c++ -*-
1.5 +#ifndef MAP_BITS_H
1.6 +#define MAP_BITS_H
1.7 +
1.8 +///\ingroup graphmaps
1.9 +///\file
1.10 +///\brief Some utils to help implement maps.
1.11 +
1.12 +namespace hugo {
1.13 +
1.14 +
1.15 + /// \addtogroup graphmaps
1.16 + /// @{
1.17 +
1.18 + /// Helper class to get information about the key type.
1.19 + template <typename Graph, typename KeyIt>
1.20 + struct KeyInfo {};
1.21 +
1.22 + template <typename Graph>
1.23 + struct KeyInfo<Graph, typename Graph::NodeIt> {
1.24 + static int maxId(const Graph& graph) {
1.25 + return graph.maxNodeId();
1.26 + }
1.27 + static int id(const Graph& graph, const typename Graph::Node& node) {
1.28 + return graph.id(node);
1.29 + }
1.30 + };
1.31 +
1.32 + template <typename Graph>
1.33 + struct KeyInfo<Graph, typename Graph::EdgeIt> {
1.34 + static int maxId(const Graph& graph) {
1.35 + return graph.maxEdgeId();
1.36 + }
1.37 + static int id(const Graph& graph, const typename Graph::Edge& edge) {
1.38 + return graph.id(edge);
1.39 + }
1.40 + };
1.41 +
1.42 + template <typename Graph>
1.43 + struct KeyInfo<Graph, typename Graph::SymEdgeIt> {
1.44 + static int maxId(const Graph& graph) {
1.45 + return graph.maxEdgeId() >> 1;
1.46 + }
1.47 + static int id(const Graph& graph, const typename Graph::Edge& edge) {
1.48 + return graph.id(edge) >> 1;
1.49 + }
1.50 + };
1.51 +
1.52 + /// @}
1.53 +}
1.54 +
1.55 +#endif