Last change
on this file since 873:f3a30fda2e49 was
844:9bf990cb066d,
checked in by Balazs Dezso, 20 years ago
|
Bug fix in the symmetric maps.
Faster map initialization.
Iterators and Containers STL compatible.
|
File size:
1.1 KB
|
Rev | Line | |
---|
[844] | 1 | // -*- c++ -*- |
---|
| 2 | #ifndef MAP_BITS_H |
---|
| 3 | #define MAP_BITS_H |
---|
| 4 | |
---|
| 5 | ///\ingroup graphmaps |
---|
| 6 | ///\file |
---|
| 7 | ///\brief Some utils to help implement maps. |
---|
| 8 | |
---|
| 9 | namespace hugo { |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | /// \addtogroup graphmaps |
---|
| 13 | /// @{ |
---|
| 14 | |
---|
| 15 | /// Helper class to get information about the key type. |
---|
| 16 | template <typename Graph, typename KeyIt> |
---|
| 17 | struct KeyInfo {}; |
---|
| 18 | |
---|
| 19 | template <typename Graph> |
---|
| 20 | struct KeyInfo<Graph, typename Graph::NodeIt> { |
---|
| 21 | static int maxId(const Graph& graph) { |
---|
| 22 | return graph.maxNodeId(); |
---|
| 23 | } |
---|
| 24 | static int id(const Graph& graph, const typename Graph::Node& node) { |
---|
| 25 | return graph.id(node); |
---|
| 26 | } |
---|
| 27 | }; |
---|
| 28 | |
---|
| 29 | template <typename Graph> |
---|
| 30 | struct KeyInfo<Graph, typename Graph::EdgeIt> { |
---|
| 31 | static int maxId(const Graph& graph) { |
---|
| 32 | return graph.maxEdgeId(); |
---|
| 33 | } |
---|
| 34 | static int id(const Graph& graph, const typename Graph::Edge& edge) { |
---|
| 35 | return graph.id(edge); |
---|
| 36 | } |
---|
| 37 | }; |
---|
| 38 | |
---|
| 39 | template <typename Graph> |
---|
| 40 | struct KeyInfo<Graph, typename Graph::SymEdgeIt> { |
---|
| 41 | static int maxId(const Graph& graph) { |
---|
| 42 | return graph.maxEdgeId() >> 1; |
---|
| 43 | } |
---|
| 44 | static int id(const Graph& graph, const typename Graph::Edge& edge) { |
---|
| 45 | return graph.id(edge) >> 1; |
---|
| 46 | } |
---|
| 47 | }; |
---|
| 48 | |
---|
| 49 | /// @} |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.