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

 1 edited
Legend:
 Unmodified
 Added
 Removed

lemon/lgf_reader.h
r236 r293 391 391 392 392 template <typename Digraph> 393 DigraphReader<Digraph> digraphReader(std::istream& is, Digraph& digraph); 393 DigraphReader<Digraph> digraphReader(Digraph& digraph, 394 std::istream& is = std::cin); 394 395 395 396 template <typename Digraph> 396 DigraphReader<Digraph> digraphReader( const std::string& fn, Digraph& digraph);397 DigraphReader<Digraph> digraphReader(Digraph& digraph, const std::string& fn); 397 398 398 399 template <typename Digraph> 399 DigraphReader<Digraph> digraphReader( const char *fn, Digraph& digraph);400 DigraphReader<Digraph> digraphReader(Digraph& digraph, const char *fn); 400 401 401 402 /// \ingroup lemon_io … … 420 421 /// 421 422 ///\code 422 /// DigraphReader<Digraph>( std::cin, digraph).423 /// DigraphReader<Digraph>(digraph, std::cin). 423 424 /// nodeMap("coordinates", coord_map). 424 425 /// arcMap("capacity", cap_map). … … 500 501 /// Construct a directed graph reader, which reads from the given 501 502 /// input stream. 502 DigraphReader( std::istream& is, Digraph& digraph)503 DigraphReader(Digraph& digraph, std::istream& is = std::cin) 503 504 : _is(&is), local_is(false), _digraph(digraph), 504 505 _use_nodes(false), _use_arcs(false), … … 509 510 /// Construct a directed graph reader, which reads from the given 510 511 /// file. 511 DigraphReader( const std::string& fn, Digraph& digraph)512 DigraphReader(Digraph& digraph, const std::string& fn) 512 513 : _is(new std::ifstream(fn.c_str())), local_is(true), _digraph(digraph), 513 514 _use_nodes(false), _use_arcs(false), … … 518 519 /// Construct a directed graph reader, which reads from the given 519 520 /// file. 520 DigraphReader( const char* fn, Digraph& digraph)521 DigraphReader(Digraph& digraph, const char* fn) 521 522 : _is(new std::ifstream(fn)), local_is(true), _digraph(digraph), 522 523 _use_nodes(false), _use_arcs(false), … … 548 549 private: 549 550 550 friend DigraphReader<Digraph> digraphReader<>( std::istream& is,551 Digraph& digraph);552 friend DigraphReader<Digraph> digraphReader<>( const std::string& fn,553 Digraph& digraph);554 friend DigraphReader<Digraph> digraphReader<>( const char *fn,555 Digraph& digraph);551 friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph, 552 std::istream& is); 553 friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph, 554 const std::string& fn); 555 friend DigraphReader<Digraph> digraphReader<>(Digraph& digraph, 556 const char *fn); 556 557 557 558 DigraphReader(DigraphReader& other) … … 1181 1182 /// \relates DigraphReader 1182 1183 template <typename Digraph> 1183 DigraphReader<Digraph> digraphReader(std::istream& is, Digraph& digraph) { 1184 DigraphReader<Digraph> tmp(is, digraph); 1184 DigraphReader<Digraph> digraphReader(Digraph& digraph, 1185 std::istream& is = std::cin) { 1186 DigraphReader<Digraph> tmp(digraph, is); 1185 1187 return tmp; 1186 1188 } … … 1191 1193 /// \relates DigraphReader 1192 1194 template <typename Digraph> 1193 DigraphReader<Digraph> digraphReader( const std::string& fn,1194 Digraph& digraph) {1195 DigraphReader<Digraph> tmp( fn, digraph);1195 DigraphReader<Digraph> digraphReader(Digraph& digraph, 1196 const std::string& fn) { 1197 DigraphReader<Digraph> tmp(digraph, fn); 1196 1198 return tmp; 1197 1199 } … … 1202 1204 /// \relates DigraphReader 1203 1205 template <typename Digraph> 1204 DigraphReader<Digraph> digraphReader( const char* fn, Digraph& digraph) {1205 DigraphReader<Digraph> tmp( fn, digraph);1206 DigraphReader<Digraph> digraphReader(Digraph& digraph, const char* fn) { 1207 DigraphReader<Digraph> tmp(digraph, fn); 1206 1208 return tmp; 1207 1209 } … … 1211 1213 1212 1214 template <typename Graph> 1213 GraphReader<Graph> graphReader(std::istream& is, Graph& graph); 1215 GraphReader<Graph> graphReader(Graph& graph, 1216 std::istream& is = std::cin); 1214 1217 1215 1218 template <typename Graph> 1216 GraphReader<Graph> graphReader( const std::string& fn, Graph& graph);1219 GraphReader<Graph> graphReader(Graph& graph, const std::string& fn); 1217 1220 1218 1221 template <typename Graph> 1219 GraphReader<Graph> graphReader( const char *fn, Graph& graph);1222 GraphReader<Graph> graphReader(Graph& graph, const char *fn); 1220 1223 1221 1224 /// \ingroup lemon_io … … 1284 1287 /// Construct an undirected graph reader, which reads from the given 1285 1288 /// input stream. 1286 GraphReader( std::istream& is, Graph& graph)1289 GraphReader(Graph& graph, std::istream& is = std::cin) 1287 1290 : _is(&is), local_is(false), _graph(graph), 1288 1291 _use_nodes(false), _use_edges(false), … … 1293 1296 /// Construct an undirected graph reader, which reads from the given 1294 1297 /// file. 1295 GraphReader( const std::string& fn, Graph& graph)1298 GraphReader(Graph& graph, const std::string& fn) 1296 1299 : _is(new std::ifstream(fn.c_str())), local_is(true), _graph(graph), 1297 1300 _use_nodes(false), _use_edges(false), … … 1302 1305 /// Construct an undirected graph reader, which reads from the given 1303 1306 /// file. 1304 GraphReader( const char* fn, Graph& graph)1307 GraphReader(Graph& graph, const char* fn) 1305 1308 : _is(new std::ifstream(fn)), local_is(true), _graph(graph), 1306 1309 _use_nodes(false), _use_edges(false), … … 1331 1334 1332 1335 private: 1333 friend GraphReader<Graph> graphReader<>( std::istream& is, Graph& graph);1334 friend GraphReader<Graph> graphReader<>( const std::string& fn,1335 Graph& graph);1336 friend GraphReader<Graph> graphReader<>( const char *fn, Graph& graph);1336 friend GraphReader<Graph> graphReader<>(Graph& graph, std::istream& is); 1337 friend GraphReader<Graph> graphReader<>(Graph& graph, 1338 const std::string& fn); 1339 friend GraphReader<Graph> graphReader<>(Graph& graph, const char *fn); 1337 1340 1338 1341 GraphReader(GraphReader& other) … … 2007 2010 /// \relates GraphReader 2008 2011 template <typename Graph> 2009 GraphReader<Graph> graphReader( std::istream& is, Graph& graph) {2010 GraphReader<Graph> tmp( is, graph);2012 GraphReader<Graph> graphReader(Graph& graph, std::istream& is = std::cin) { 2013 GraphReader<Graph> tmp(graph, is); 2011 2014 return tmp; 2012 2015 } … … 2017 2020 /// \relates GraphReader 2018 2021 template <typename Graph> 2019 GraphReader<Graph> graphReader(const std::string& fn, 2020 Graph& graph) { 2021 GraphReader<Graph> tmp(fn, graph); 2022 GraphReader<Graph> graphReader(Graph& graph, const std::string& fn) { 2023 GraphReader<Graph> tmp(graph, fn); 2022 2024 return tmp; 2023 2025 } … … 2028 2030 /// \relates GraphReader 2029 2031 template <typename Graph> 2030 GraphReader<Graph> graphReader( const char* fn, Graph& graph) {2031 GraphReader<Graph> tmp( fn, graph);2032 GraphReader<Graph> graphReader(Graph& graph, const char* fn) { 2033 GraphReader<Graph> tmp(graph, fn); 2032 2034 return tmp; 2033 2035 }
Note: See TracChangeset
for help on using the changeset viewer.