Revert 356930927a71 and add TEMPLATE_GRAPH_TYPEDEFS instead (ticket #89)
authorBalazs Dezso <deba@inf.elte.hu>
Thu, 24 Apr 2008 11:56:44 +0200
changeset 1484e2581021300
parent 147 7c39a090cfc3
child 149 2f7ae34e1333
Revert 356930927a71 and add TEMPLATE_GRAPH_TYPEDEFS instead (ticket #89)
lemon/graph_utils.h
lemon/lgf_reader.h
lemon/lgf_writer.h
     1.1 --- a/lemon/graph_utils.h	Wed Apr 23 15:33:53 2008 +0200
     1.2 +++ b/lemon/graph_utils.h	Thu Apr 24 11:56:44 2008 +0200
     1.3 @@ -42,136 +42,83 @@
     1.4    /// \addtogroup gutils
     1.5    /// @{
     1.6  
     1.7 -  namespace _graph_utils_bits {
     1.8 -    template <typename Graph>
     1.9 -    struct Node { typedef typename Graph::Node type; };
    1.10 -
    1.11 -    template <typename Graph>
    1.12 -    struct NodeIt { typedef typename Graph::NodeIt type; };
    1.13 -
    1.14 -    template <typename Graph>
    1.15 -    struct Arc { typedef typename Graph::Arc type; };
    1.16 -
    1.17 -    template <typename Graph>
    1.18 -    struct ArcIt { typedef typename Graph::ArcIt type; };
    1.19 -
    1.20 -    template <typename Graph>
    1.21 -    struct Edge { typedef typename Graph::Edge type; };
    1.22 -
    1.23 -    template <typename Graph>
    1.24 -    struct EdgeIt { typedef typename Graph::EdgeIt type; };
    1.25 -
    1.26 -    template <typename Graph>
    1.27 -    struct OutArcIt { typedef typename Graph::OutArcIt type; };
    1.28 -
    1.29 -    template <typename Graph>
    1.30 -    struct InArcIt { typedef typename Graph::InArcIt type; };
    1.31 -
    1.32 -    template <typename Graph>
    1.33 -    struct IncEdgeIt { typedef typename Graph::IncEdgeIt type; };
    1.34 -
    1.35 -    template <typename Graph>
    1.36 -    struct BoolNodeMap { 
    1.37 -      typedef typename Graph::template NodeMap<bool> type; 
    1.38 -    };
    1.39 -
    1.40 -    template <typename Graph>
    1.41 -    struct IntNodeMap { 
    1.42 -      typedef typename Graph::template NodeMap<int> type; 
    1.43 -    };
    1.44 -
    1.45 -    template <typename Graph>
    1.46 -    struct DoubleNodeMap { 
    1.47 -      typedef typename Graph::template NodeMap<double> type; 
    1.48 -    };
    1.49 -
    1.50 -    template <typename Graph>
    1.51 -    struct BoolArcMap { 
    1.52 -      typedef typename Graph::template ArcMap<bool> type; 
    1.53 -    };
    1.54 -
    1.55 -    template <typename Graph>
    1.56 -    struct IntArcMap { 
    1.57 -      typedef typename Graph::template ArcMap<int> type; 
    1.58 -    };
    1.59 -
    1.60 -    template <typename Graph>
    1.61 -    struct DoubleArcMap { 
    1.62 -      typedef typename Graph::template ArcMap<double> type; 
    1.63 -    };
    1.64 -
    1.65 -    template <typename Graph>
    1.66 -    struct BoolEdgeMap { 
    1.67 -      typedef typename Graph::template EdgeMap<bool> type; 
    1.68 -    };
    1.69 -
    1.70 -    template <typename Graph>
    1.71 -    struct IntEdgeMap { 
    1.72 -      typedef typename Graph::template EdgeMap<int> type; 
    1.73 -    };
    1.74 -
    1.75 -    template <typename Graph>
    1.76 -    struct DoubleEdgeMap { 
    1.77 -      typedef typename Graph::template EdgeMap<double> type; 
    1.78 -    };
    1.79 -
    1.80 -    
    1.81 -  }
    1.82 -
    1.83    ///Creates convenience typedefs for the digraph types and iterators
    1.84  
    1.85    ///This \c \#define creates convenience typedefs for the following types
    1.86    ///of \c Digraph: \c Node,  \c NodeIt, \c Arc, \c ArcIt, \c InArcIt,
    1.87    ///\c OutArcIt, \c BoolNodeMap, \c IntNodeMap, \c DoubleNodeMap, 
    1.88 -  ///\c BoolArcMap, \c IntArcMap, \c DoubleArcMap. 
    1.89 +  ///\c BoolArcMap, \c IntArcMap, \c DoubleArcMap.
    1.90 +  ///
    1.91 +  ///\note If the graph type is a dependent type, ie. the graph type depend
    1.92 +  ///on a template parameter, then use \c TEMPLATE_DIGRAPH_TYPEDEFS()
    1.93 +  ///macro.
    1.94  #define DIGRAPH_TYPEDEFS(Digraph)					\
    1.95 -  typedef typename ::lemon::_graph_utils_bits::				\
    1.96 -  Node<Digraph>::type Node;						\
    1.97 -  typedef typename ::lemon::_graph_utils_bits::				\
    1.98 -  NodeIt<Digraph>::type	NodeIt;						\
    1.99 -  typedef typename ::lemon::_graph_utils_bits::				\
   1.100 -  Arc<Digraph>::type Arc;						\
   1.101 -  typedef typename ::lemon::_graph_utils_bits::				\
   1.102 -  ArcIt<Digraph>::type ArcIt;						\
   1.103 -  typedef typename ::lemon::_graph_utils_bits::				\
   1.104 -  OutArcIt<Digraph>::type OutArcIt;					\
   1.105 -  typedef typename ::lemon::_graph_utils_bits::				\
   1.106 -  InArcIt<Digraph>::type InArcIt;					\
   1.107 -  typedef typename ::lemon::_graph_utils_bits::				\
   1.108 -  BoolNodeMap<Digraph>::type BoolNodeMap;				\
   1.109 -  typedef typename ::lemon::_graph_utils_bits::				\
   1.110 -  IntNodeMap<Digraph>::type IntNodeMap;					\
   1.111 -  typedef typename ::lemon::_graph_utils_bits::				\
   1.112 -  DoubleNodeMap<Digraph>::type DoubleNodeMap;				\
   1.113 -  typedef typename ::lemon::_graph_utils_bits::				\
   1.114 -  BoolArcMap<Digraph>::type BoolArcMap;					\
   1.115 -  typedef typename ::lemon::_graph_utils_bits::				\
   1.116 -  IntArcMap<Digraph>::type IntArcMap;					\
   1.117 -  typedef typename ::lemon::_graph_utils_bits::				\
   1.118 -  DoubleArcMap<Digraph>::type DoubleArcMap
   1.119 +  typedef Digraph::Node Node;						\
   1.120 +  typedef Digraph::NodeIt NodeIt;					\
   1.121 +  typedef Digraph::Arc Arc;						\
   1.122 +  typedef Digraph::ArcIt ArcIt;						\
   1.123 +  typedef Digraph::InArcIt InArcIt;					\
   1.124 +  typedef Digraph::OutArcIt OutArcIt;					\
   1.125 +  typedef Digraph::NodeMap<bool> BoolNodeMap;				\
   1.126 +  typedef Digraph::NodeMap<int> IntNodeMap;				\
   1.127 +  typedef Digraph::NodeMap<double> DoubleNodeMap;			\
   1.128 +  typedef Digraph::ArcMap<bool> BoolArcMap;				\
   1.129 +  typedef Digraph::ArcMap<int> IntArcMap;				\
   1.130 +  typedef Digraph::ArcMap<double> DoubleArcMap
   1.131  
   1.132 +  ///Creates convenience typedefs for the digraph types and iterators
   1.133  
   1.134 +  ///\see DIGRAPH_TYPEDEFS
   1.135 +  ///
   1.136 +  ///\note Use this macro, if the graph type is a dependent type,
   1.137 +  ///ie. the graph type depend on a template parameter.
   1.138 +#define TEMPLATE_DIGRAPH_TYPEDEFS(Digraph)				\
   1.139 +  typedef typename Digraph::Node Node;					\
   1.140 +  typedef typename Digraph::NodeIt NodeIt;				\
   1.141 +  typedef typename Digraph::Arc Arc;					\
   1.142 +  typedef typename Digraph::ArcIt ArcIt;				\
   1.143 +  typedef typename Digraph::InArcIt InArcIt;				\
   1.144 +  typedef typename Digraph::OutArcIt OutArcIt;				\
   1.145 +  typedef typename Digraph::template NodeMap<bool> BoolNodeMap;		\
   1.146 +  typedef typename Digraph::template NodeMap<int> IntNodeMap;		\
   1.147 +  typedef typename Digraph::template NodeMap<double> DoubleNodeMap;	\
   1.148 +  typedef typename Digraph::template ArcMap<bool> BoolArcMap;		\
   1.149 +  typedef typename Digraph::template ArcMap<int> IntArcMap;		\
   1.150 +  typedef typename Digraph::template ArcMap<double> DoubleArcMap
   1.151 +  
   1.152    ///Creates convenience typedefs for the graph types and iterators
   1.153  
   1.154    ///This \c \#define creates the same convenience typedefs as defined
   1.155    ///by \ref DIGRAPH_TYPEDEFS(Graph) and six more, namely it creates
   1.156    ///\c Edge, \c EdgeIt, \c IncEdgeIt, \c BoolEdgeMap, \c IntEdgeMap,
   1.157    ///\c DoubleEdgeMap.
   1.158 +  ///
   1.159 +  ///\note If the graph type is a dependent type, ie. the graph type depend
   1.160 +  ///on a template parameter, then use \c TEMPLATE_DIGRAPH_TYPEDEFS()
   1.161 +  ///macro.
   1.162  #define GRAPH_TYPEDEFS(Graph)						\
   1.163    DIGRAPH_TYPEDEFS(Graph);						\
   1.164 -  typedef typename ::lemon::_graph_utils_bits::				\
   1.165 -  Edge<Graph>::type Edge;						\
   1.166 -  typedef typename ::lemon::_graph_utils_bits::				\
   1.167 -  EdgeIt<Graph>::type EdgeIt;						\
   1.168 -  typedef typename ::lemon::_graph_utils_bits::				\
   1.169 -  IncEdgeIt<Graph>::type IncEdgeIt;					\
   1.170 -  typedef typename ::lemon::_graph_utils_bits::				\
   1.171 -  BoolEdgeMap<Graph>::type BoolEdgeMap;					\
   1.172 -  typedef typename ::lemon::_graph_utils_bits::				\
   1.173 -  IntEdgeMap<Graph>::type IntEdgeMap;					\
   1.174 -  typedef typename ::lemon::_graph_utils_bits::				\
   1.175 -  DoubleEdgeMap<Graph>::type DoubleEdgeMap
   1.176 +  typedef Graph::Edge Edge;						\
   1.177 +  typedef Graph::EdgeIt EdgeIt;						\
   1.178 +  typedef Graph::IncEdgeIt IncEdgeIt;					\
   1.179 +  typedef Graph::EdgeMap<bool> BoolEdgeMap;				\
   1.180 +  typedef Graph::EdgeMap<int> IntEdgeMap;				\
   1.181 +  typedef Graph::EdgeMap<double> DoubleEdgeMap
   1.182  
   1.183 +  ///Creates convenience typedefs for the graph types and iterators
   1.184 +
   1.185 +  ///\see GRAPH_TYPEDEFS
   1.186 +  ///
   1.187 +  ///\note Use this macro, if the graph type is a dependent type,
   1.188 +  ///ie. the graph type depend on a template parameter.
   1.189 +#define TEMPLATE_GRAPH_TYPEDEFS(Graph)					\
   1.190 +  TEMPLATE_DIGRAPH_TYPEDEFS(Graph);					\
   1.191 +  typedef typename Graph::Edge Edge;					\
   1.192 +  typedef typename Graph::EdgeIt EdgeIt;				\
   1.193 +  typedef typename Graph::IncEdgeIt IncEdgeIt;				\
   1.194 +  typedef typename Graph::template EdgeMap<bool> BoolEdgeMap;		\
   1.195 +  typedef typename Graph::template EdgeMap<int> IntEdgeMap;		\
   1.196 +  typedef typename Graph::template EdgeMap<double> DoubleEdgeMap
   1.197  
   1.198    /// \brief Function to count the items in the graph.
   1.199    ///
   1.200 @@ -2161,7 +2108,7 @@
   1.201      typedef typename ItemSetTraits<G, typename G::Arc>
   1.202      ::ItemNotifier::ObserverBase Parent;
   1.203  
   1.204 -    DIGRAPH_TYPEDEFS(G);
   1.205 +    TEMPLATE_DIGRAPH_TYPEDEFS(G);
   1.206      typedef G Digraph;
   1.207  
   1.208    protected:
   1.209 @@ -2598,7 +2545,7 @@
   1.210    class ArcLookUp 
   1.211    {
   1.212    public:
   1.213 -    DIGRAPH_TYPEDEFS(G);
   1.214 +    TEMPLATE_DIGRAPH_TYPEDEFS(G);
   1.215      typedef G Digraph;
   1.216  
   1.217    protected:
   1.218 @@ -2715,7 +2662,7 @@
   1.219      using ArcLookUp<G>::_left;
   1.220      using ArcLookUp<G>::_head;
   1.221  
   1.222 -    DIGRAPH_TYPEDEFS(G);
   1.223 +    TEMPLATE_DIGRAPH_TYPEDEFS(G);
   1.224      typedef G Digraph;
   1.225      
   1.226      typename Digraph::template ArcMap<Arc> _next;
     2.1 --- a/lemon/lgf_reader.h	Wed Apr 23 15:33:53 2008 +0200
     2.2 +++ b/lemon/lgf_reader.h	Thu Apr 24 11:56:44 2008 +0200
     2.3 @@ -302,7 +302,7 @@
     2.4    public:
     2.5  
     2.6      typedef _Digraph Digraph;
     2.7 -    DIGRAPH_TYPEDEFS(Digraph);
     2.8 +    TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
     2.9      
    2.10    private:
    2.11  
     3.1 --- a/lemon/lgf_writer.h	Wed Apr 23 15:33:53 2008 +0200
     3.2 +++ b/lemon/lgf_writer.h	Thu Apr 24 11:56:44 2008 +0200
     3.3 @@ -237,7 +237,7 @@
     3.4    public:
     3.5  
     3.6      typedef _Digraph Digraph;
     3.7 -    DIGRAPH_TYPEDEFS(Digraph);
     3.8 +    TEMPLATE_DIGRAPH_TYPEDEFS(Digraph);
     3.9      
    3.10    private:
    3.11