COIN-OR::LEMON - Graph Library

Changeset 293:47fbc814aa31 in lemon for lemon/lgf_writer.h


Ignore:
Timestamp:
10/01/08 12:44:16 (11 years ago)
Author:
Peter Kovacs <kpeter@…>
Branch:
default
Phase:
public
Message:

Change the parameter order in LGF reader and writer tools

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/lgf_writer.h

    r248 r293  
    353353
    354354  template <typename Digraph>
    355   DigraphWriter<Digraph> digraphWriter(std::ostream& os,
    356                                        const Digraph& digraph);
     355  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
     356                                       std::ostream& os = std::cout);
    357357
    358358  template <typename Digraph>
    359   DigraphWriter<Digraph> digraphWriter(const std::string& fn,
    360                                        const Digraph& digraph);
     359  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
     360                                       const std::string& fn);
    361361
    362362  template <typename Digraph>
    363   DigraphWriter<Digraph> digraphWriter(const char *fn,
    364                                        const Digraph& digraph);
     363  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
     364                                       const char *fn);
    365365
    366366  /// \ingroup lemon_io
     
    383383  ///
    384384  ///\code
    385   /// DigraphWriter<Digraph>(std::cout, digraph).
     385  /// DigraphWriter<Digraph>(digraph, std::cout).
    386386  ///   nodeMap("coordinates", coord_map).
    387387  ///   nodeMap("size", size).
     
    453453    /// Construct a directed graph writer, which writes to the given
    454454    /// output stream.
    455     DigraphWriter(std::ostream& is, const Digraph& digraph)
    456       : _os(&is), local_os(false), _digraph(digraph),
     455    DigraphWriter(const Digraph& digraph, std::ostream& os = std::cout)
     456      : _os(&os), local_os(false), _digraph(digraph),
    457457        _skip_nodes(false), _skip_arcs(false) {}
    458458
     
    461461    /// Construct a directed graph writer, which writes to the given
    462462    /// output file.
    463     DigraphWriter(const std::string& fn, const Digraph& digraph)
     463    DigraphWriter(const Digraph& digraph, const std::string& fn)
    464464      : _os(new std::ofstream(fn.c_str())), local_os(true), _digraph(digraph),
    465465        _skip_nodes(false), _skip_arcs(false) {}
     
    469469    /// Construct a directed graph writer, which writes to the given
    470470    /// output file.
    471     DigraphWriter(const char* fn, const Digraph& digraph)
     471    DigraphWriter(const Digraph& digraph, const char* fn)
    472472      : _os(new std::ofstream(fn)), local_os(true), _digraph(digraph),
    473473        _skip_nodes(false), _skip_arcs(false) {}
     
    497497  private:
    498498
    499     friend DigraphWriter<Digraph> digraphWriter<>(std::ostream& os,
    500                                                   const Digraph& digraph);
    501     friend DigraphWriter<Digraph> digraphWriter<>(const std::string& fn,
    502                                                   const Digraph& digraph);
    503     friend DigraphWriter<Digraph> digraphWriter<>(const char *fn,
    504                                                   const Digraph& digraph);
     499    friend DigraphWriter<Digraph> digraphWriter<>(const Digraph& digraph,
     500                                                  std::ostream& os);
     501    friend DigraphWriter<Digraph> digraphWriter<>(const Digraph& digraph,
     502                                                  const std::string& fn);
     503    friend DigraphWriter<Digraph> digraphWriter<>(const Digraph& digraph,
     504                                                  const char *fn);
    505505
    506506    DigraphWriter(DigraphWriter& other)
     
    909909  /// \relates DigraphWriter
    910910  template <typename Digraph>
    911   DigraphWriter<Digraph> digraphWriter(std::ostream& os,
    912                                        const Digraph& digraph) {
    913     DigraphWriter<Digraph> tmp(os, digraph);
     911  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
     912                                       std::ostream& os = std::cout) {
     913    DigraphWriter<Digraph> tmp(digraph, os);
    914914    return tmp;
    915915  }
     
    920920  /// \relates DigraphWriter
    921921  template <typename Digraph>
    922   DigraphWriter<Digraph> digraphWriter(const std::string& fn,
    923                                        const Digraph& digraph) {
    924     DigraphWriter<Digraph> tmp(fn, digraph);
     922  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
     923                                       const std::string& fn) {
     924    DigraphWriter<Digraph> tmp(digraph, fn);
    925925    return tmp;
    926926  }
     
    931931  /// \relates DigraphWriter
    932932  template <typename Digraph>
    933   DigraphWriter<Digraph> digraphWriter(const char* fn,
    934                                        const Digraph& digraph) {
    935     DigraphWriter<Digraph> tmp(fn, digraph);
     933  DigraphWriter<Digraph> digraphWriter(const Digraph& digraph,
     934                                       const char* fn) {
     935    DigraphWriter<Digraph> tmp(digraph, fn);
    936936    return tmp;
    937937  }
     
    941941
    942942  template <typename Graph>
    943   GraphWriter<Graph> graphWriter(std::ostream& os, const Graph& graph);
     943  GraphWriter<Graph> graphWriter(const Graph& graph,
     944                                 std::ostream& os = std::cout);
    944945
    945946  template <typename Graph>
    946   GraphWriter<Graph> graphWriter(const std::string& fn, const Graph& graph);
     947  GraphWriter<Graph> graphWriter(const Graph& graph, const std::string& fn);
    947948
    948949  template <typename Graph>
    949   GraphWriter<Graph> graphWriter(const char *fn, const Graph& graph);
     950  GraphWriter<Graph> graphWriter(const Graph& graph, const char *fn);
    950951
    951952  /// \ingroup lemon_io
     
    10091010    /// Construct a directed graph writer, which writes to the given
    10101011    /// output stream.
    1011     GraphWriter(std::ostream& is, const Graph& graph)
    1012       : _os(&is), local_os(false), _graph(graph),
     1012    GraphWriter(const Graph& graph, std::ostream& os = std::cout)
     1013      : _os(&os), local_os(false), _graph(graph),
    10131014        _skip_nodes(false), _skip_edges(false) {}
    10141015
     
    10171018    /// Construct a directed graph writer, which writes to the given
    10181019    /// output file.
    1019     GraphWriter(const std::string& fn, const Graph& graph)
     1020    GraphWriter(const Graph& graph, const std::string& fn)
    10201021      : _os(new std::ofstream(fn.c_str())), local_os(true), _graph(graph),
    10211022        _skip_nodes(false), _skip_edges(false) {}
     
    10251026    /// Construct a directed graph writer, which writes to the given
    10261027    /// output file.
    1027     GraphWriter(const char* fn, const Graph& graph)
     1028    GraphWriter(const Graph& graph, const char* fn)
    10281029      : _os(new std::ofstream(fn)), local_os(true), _graph(graph),
    10291030        _skip_nodes(false), _skip_edges(false) {}
     
    10531054  private:
    10541055
    1055     friend GraphWriter<Graph> graphWriter<>(std::ostream& os,
    1056                                             const Graph& graph);
    1057     friend GraphWriter<Graph> graphWriter<>(const std::string& fn,
    1058                                             const Graph& graph);
    1059     friend GraphWriter<Graph> graphWriter<>(const char *fn,
    1060                                             const Graph& graph);
     1056    friend GraphWriter<Graph> graphWriter<>(const Graph& graph,
     1057                                            std::ostream& os);
     1058    friend GraphWriter<Graph> graphWriter<>(const Graph& graph,
     1059                                            const std::string& fn);
     1060    friend GraphWriter<Graph> graphWriter<>(const Graph& graph,
     1061                                            const char *fn);
    10611062
    10621063    GraphWriter(GraphWriter& other)
     
    15111512  /// \relates GraphWriter
    15121513  template <typename Graph>
    1513   GraphWriter<Graph> graphWriter(std::ostream& os, const Graph& graph) {
    1514     GraphWriter<Graph> tmp(os, graph);
     1514  GraphWriter<Graph> graphWriter(const Graph& graph,
     1515                                 std::ostream& os = std::cout) {
     1516    GraphWriter<Graph> tmp(graph, os);
    15151517    return tmp;
    15161518  }
     
    15211523  /// \relates GraphWriter
    15221524  template <typename Graph>
    1523   GraphWriter<Graph> graphWriter(const std::string& fn, const Graph& graph) {
    1524     GraphWriter<Graph> tmp(fn, graph);
     1525  GraphWriter<Graph> graphWriter(const Graph& graph, const std::string& fn) {
     1526    GraphWriter<Graph> tmp(graph, fn);
    15251527    return tmp;
    15261528  }
     
    15311533  /// \relates GraphWriter
    15321534  template <typename Graph>
    1533   GraphWriter<Graph> graphWriter(const char* fn, const Graph& graph) {
    1534     GraphWriter<Graph> tmp(fn, graph);
     1535  GraphWriter<Graph> graphWriter(const Graph& graph, const char* fn) {
     1536    GraphWriter<Graph> tmp(graph, fn);
    15351537    return tmp;
    15361538  }
Note: See TracChangeset for help on using the changeset viewer.