0
2
0
103
85
94
59
| ... | ... |
@@ -386,6 +386,18 @@ |
| 386 | 386 |
|
| 387 | 387 |
} |
| 388 | 388 |
|
| 389 |
template <typename Digraph> |
|
| 390 |
class DigraphReader; |
|
| 391 |
|
|
| 392 |
template <typename Digraph> |
|
| 393 |
DigraphReader<Digraph> digraphReader(std::istream& is, Digraph& digraph); |
|
| 394 |
|
|
| 395 |
template <typename Digraph> |
|
| 396 |
DigraphReader<Digraph> digraphReader(const std::string& fn, Digraph& digraph); |
|
| 397 |
|
|
| 398 |
template <typename Digraph> |
|
| 399 |
DigraphReader<Digraph> digraphReader(const char *fn, Digraph& digraph); |
|
| 400 |
|
|
| 389 | 401 |
/// \ingroup lemon_io |
| 390 | 402 |
/// |
| 391 | 403 |
/// \brief LGF reader for directed graphs |
| ... | ... |
@@ -509,31 +521,6 @@ |
| 509 | 521 |
_use_nodes(false), _use_arcs(false), |
| 510 | 522 |
_skip_nodes(false), _skip_arcs(false) {}
|
| 511 | 523 |
|
| 512 |
/// \brief Copy constructor |
|
| 513 |
/// |
|
| 514 |
/// The copy constructor transfers all data from the other reader, |
|
| 515 |
/// therefore the copied reader will not be usable more. |
|
| 516 |
DigraphReader(DigraphReader& other) |
|
| 517 |
: _is(other._is), local_is(other.local_is), _digraph(other._digraph), |
|
| 518 |
_use_nodes(other._use_nodes), _use_arcs(other._use_arcs), |
|
| 519 |
_skip_nodes(other._skip_nodes), _skip_arcs(other._skip_arcs) {
|
|
| 520 |
|
|
| 521 |
other._is = 0; |
|
| 522 |
other.local_is = false; |
|
| 523 |
|
|
| 524 |
_node_index.swap(other._node_index); |
|
| 525 |
_arc_index.swap(other._arc_index); |
|
| 526 |
|
|
| 527 |
_node_maps.swap(other._node_maps); |
|
| 528 |
_arc_maps.swap(other._arc_maps); |
|
| 529 |
_attributes.swap(other._attributes); |
|
| 530 |
|
|
| 531 |
_nodes_caption = other._nodes_caption; |
|
| 532 |
_arcs_caption = other._arcs_caption; |
|
| 533 |
_attributes_caption = other._attributes_caption; |
|
| 534 |
|
|
| 535 |
} |
|
| 536 |
|
|
| 537 | 524 |
/// \brief Destructor |
| 538 | 525 |
~DigraphReader() {
|
| 539 | 526 |
for (typename NodeMaps::iterator it = _node_maps.begin(); |
| ... | ... |
@@ -559,6 +546,34 @@ |
| 559 | 546 |
|
| 560 | 547 |
private: |
| 561 | 548 |
|
| 549 |
friend DigraphReader<Digraph> digraphReader<>(std::istream& is, |
|
| 550 |
Digraph& digraph); |
|
| 551 |
friend DigraphReader<Digraph> digraphReader<>(const std::string& fn, |
|
| 552 |
Digraph& digraph); |
|
| 553 |
friend DigraphReader<Digraph> digraphReader<>(const char *fn, |
|
| 554 |
Digraph& digraph); |
|
| 555 |
|
|
| 556 |
DigraphReader(DigraphReader& other) |
|
| 557 |
: _is(other._is), local_is(other.local_is), _digraph(other._digraph), |
|
| 558 |
_use_nodes(other._use_nodes), _use_arcs(other._use_arcs), |
|
| 559 |
_skip_nodes(other._skip_nodes), _skip_arcs(other._skip_arcs) {
|
|
| 560 |
|
|
| 561 |
other._is = 0; |
|
| 562 |
other.local_is = false; |
|
| 563 |
|
|
| 564 |
_node_index.swap(other._node_index); |
|
| 565 |
_arc_index.swap(other._arc_index); |
|
| 566 |
|
|
| 567 |
_node_maps.swap(other._node_maps); |
|
| 568 |
_arc_maps.swap(other._arc_maps); |
|
| 569 |
_attributes.swap(other._attributes); |
|
| 570 |
|
|
| 571 |
_nodes_caption = other._nodes_caption; |
|
| 572 |
_arcs_caption = other._arcs_caption; |
|
| 573 |
_attributes_caption = other._attributes_caption; |
|
| 574 |
|
|
| 575 |
} |
|
| 576 |
|
|
| 562 | 577 |
DigraphReader& operator=(const DigraphReader&); |
| 563 | 578 |
|
| 564 | 579 |
public: |
| ... | ... |
@@ -1182,6 +1197,18 @@ |
| 1182 | 1197 |
return tmp; |
| 1183 | 1198 |
} |
| 1184 | 1199 |
|
| 1200 |
template <typename Graph> |
|
| 1201 |
class GraphReader; |
|
| 1202 |
|
|
| 1203 |
template <typename Graph> |
|
| 1204 |
GraphReader<Graph> graphReader(std::istream& is, Graph& graph); |
|
| 1205 |
|
|
| 1206 |
template <typename Graph> |
|
| 1207 |
GraphReader<Graph> graphReader(const std::string& fn, Graph& graph); |
|
| 1208 |
|
|
| 1209 |
template <typename Graph> |
|
| 1210 |
GraphReader<Graph> graphReader(const char *fn, Graph& graph); |
|
| 1211 |
|
|
| 1185 | 1212 |
/// \ingroup lemon_io |
| 1186 | 1213 |
/// |
| 1187 | 1214 |
/// \brief LGF reader for undirected graphs |
| ... | ... |
@@ -1260,31 +1287,6 @@ |
| 1260 | 1287 |
_use_nodes(false), _use_edges(false), |
| 1261 | 1288 |
_skip_nodes(false), _skip_edges(false) {}
|
| 1262 | 1289 |
|
| 1263 |
/// \brief Copy constructor |
|
| 1264 |
/// |
|
| 1265 |
/// The copy constructor transfers all data from the other reader, |
|
| 1266 |
/// therefore the copied reader will not be usable more. |
|
| 1267 |
GraphReader(GraphReader& other) |
|
| 1268 |
: _is(other._is), local_is(other.local_is), _graph(other._graph), |
|
| 1269 |
_use_nodes(other._use_nodes), _use_edges(other._use_edges), |
|
| 1270 |
_skip_nodes(other._skip_nodes), _skip_edges(other._skip_edges) {
|
|
| 1271 |
|
|
| 1272 |
other._is = 0; |
|
| 1273 |
other.local_is = false; |
|
| 1274 |
|
|
| 1275 |
_node_index.swap(other._node_index); |
|
| 1276 |
_edge_index.swap(other._edge_index); |
|
| 1277 |
|
|
| 1278 |
_node_maps.swap(other._node_maps); |
|
| 1279 |
_edge_maps.swap(other._edge_maps); |
|
| 1280 |
_attributes.swap(other._attributes); |
|
| 1281 |
|
|
| 1282 |
_nodes_caption = other._nodes_caption; |
|
| 1283 |
_edges_caption = other._edges_caption; |
|
| 1284 |
_attributes_caption = other._attributes_caption; |
|
| 1285 |
|
|
| 1286 |
} |
|
| 1287 |
|
|
| 1288 | 1290 |
/// \brief Destructor |
| 1289 | 1291 |
~GraphReader() {
|
| 1290 | 1292 |
for (typename NodeMaps::iterator it = _node_maps.begin(); |
| ... | ... |
@@ -1309,6 +1311,31 @@ |
| 1309 | 1311 |
} |
| 1310 | 1312 |
|
| 1311 | 1313 |
private: |
| 1314 |
friend GraphReader<Graph> graphReader<>(std::istream& is, Graph& graph); |
|
| 1315 |
friend GraphReader<Graph> graphReader<>(const std::string& fn, |
|
| 1316 |
Graph& graph); |
|
| 1317 |
friend GraphReader<Graph> graphReader<>(const char *fn, Graph& graph); |
|
| 1318 |
|
|
| 1319 |
GraphReader(GraphReader& other) |
|
| 1320 |
: _is(other._is), local_is(other.local_is), _graph(other._graph), |
|
| 1321 |
_use_nodes(other._use_nodes), _use_edges(other._use_edges), |
|
| 1322 |
_skip_nodes(other._skip_nodes), _skip_edges(other._skip_edges) {
|
|
| 1323 |
|
|
| 1324 |
other._is = 0; |
|
| 1325 |
other.local_is = false; |
|
| 1326 |
|
|
| 1327 |
_node_index.swap(other._node_index); |
|
| 1328 |
_edge_index.swap(other._edge_index); |
|
| 1329 |
|
|
| 1330 |
_node_maps.swap(other._node_maps); |
|
| 1331 |
_edge_maps.swap(other._edge_maps); |
|
| 1332 |
_attributes.swap(other._attributes); |
|
| 1333 |
|
|
| 1334 |
_nodes_caption = other._nodes_caption; |
|
| 1335 |
_edges_caption = other._edges_caption; |
|
| 1336 |
_attributes_caption = other._attributes_caption; |
|
| 1337 |
|
|
| 1338 |
} |
|
| 1312 | 1339 |
|
| 1313 | 1340 |
GraphReader& operator=(const GraphReader&); |
| 1314 | 1341 |
|
| ... | ... |
@@ -1977,6 +2004,12 @@ |
| 1977 | 2004 |
return tmp; |
| 1978 | 2005 |
} |
| 1979 | 2006 |
|
| 2007 |
class SectionReader; |
|
| 2008 |
|
|
| 2009 |
SectionReader sectionReader(std::istream& is); |
|
| 2010 |
SectionReader sectionReader(const std::string& fn); |
|
| 2011 |
SectionReader sectionReader(const char* fn); |
|
| 2012 |
|
|
| 1980 | 2013 |
/// \brief Section reader class |
| 1981 | 2014 |
/// |
| 1982 | 2015 |
/// In the \e LGF file extra sections can be placed, which contain |
| ... | ... |
@@ -2019,19 +2052,6 @@ |
| 2019 | 2052 |
SectionReader(const char* fn) |
| 2020 | 2053 |
: _is(new std::ifstream(fn)), local_is(true) {}
|
| 2021 | 2054 |
|
| 2022 |
/// \brief Copy constructor |
|
| 2023 |
/// |
|
| 2024 |
/// The copy constructor transfers all data from the other reader, |
|
| 2025 |
/// therefore the copied reader will not be usable more. |
|
| 2026 |
SectionReader(SectionReader& other) |
|
| 2027 |
: _is(other._is), local_is(other.local_is) {
|
|
| 2028 |
|
|
| 2029 |
other._is = 0; |
|
| 2030 |
other.local_is = false; |
|
| 2031 |
|
|
| 2032 |
_sections.swap(other._sections); |
|
| 2033 |
} |
|
| 2034 |
|
|
| 2035 | 2055 |
/// \brief Destructor |
| 2036 | 2056 |
~SectionReader() {
|
| 2037 | 2057 |
for (Sections::iterator it = _sections.begin(); |
| ... | ... |
@@ -2047,6 +2067,19 @@ |
| 2047 | 2067 |
|
| 2048 | 2068 |
private: |
| 2049 | 2069 |
|
| 2070 |
friend SectionReader sectionReader(std::istream& is); |
|
| 2071 |
friend SectionReader sectionReader(const std::string& fn); |
|
| 2072 |
friend SectionReader sectionReader(const char* fn); |
|
| 2073 |
|
|
| 2074 |
SectionReader(SectionReader& other) |
|
| 2075 |
: _is(other._is), local_is(other.local_is) {
|
|
| 2076 |
|
|
| 2077 |
other._is = 0; |
|
| 2078 |
other.local_is = false; |
|
| 2079 |
|
|
| 2080 |
_sections.swap(other._sections); |
|
| 2081 |
} |
|
| 2082 |
|
|
| 2050 | 2083 |
SectionReader& operator=(const SectionReader&); |
| 2051 | 2084 |
|
| 2052 | 2085 |
public: |
| ... | ... |
@@ -2296,33 +2329,18 @@ |
| 2296 | 2329 |
LgfContents(const char* fn) |
| 2297 | 2330 |
: _is(new std::ifstream(fn)), local_is(true) {}
|
| 2298 | 2331 |
|
| 2299 |
/// \brief Copy constructor |
|
| 2300 |
/// |
|
| 2301 |
/// The copy constructor transfers all data from the other reader, |
|
| 2302 |
/// therefore the copied reader will not be usable more. |
|
| 2303 |
LgfContents(LgfContents& other) |
|
| 2304 |
: _is(other._is), local_is(other.local_is) {
|
|
| 2305 |
|
|
| 2306 |
other._is = 0; |
|
| 2307 |
other.local_is = false; |
|
| 2308 |
|
|
| 2309 |
_node_sections.swap(other._node_sections); |
|
| 2310 |
_edge_sections.swap(other._edge_sections); |
|
| 2311 |
_attribute_sections.swap(other._attribute_sections); |
|
| 2312 |
_extra_sections.swap(other._extra_sections); |
|
| 2313 |
|
|
| 2314 |
_arc_sections.swap(other._arc_sections); |
|
| 2315 |
|
|
| 2316 |
_node_maps.swap(other._node_maps); |
|
| 2317 |
_edge_maps.swap(other._edge_maps); |
|
| 2318 |
_attributes.swap(other._attributes); |
|
| 2319 |
} |
|
| 2320 |
|
|
| 2321 | 2332 |
/// \brief Destructor |
| 2322 | 2333 |
~LgfContents() {
|
| 2323 | 2334 |
if (local_is) delete _is; |
| 2324 | 2335 |
} |
| 2325 | 2336 |
|
| 2337 |
private: |
|
| 2338 |
|
|
| 2339 |
LgfContents(const LgfContents&); |
|
| 2340 |
LgfContents& operator=(const LgfContents&); |
|
| 2341 |
|
|
| 2342 |
public: |
|
| 2343 |
|
|
| 2326 | 2344 |
|
| 2327 | 2345 |
/// \name Node sections |
| 2328 | 2346 |
/// @{
|
| ... | ... |
@@ -305,6 +305,21 @@ |
| 305 | 305 |
|
| 306 | 306 |
} |
| 307 | 307 |
|
| 308 |
template <typename Digraph> |
|
| 309 |
class DigraphWriter; |
|
| 310 |
|
|
| 311 |
template <typename Digraph> |
|
| 312 |
DigraphWriter<Digraph> digraphWriter(std::ostream& os, |
|
| 313 |
const Digraph& digraph); |
|
| 314 |
|
|
| 315 |
template <typename Digraph> |
|
| 316 |
DigraphWriter<Digraph> digraphWriter(const std::string& fn, |
|
| 317 |
const Digraph& digraph); |
|
| 318 |
|
|
| 319 |
template <typename Digraph> |
|
| 320 |
DigraphWriter<Digraph> digraphWriter(const char *fn, |
|
| 321 |
const Digraph& digraph); |
|
| 322 |
|
|
| 308 | 323 |
/// \ingroup lemon_io |
| 309 | 324 |
/// |
| 310 | 325 |
/// \brief LGF writer for directed graphs |
| ... | ... |
@@ -362,7 +377,7 @@ |
| 362 | 377 |
std::ostream* _os; |
| 363 | 378 |
bool local_os; |
| 364 | 379 |
|
| 365 |
Digraph& _digraph; |
|
| 380 |
const Digraph& _digraph; |
|
| 366 | 381 |
|
| 367 | 382 |
std::string _nodes_caption; |
| 368 | 383 |
std::string _arcs_caption; |
| ... | ... |
@@ -394,7 +409,7 @@ |
| 394 | 409 |
/// |
| 395 | 410 |
/// Construct a directed graph writer, which writes to the given |
| 396 | 411 |
/// output stream. |
| 397 |
DigraphWriter(std::ostream& is, Digraph& digraph) |
|
| 412 |
DigraphWriter(std::ostream& is, const Digraph& digraph) |
|
| 398 | 413 |
: _os(&is), local_os(false), _digraph(digraph), |
| 399 | 414 |
_skip_nodes(false), _skip_arcs(false) {}
|
| 400 | 415 |
|
| ... | ... |
@@ -402,7 +417,7 @@ |
| 402 | 417 |
/// |
| 403 | 418 |
/// Construct a directed graph writer, which writes to the given |
| 404 | 419 |
/// output file. |
| 405 |
DigraphWriter(const std::string& fn, Digraph& digraph) |
|
| 420 |
DigraphWriter(const std::string& fn, const Digraph& digraph) |
|
| 406 | 421 |
: _os(new std::ofstream(fn.c_str())), local_os(true), _digraph(digraph), |
| 407 | 422 |
_skip_nodes(false), _skip_arcs(false) {}
|
| 408 | 423 |
|
| ... | ... |
@@ -410,33 +425,10 @@ |
| 410 | 425 |
/// |
| 411 | 426 |
/// Construct a directed graph writer, which writes to the given |
| 412 | 427 |
/// output file. |
| 413 |
DigraphWriter(const char* fn, Digraph& digraph) |
|
| 428 |
DigraphWriter(const char* fn, const Digraph& digraph) |
|
| 414 | 429 |
: _os(new std::ofstream(fn)), local_os(true), _digraph(digraph), |
| 415 | 430 |
_skip_nodes(false), _skip_arcs(false) {}
|
| 416 | 431 |
|
| 417 |
/// \brief Copy constructor |
|
| 418 |
/// |
|
| 419 |
/// The copy constructor transfers all data from the other writer, |
|
| 420 |
/// therefore the copied writer will not be usable more. |
|
| 421 |
DigraphWriter(DigraphWriter& other) |
|
| 422 |
: _os(other._os), local_os(other.local_os), _digraph(other._digraph), |
|
| 423 |
_skip_nodes(other._skip_nodes), _skip_arcs(other._skip_arcs) {
|
|
| 424 |
|
|
| 425 |
other._os = 0; |
|
| 426 |
other.local_os = false; |
|
| 427 |
|
|
| 428 |
_node_index.swap(other._node_index); |
|
| 429 |
_arc_index.swap(other._arc_index); |
|
| 430 |
|
|
| 431 |
_node_maps.swap(other._node_maps); |
|
| 432 |
_arc_maps.swap(other._arc_maps); |
|
| 433 |
_attributes.swap(other._attributes); |
|
| 434 |
|
|
| 435 |
_nodes_caption = other._nodes_caption; |
|
| 436 |
_arcs_caption = other._arcs_caption; |
|
| 437 |
_attributes_caption = other._attributes_caption; |
|
| 438 |
} |
|
| 439 |
|
|
| 440 | 432 |
/// \brief Destructor |
| 441 | 433 |
~DigraphWriter() {
|
| 442 | 434 |
for (typename NodeMaps::iterator it = _node_maps.begin(); |
| ... | ... |
@@ -461,6 +453,32 @@ |
| 461 | 453 |
|
| 462 | 454 |
private: |
| 463 | 455 |
|
| 456 |
friend DigraphWriter<Digraph> digraphWriter<>(std::ostream& os, |
|
| 457 |
const Digraph& digraph); |
|
| 458 |
friend DigraphWriter<Digraph> digraphWriter<>(const std::string& fn, |
|
| 459 |
const Digraph& digraph); |
|
| 460 |
friend DigraphWriter<Digraph> digraphWriter<>(const char *fn, |
|
| 461 |
const Digraph& digraph); |
|
| 462 |
|
|
| 463 |
DigraphWriter(DigraphWriter& other) |
|
| 464 |
: _os(other._os), local_os(other.local_os), _digraph(other._digraph), |
|
| 465 |
_skip_nodes(other._skip_nodes), _skip_arcs(other._skip_arcs) {
|
|
| 466 |
|
|
| 467 |
other._os = 0; |
|
| 468 |
other.local_os = false; |
|
| 469 |
|
|
| 470 |
_node_index.swap(other._node_index); |
|
| 471 |
_arc_index.swap(other._arc_index); |
|
| 472 |
|
|
| 473 |
_node_maps.swap(other._node_maps); |
|
| 474 |
_arc_maps.swap(other._arc_maps); |
|
| 475 |
_attributes.swap(other._attributes); |
|
| 476 |
|
|
| 477 |
_nodes_caption = other._nodes_caption; |
|
| 478 |
_arcs_caption = other._arcs_caption; |
|
| 479 |
_attributes_caption = other._attributes_caption; |
|
| 480 |
} |
|
| 481 |
|
|
| 464 | 482 |
DigraphWriter& operator=(const DigraphWriter&); |
| 465 | 483 |
|
| 466 | 484 |
public: |
| ... | ... |
@@ -844,7 +862,8 @@ |
| 844 | 862 |
|
| 845 | 863 |
/// \relates DigraphWriter |
| 846 | 864 |
template <typename Digraph> |
| 847 |
DigraphWriter<Digraph> digraphWriter(std::ostream& os, |
|
| 865 |
DigraphWriter<Digraph> digraphWriter(std::ostream& os, |
|
| 866 |
const Digraph& digraph) {
|
|
| 848 | 867 |
DigraphWriter<Digraph> tmp(os, digraph); |
| 849 | 868 |
return tmp; |
| 850 | 869 |
} |
| ... | ... |
@@ -852,18 +871,31 @@ |
| 852 | 871 |
/// \relates DigraphWriter |
| 853 | 872 |
template <typename Digraph> |
| 854 | 873 |
DigraphWriter<Digraph> digraphWriter(const std::string& fn, |
| 855 |
Digraph& digraph) {
|
|
| 874 |
const Digraph& digraph) {
|
|
| 856 | 875 |
DigraphWriter<Digraph> tmp(fn, digraph); |
| 857 | 876 |
return tmp; |
| 858 | 877 |
} |
| 859 | 878 |
|
| 860 | 879 |
/// \relates DigraphWriter |
| 861 | 880 |
template <typename Digraph> |
| 862 |
DigraphWriter<Digraph> digraphWriter(const char* fn, |
|
| 881 |
DigraphWriter<Digraph> digraphWriter(const char* fn, |
|
| 882 |
const Digraph& digraph) {
|
|
| 863 | 883 |
DigraphWriter<Digraph> tmp(fn, digraph); |
| 864 | 884 |
return tmp; |
| 865 | 885 |
} |
| 866 | 886 |
|
| 887 |
template <typename Graph> |
|
| 888 |
class GraphWriter; |
|
| 889 |
|
|
| 890 |
template <typename Graph> |
|
| 891 |
GraphWriter<Graph> graphWriter(std::ostream& os, const Graph& graph); |
|
| 892 |
|
|
| 893 |
template <typename Graph> |
|
| 894 |
GraphWriter<Graph> graphWriter(const std::string& fn, const Graph& graph); |
|
| 895 |
|
|
| 896 |
template <typename Graph> |
|
| 897 |
GraphWriter<Graph> graphWriter(const char *fn, const Graph& graph); |
|
| 898 |
|
|
| 867 | 899 |
/// \ingroup lemon_io |
| 868 | 900 |
/// |
| 869 | 901 |
/// \brief LGF writer for directed graphs |
| ... | ... |
@@ -914,7 +946,7 @@ |
| 914 | 946 |
/// |
| 915 | 947 |
/// Construct a directed graph writer, which writes to the given |
| 916 | 948 |
/// output stream. |
| 917 |
GraphWriter(std::ostream& is, Graph& graph) |
|
| 949 |
GraphWriter(std::ostream& is, const Graph& graph) |
|
| 918 | 950 |
: _os(&is), local_os(false), _graph(graph), |
| 919 | 951 |
_skip_nodes(false), _skip_edges(false) {}
|
| 920 | 952 |
|
| ... | ... |
@@ -922,7 +954,7 @@ |
| 922 | 954 |
/// |
| 923 | 955 |
/// Construct a directed graph writer, which writes to the given |
| 924 | 956 |
/// output file. |
| 925 |
GraphWriter(const std::string& fn, Graph& graph) |
|
| 957 |
GraphWriter(const std::string& fn, const Graph& graph) |
|
| 926 | 958 |
: _os(new std::ofstream(fn.c_str())), local_os(true), _graph(graph), |
| 927 | 959 |
_skip_nodes(false), _skip_edges(false) {}
|
| 928 | 960 |
|
| ... | ... |
@@ -930,33 +962,10 @@ |
| 930 | 962 |
/// |
| 931 | 963 |
/// Construct a directed graph writer, which writes to the given |
| 932 | 964 |
/// output file. |
| 933 |
GraphWriter(const char* fn, Graph& graph) |
|
| 965 |
GraphWriter(const char* fn, const Graph& graph) |
|
| 934 | 966 |
: _os(new std::ofstream(fn)), local_os(true), _graph(graph), |
| 935 | 967 |
_skip_nodes(false), _skip_edges(false) {}
|
| 936 | 968 |
|
| 937 |
/// \brief Copy constructor |
|
| 938 |
/// |
|
| 939 |
/// The copy constructor transfers all data from the other writer, |
|
| 940 |
/// therefore the copied writer will not be usable more. |
|
| 941 |
GraphWriter(GraphWriter& other) |
|
| 942 |
: _os(other._os), local_os(other.local_os), _graph(other._graph), |
|
| 943 |
_skip_nodes(other._skip_nodes), _skip_edges(other._skip_edges) {
|
|
| 944 |
|
|
| 945 |
other._os = 0; |
|
| 946 |
other.local_os = false; |
|
| 947 |
|
|
| 948 |
_node_index.swap(other._node_index); |
|
| 949 |
_edge_index.swap(other._edge_index); |
|
| 950 |
|
|
| 951 |
_node_maps.swap(other._node_maps); |
|
| 952 |
_edge_maps.swap(other._edge_maps); |
|
| 953 |
_attributes.swap(other._attributes); |
|
| 954 |
|
|
| 955 |
_nodes_caption = other._nodes_caption; |
|
| 956 |
_edges_caption = other._edges_caption; |
|
| 957 |
_attributes_caption = other._attributes_caption; |
|
| 958 |
} |
|
| 959 |
|
|
| 960 | 969 |
/// \brief Destructor |
| 961 | 970 |
~GraphWriter() {
|
| 962 | 971 |
for (typename NodeMaps::iterator it = _node_maps.begin(); |
| ... | ... |
@@ -981,6 +990,32 @@ |
| 981 | 990 |
|
| 982 | 991 |
private: |
| 983 | 992 |
|
| 993 |
friend GraphWriter<Graph> graphWriter<>(std::ostream& os, |
|
| 994 |
const Graph& graph); |
|
| 995 |
friend GraphWriter<Graph> graphWriter<>(const std::string& fn, |
|
| 996 |
const Graph& graph); |
|
| 997 |
friend GraphWriter<Graph> graphWriter<>(const char *fn, |
|
| 998 |
const Graph& graph); |
|
| 999 |
|
|
| 1000 |
GraphWriter(GraphWriter& other) |
|
| 1001 |
: _os(other._os), local_os(other.local_os), _graph(other._graph), |
|
| 1002 |
_skip_nodes(other._skip_nodes), _skip_edges(other._skip_edges) {
|
|
| 1003 |
|
|
| 1004 |
other._os = 0; |
|
| 1005 |
other.local_os = false; |
|
| 1006 |
|
|
| 1007 |
_node_index.swap(other._node_index); |
|
| 1008 |
_edge_index.swap(other._edge_index); |
|
| 1009 |
|
|
| 1010 |
_node_maps.swap(other._node_maps); |
|
| 1011 |
_edge_maps.swap(other._edge_maps); |
|
| 1012 |
_attributes.swap(other._attributes); |
|
| 1013 |
|
|
| 1014 |
_nodes_caption = other._nodes_caption; |
|
| 1015 |
_edges_caption = other._edges_caption; |
|
| 1016 |
_attributes_caption = other._attributes_caption; |
|
| 1017 |
} |
|
| 1018 |
|
|
| 984 | 1019 |
GraphWriter& operator=(const GraphWriter&); |
| 985 | 1020 |
|
| 986 | 1021 |
public: |
| ... | ... |
@@ -1410,21 +1445,21 @@ |
| 1410 | 1445 |
|
| 1411 | 1446 |
/// \relates GraphWriter |
| 1412 | 1447 |
template <typename Graph> |
| 1413 |
GraphWriter<Graph> graphWriter(std::ostream& os, Graph& graph) {
|
|
| 1448 |
GraphWriter<Graph> graphWriter(std::ostream& os, const Graph& graph) {
|
|
| 1414 | 1449 |
GraphWriter<Graph> tmp(os, graph); |
| 1415 | 1450 |
return tmp; |
| 1416 | 1451 |
} |
| 1417 | 1452 |
|
| 1418 | 1453 |
/// \relates GraphWriter |
| 1419 | 1454 |
template <typename Graph> |
| 1420 |
GraphWriter<Graph> graphWriter(const std::string& fn, Graph& graph) {
|
|
| 1455 |
GraphWriter<Graph> graphWriter(const std::string& fn, const Graph& graph) {
|
|
| 1421 | 1456 |
GraphWriter<Graph> tmp(fn, graph); |
| 1422 | 1457 |
return tmp; |
| 1423 | 1458 |
} |
| 1424 | 1459 |
|
| 1425 | 1460 |
/// \relates GraphWriter |
| 1426 | 1461 |
template <typename Graph> |
| 1427 |
GraphWriter<Graph> graphWriter(const char* fn, Graph& graph) {
|
|
| 1462 |
GraphWriter<Graph> graphWriter(const char* fn, const Graph& graph) {
|
|
| 1428 | 1463 |
GraphWriter<Graph> tmp(fn, graph); |
| 1429 | 1464 |
return tmp; |
| 1430 | 1465 |
} |
0 comments (0 inline)