map_bits.h

Go to the documentation of this file.
00001 /* -*- C++ -*- 00002 * src/lemon/map_bits.h - Part of LEMON, a generic C++ optimization library 00003 * 00004 * Copyright (C) 2004 Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport 00005 * (Egervary Combinatorial Optimization Research Group, EGRES). 00006 * 00007 * Permission to use, modify and distribute this software is granted 00008 * provided that this copyright notice appears in all copies. For 00009 * precise terms see the accompanying LICENSE file. 00010 * 00011 * This software is provided "AS IS" with no warranty of any kind, 00012 * express or implied, and with no claim as to its suitability for any 00013 * purpose. 00014 * 00015 */ 00016 00017 #ifndef LEMON_MAP_BITS_H 00018 #define LEMON_MAP_BITS_H 00019 00023 00024 namespace lemon { 00025 00026 00029 00031 template <typename Graph, typename KeyIt> 00032 struct KeyInfo {}; 00033 00034 template <typename Graph> 00035 struct KeyInfo<Graph, typename Graph::NodeIt> { 00036 static int maxId(const Graph& graph) { 00037 return graph.maxNodeId(); 00038 } 00039 static int id(const Graph& graph, const typename Graph::Node& node) { 00040 return graph.id(node); 00041 } 00042 }; 00043 00044 template <typename Graph> 00045 struct KeyInfo<Graph, typename Graph::EdgeIt> { 00046 static int maxId(const Graph& graph) { 00047 return graph.maxEdgeId(); 00048 } 00049 static int id(const Graph& graph, const typename Graph::Edge& edge) { 00050 return graph.id(edge); 00051 } 00052 }; 00053 00054 template <typename Graph> 00055 struct KeyInfo<Graph, typename Graph::SymEdgeIt> { 00056 static int maxId(const Graph& graph) { 00057 return graph.maxEdgeId() >> 1; 00058 } 00059 static int id(const Graph& graph, const typename Graph::Edge& edge) { 00060 return graph.id(edge) >> 1; 00061 } 00062 }; 00063 00065 } 00066 00067 #endif

Generated on Thu Sep 30 12:18:33 2004 for LEMON by doxygen 1.3.8