lemon/lgf_reader.h
changeset 499 b1ef32ab39f3
parent 319 5e12d7734036
child 517 2b6d5d22bb23
child 949 54464584b157
     1.1 --- a/lemon/lgf_reader.h	Fri Feb 20 18:06:10 2009 +0000
     1.2 +++ b/lemon/lgf_reader.h	Fri Feb 20 20:43:13 2009 +0000
     1.3 @@ -390,37 +390,13 @@
     1.4    template <typename Digraph>
     1.5    class DigraphReader;
     1.6  
     1.7 -  /// \brief Return a \ref DigraphReader class
     1.8 -  ///
     1.9 -  /// This function just returns a \ref DigraphReader class.
    1.10 -  /// \relates DigraphReader
    1.11    template <typename Digraph>
    1.12 -  DigraphReader<Digraph> digraphReader(Digraph& digraph,
    1.13 -                                       std::istream& is = std::cin) {
    1.14 -    DigraphReader<Digraph> tmp(digraph, is);
    1.15 -    return tmp;
    1.16 -  }
    1.17 -
    1.18 -  /// \brief Return a \ref DigraphReader class
    1.19 -  ///
    1.20 -  /// This function just returns a \ref DigraphReader class.
    1.21 -  /// \relates DigraphReader
    1.22 +  DigraphReader<Digraph> digraphReader(Digraph& digraph, 
    1.23 +                                       std::istream& is = std::cin);
    1.24    template <typename Digraph>
    1.25 -  DigraphReader<Digraph> digraphReader(Digraph& digraph,
    1.26 -                                       const std::string& fn) {
    1.27 -    DigraphReader<Digraph> tmp(digraph, fn);
    1.28 -    return tmp;
    1.29 -  }
    1.30 -
    1.31 -  /// \brief Return a \ref DigraphReader class
    1.32 -  ///
    1.33 -  /// This function just returns a \ref DigraphReader class.
    1.34 -  /// \relates DigraphReader
    1.35 +  DigraphReader<Digraph> digraphReader(Digraph& digraph, const std::string& fn);
    1.36    template <typename Digraph>
    1.37 -  DigraphReader<Digraph> digraphReader(Digraph& digraph, const char* fn) {
    1.38 -    DigraphReader<Digraph> tmp(digraph, fn);
    1.39 -    return tmp;
    1.40 -  }
    1.41 +  DigraphReader<Digraph> digraphReader(Digraph& digraph, const char *fn);
    1.42  
    1.43    /// \ingroup lemon_io
    1.44    ///
    1.45 @@ -584,12 +560,13 @@
    1.46  
    1.47    private:
    1.48  
    1.49 -    friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph,
    1.50 -                                                  std::istream& is);
    1.51 -    friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph,
    1.52 -                                                  const std::string& fn);
    1.53 -    friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph,
    1.54 -                                                  const char *fn);
    1.55 +    template <typename DGR>
    1.56 +    friend DigraphReader<DGR> digraphReader(DGR& digraph, std::istream& is);
    1.57 +    template <typename DGR>
    1.58 +    friend DigraphReader<DGR> digraphReader(DGR& digraph, 
    1.59 +                                            const std::string& fn);
    1.60 +    template <typename DGR>
    1.61 +    friend DigraphReader<DGR> digraphReader(DGR& digraph, const char *fn);
    1.62  
    1.63      DigraphReader(DigraphReader& other)
    1.64        : _is(other._is), local_is(other.local_is), _digraph(other._digraph),
    1.65 @@ -1210,38 +1187,47 @@
    1.66  
    1.67    };
    1.68  
    1.69 +  /// \brief Return a \ref DigraphReader class
    1.70 +  ///
    1.71 +  /// This function just returns a \ref DigraphReader class.
    1.72 +  /// \relates DigraphReader
    1.73 +  template <typename Digraph>
    1.74 +  DigraphReader<Digraph> digraphReader(Digraph& digraph, std::istream& is) {
    1.75 +    DigraphReader<Digraph> tmp(digraph, is);
    1.76 +    return tmp;
    1.77 +  }
    1.78 +
    1.79 +  /// \brief Return a \ref DigraphReader class
    1.80 +  ///
    1.81 +  /// This function just returns a \ref DigraphReader class.
    1.82 +  /// \relates DigraphReader
    1.83 +  template <typename Digraph>
    1.84 +  DigraphReader<Digraph> digraphReader(Digraph& digraph,
    1.85 +                                       const std::string& fn) {
    1.86 +    DigraphReader<Digraph> tmp(digraph, fn);
    1.87 +    return tmp;
    1.88 +  }
    1.89 +
    1.90 +  /// \brief Return a \ref DigraphReader class
    1.91 +  ///
    1.92 +  /// This function just returns a \ref DigraphReader class.
    1.93 +  /// \relates DigraphReader
    1.94 +  template <typename Digraph>
    1.95 +  DigraphReader<Digraph> digraphReader(Digraph& digraph, const char* fn) {
    1.96 +    DigraphReader<Digraph> tmp(digraph, fn);
    1.97 +    return tmp;
    1.98 +  }
    1.99 +
   1.100    template <typename Graph>
   1.101    class GraphReader;
   1.102 -
   1.103 -  /// \brief Return a \ref GraphReader class
   1.104 -  ///
   1.105 -  /// This function just returns a \ref GraphReader class.
   1.106 -  /// \relates GraphReader
   1.107 + 
   1.108    template <typename Graph>
   1.109 -  GraphReader<Graph> graphReader(Graph& graph, std::istream& is = std::cin) {
   1.110 -    GraphReader<Graph> tmp(graph, is);
   1.111 -    return tmp;
   1.112 -  }
   1.113 -
   1.114 -  /// \brief Return a \ref GraphReader class
   1.115 -  ///
   1.116 -  /// This function just returns a \ref GraphReader class.
   1.117 -  /// \relates GraphReader
   1.118 +  GraphReader<Graph> graphReader(Graph& graph, 
   1.119 +                                 std::istream& is = std::cin);
   1.120    template <typename Graph>
   1.121 -  GraphReader<Graph> graphReader(Graph& graph, const std::string& fn) {
   1.122 -    GraphReader<Graph> tmp(graph, fn);
   1.123 -    return tmp;
   1.124 -  }
   1.125 -
   1.126 -  /// \brief Return a \ref GraphReader class
   1.127 -  ///
   1.128 -  /// This function just returns a \ref GraphReader class.
   1.129 -  /// \relates GraphReader
   1.130 +  GraphReader<Graph> graphReader(Graph& graph, const std::string& fn);
   1.131    template <typename Graph>
   1.132 -  GraphReader<Graph> graphReader(Graph& graph, const char* fn) {
   1.133 -    GraphReader<Graph> tmp(graph, fn);
   1.134 -    return tmp;
   1.135 -  }
   1.136 +  GraphReader<Graph> graphReader(Graph& graph, const char *fn);
   1.137  
   1.138    /// \ingroup lemon_io
   1.139    ///
   1.140 @@ -1368,10 +1354,12 @@
   1.141      }
   1.142  
   1.143    private:
   1.144 -    friend GraphReader<Graph> graphReader<>(Graph& graph, std::istream& is);
   1.145 -    friend GraphReader<Graph> graphReader<>(Graph& graph,
   1.146 -                                            const std::string& fn);
   1.147 -    friend GraphReader<Graph> graphReader<>(Graph& graph, const char *fn);
   1.148 +    template <typename GR>
   1.149 +    friend GraphReader<GR> graphReader(GR& graph, std::istream& is);
   1.150 +    template <typename GR>
   1.151 +    friend GraphReader<GR> graphReader(GR& graph, const std::string& fn); 
   1.152 +    template <typename GR>
   1.153 +    friend GraphReader<GR> graphReader(GR& graph, const char *fn);
   1.154  
   1.155      GraphReader(GraphReader& other)
   1.156        : _is(other._is), local_is(other.local_is), _graph(other._graph),
   1.157 @@ -2040,6 +2028,36 @@
   1.158  
   1.159    };
   1.160  
   1.161 +  /// \brief Return a \ref GraphReader class
   1.162 +  ///
   1.163 +  /// This function just returns a \ref GraphReader class.
   1.164 +  /// \relates GraphReader
   1.165 +  template <typename Graph>
   1.166 +  GraphReader<Graph> graphReader(Graph& graph, std::istream& is) {
   1.167 +    GraphReader<Graph> tmp(graph, is);
   1.168 +    return tmp;
   1.169 +  }
   1.170 +
   1.171 +  /// \brief Return a \ref GraphReader class
   1.172 +  ///
   1.173 +  /// This function just returns a \ref GraphReader class.
   1.174 +  /// \relates GraphReader
   1.175 +  template <typename Graph>
   1.176 +  GraphReader<Graph> graphReader(Graph& graph, const std::string& fn) {
   1.177 +    GraphReader<Graph> tmp(graph, fn);
   1.178 +    return tmp;
   1.179 +  }
   1.180 +
   1.181 +  /// \brief Return a \ref GraphReader class
   1.182 +  ///
   1.183 +  /// This function just returns a \ref GraphReader class.
   1.184 +  /// \relates GraphReader
   1.185 +  template <typename Graph>
   1.186 +  GraphReader<Graph> graphReader(Graph& graph, const char* fn) {
   1.187 +    GraphReader<Graph> tmp(graph, fn);
   1.188 +    return tmp;
   1.189 +  }
   1.190 +
   1.191    class SectionReader;
   1.192  
   1.193    SectionReader sectionReader(std::istream& is);