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