Changeset 293:47fbc814aa31 in lemon1.2 for lemon/lgf_writer.h
 Timestamp:
 10/01/08 12:44:16 (15 years ago)
 Branch:
 default
 Phase:
 public
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

lemon/lgf_writer.h
r248 r293 353 353 354 354 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); 357 357 358 358 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); 361 361 362 362 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); 365 365 366 366 /// \ingroup lemon_io … … 383 383 /// 384 384 ///\code 385 /// DigraphWriter<Digraph>( std::cout, digraph).385 /// DigraphWriter<Digraph>(digraph, std::cout). 386 386 /// nodeMap("coordinates", coord_map). 387 387 /// nodeMap("size", size). … … 453 453 /// Construct a directed graph writer, which writes to the given 454 454 /// 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), 457 457 _skip_nodes(false), _skip_arcs(false) {} 458 458 … … 461 461 /// Construct a directed graph writer, which writes to the given 462 462 /// output file. 463 DigraphWriter(const std::string& fn, const Digraph& digraph)463 DigraphWriter(const Digraph& digraph, const std::string& fn) 464 464 : _os(new std::ofstream(fn.c_str())), local_os(true), _digraph(digraph), 465 465 _skip_nodes(false), _skip_arcs(false) {} … … 469 469 /// Construct a directed graph writer, which writes to the given 470 470 /// output file. 471 DigraphWriter(const char* fn, const Digraph& digraph)471 DigraphWriter(const Digraph& digraph, const char* fn) 472 472 : _os(new std::ofstream(fn)), local_os(true), _digraph(digraph), 473 473 _skip_nodes(false), _skip_arcs(false) {} … … 497 497 private: 498 498 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); 505 505 506 506 DigraphWriter(DigraphWriter& other) … … 909 909 /// \relates DigraphWriter 910 910 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); 914 914 return tmp; 915 915 } … … 920 920 /// \relates DigraphWriter 921 921 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); 925 925 return tmp; 926 926 } … … 931 931 /// \relates DigraphWriter 932 932 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); 936 936 return tmp; 937 937 } … … 941 941 942 942 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); 944 945 945 946 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); 947 948 948 949 template <typename Graph> 949 GraphWriter<Graph> graphWriter(const char *fn, const Graph& graph);950 GraphWriter<Graph> graphWriter(const Graph& graph, const char *fn); 950 951 951 952 /// \ingroup lemon_io … … 1009 1010 /// Construct a directed graph writer, which writes to the given 1010 1011 /// 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), 1013 1014 _skip_nodes(false), _skip_edges(false) {} 1014 1015 … … 1017 1018 /// Construct a directed graph writer, which writes to the given 1018 1019 /// output file. 1019 GraphWriter(const std::string& fn, const Graph& graph)1020 GraphWriter(const Graph& graph, const std::string& fn) 1020 1021 : _os(new std::ofstream(fn.c_str())), local_os(true), _graph(graph), 1021 1022 _skip_nodes(false), _skip_edges(false) {} … … 1025 1026 /// Construct a directed graph writer, which writes to the given 1026 1027 /// output file. 1027 GraphWriter(const char* fn, const Graph& graph)1028 GraphWriter(const Graph& graph, const char* fn) 1028 1029 : _os(new std::ofstream(fn)), local_os(true), _graph(graph), 1029 1030 _skip_nodes(false), _skip_edges(false) {} … … 1053 1054 private: 1054 1055 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); 1061 1062 1062 1063 GraphWriter(GraphWriter& other) … … 1511 1512 /// \relates GraphWriter 1512 1513 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); 1515 1517 return tmp; 1516 1518 } … … 1521 1523 /// \relates GraphWriter 1522 1524 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); 1525 1527 return tmp; 1526 1528 } … … 1531 1533 /// \relates GraphWriter 1532 1534 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); 1535 1537 return tmp; 1536 1538 }
Note: See TracChangeset
for help on using the changeset viewer.