COIN-OR::LEMON - Graph Library

Changeset 140:356930927a71 in lemon


Ignore:
Timestamp:
04/22/08 15:07:04 (16 years ago)
Author:
Balazs Dezso <deba@…>
Branch:
default
Phase:
public
Message:

New implementation of GRAPH_TYPEDEFS

Location:
lemon
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • lemon/graph_utils.h

    r139 r140  
    4343  /// @{
    4444
     45  namespace _graph_utils_bits {
     46    template <typename Graph>
     47    struct Node { typedef typename Graph::Node type; };
     48
     49    template <typename Graph>
     50    struct NodeIt { typedef typename Graph::NodeIt type; };
     51
     52    template <typename Graph>
     53    struct Arc { typedef typename Graph::Arc type; };
     54
     55    template <typename Graph>
     56    struct ArcIt { typedef typename Graph::ArcIt type; };
     57
     58    template <typename Graph>
     59    struct Edge { typedef typename Graph::Edge type; };
     60
     61    template <typename Graph>
     62    struct EdgeIt { typedef typename Graph::EdgeIt type; };
     63
     64    template <typename Graph>
     65    struct OutArcIt { typedef typename Graph::OutArcIt type; };
     66
     67    template <typename Graph>
     68    struct InArcIt { typedef typename Graph::InArcIt type; };
     69
     70    template <typename Graph>
     71    struct IncEdgeIt { typedef typename Graph::IncEdgeIt type; };
     72
     73    template <typename Graph>
     74    struct BoolNodeMap {
     75      typedef typename Graph::template NodeMap<bool> type;
     76    };
     77
     78    template <typename Graph>
     79    struct IntNodeMap {
     80      typedef typename Graph::template NodeMap<int> type;
     81    };
     82
     83    template <typename Graph>
     84    struct DoubleNodeMap {
     85      typedef typename Graph::template NodeMap<double> type;
     86    };
     87
     88    template <typename Graph>
     89    struct BoolArcMap {
     90      typedef typename Graph::template ArcMap<bool> type;
     91    };
     92
     93    template <typename Graph>
     94    struct IntArcMap {
     95      typedef typename Graph::template ArcMap<int> type;
     96    };
     97
     98    template <typename Graph>
     99    struct DoubleArcMap {
     100      typedef typename Graph::template ArcMap<double> type;
     101    };
     102
     103    template <typename Graph>
     104    struct BoolEdgeMap {
     105      typedef typename Graph::template EdgeMap<bool> type;
     106    };
     107
     108    template <typename Graph>
     109    struct IntEdgeMap {
     110      typedef typename Graph::template EdgeMap<int> type;
     111    };
     112
     113    template <typename Graph>
     114    struct DoubleEdgeMap {
     115      typedef typename Graph::template EdgeMap<double> type;
     116    };
     117
     118   
     119  }
     120
    45121  ///Creates convenience typedefs for the digraph types and iterators
    46122
     
    50126  ///\c BoolArcMap, \c IntArcMap, \c DoubleArcMap.
    51127#define DIGRAPH_TYPEDEFS(Digraph)                                       \
    52   typedef Digraph::Node Node;                                           \
    53   typedef Digraph::NodeIt NodeIt;                                       \
    54   typedef Digraph::Arc Arc;                                             \
    55   typedef Digraph::ArcIt ArcIt;                                         \
    56   typedef Digraph::InArcIt InArcIt;                                     \
    57   typedef Digraph::OutArcIt OutArcIt
     128  typedef typename ::lemon::_graph_utils_bits::                         \
     129  Node<Digraph>::type Node;                                             \
     130  typedef typename ::lemon::_graph_utils_bits::                         \
     131  NodeIt<Digraph>::type NodeIt;                                         \
     132  typedef typename ::lemon::_graph_utils_bits::                         \
     133  Arc<Digraph>::type Arc;                                               \
     134  typedef typename ::lemon::_graph_utils_bits::                         \
     135  ArcIt<Digraph>::type ArcIt;                                           \
     136  typedef typename ::lemon::_graph_utils_bits::                         \
     137  OutArcIt<Digraph>::type OutArcIt;                                     \
     138  typedef typename ::lemon::_graph_utils_bits::                         \
     139  InArcIt<Digraph>::type InArcIt;                                       \
     140  typedef typename ::lemon::_graph_utils_bits::                         \
     141  BoolNodeMap<Digraph>::type BoolNodeMap;                               \
     142  typedef typename ::lemon::_graph_utils_bits::                         \
     143  IntNodeMap<Digraph>::type IntNodeMap;                                 \
     144  typedef typename ::lemon::_graph_utils_bits::                         \
     145  DoubleNodeMap<Digraph>::type DoubleNodeMap;                           \
     146  typedef typename ::lemon::_graph_utils_bits::                         \
     147  BoolArcMap<Digraph>::type BoolArcMap;                                 \
     148  typedef typename ::lemon::_graph_utils_bits::                         \
     149  IntArcMap<Digraph>::type IntArcMap;                                   \
     150  typedef typename ::lemon::_graph_utils_bits::                         \
     151  DoubleArcMap<Digraph>::type DoubleArcMap
     152
    58153
    59154  ///Creates convenience typedefs for the graph types and iterators
     
    65160#define GRAPH_TYPEDEFS(Graph)                                           \
    66161  DIGRAPH_TYPEDEFS(Graph);                                              \
    67   typedef Graph::Edge Edge;                                             \
    68   typedef Graph::EdgeIt EdgeIt;                                         \
    69   typedef Graph::IncEdgeIt IncEdgeIt
     162  typedef typename ::lemon::_graph_utils_bits::                         \
     163  Edge<Graph>::type Edge;                                               \
     164  typedef typename ::lemon::_graph_utils_bits::                         \
     165  EdgeIt<Graph>::type EdgeIt;                                           \
     166  typedef typename ::lemon::_graph_utils_bits::                         \
     167  IncEdgeIt<Graph>::type IncEdgeIt                                      \
     168  typedef typename ::lemon::_graph_utils_bits::                         \
     169  BoolEdgeMap<Graph>::type BoolEdgeMap;                                 \
     170  typedef typename ::lemon::_graph_utils_bits::                         \
     171  IntEdgeMap<Graph>::type IntEdgeMap;                                   \
     172  typedef typename ::lemon::_graph_utils_bits::                         \
     173  DoubleEdgeMap<Graph>::type DoubleEdgeMap
     174
    70175
    71176  /// \brief Function to count the items in the graph.
     
    20572162    ::ItemNotifier::ObserverBase Parent;
    20582163
    2059     DIGRAPH_TYPEDEFS(typename G);
     2164    DIGRAPH_TYPEDEFS(G);
    20602165    typedef G Digraph;
    20612166
     
    24942599  {
    24952600  public:
    2496     DIGRAPH_TYPEDEFS(typename G);
     2601    DIGRAPH_TYPEDEFS(G);
    24972602    typedef G Digraph;
    24982603
     
    26112716    using ArcLookUp<G>::_head;
    26122717
    2613     DIGRAPH_TYPEDEFS(typename G);
     2718    DIGRAPH_TYPEDEFS(G);
    26142719    typedef G Digraph;
    26152720   
  • lemon/lgf_reader.h

    r139 r140  
    303303
    304304    typedef _Digraph Digraph;
    305     DIGRAPH_TYPEDEFS(typename Digraph);
     305    DIGRAPH_TYPEDEFS(Digraph);
    306306   
    307307  private:
  • lemon/lgf_writer.h

    r139 r140  
    238238
    239239    typedef _Digraph Digraph;
    240     DIGRAPH_TYPEDEFS(typename Digraph);
     240    DIGRAPH_TYPEDEFS(Digraph);
    241241   
    242242  private:
Note: See TracChangeset for help on using the changeset viewer.