gravatar
alpar (Alpar Juttner)
alpar@cs.elte.hu
Merge
0 2 0
merge default
0 files changed with 56 insertions and 14 deletions:
↑ Collapse diff ↑
Ignore white space 24 line context
... ...
@@ -508,37 +508,43 @@
508 508
        _use_nodes(false), _use_arcs(false),
509 509
        _skip_nodes(false), _skip_arcs(false) {}
510 510

	
511 511
    /// \brief Constructor
512 512
    ///
513 513
    /// Construct a directed graph reader, which reads from the given
514 514
    /// file.
515 515
    DigraphReader(Digraph& digraph, const std::string& fn)
516 516
      : _is(new std::ifstream(fn.c_str())), local_is(true),
517 517
        _filename(fn), _digraph(digraph),
518 518
        _use_nodes(false), _use_arcs(false),
519 519
        _skip_nodes(false), _skip_arcs(false) {
520
      if (!(*_is)) throw IoError("Cannot open file", fn);
520
      if (!(*_is)) {
521
        delete _is;
522
        throw IoError("Cannot open file", fn);
523
      }
521 524
    }
522 525

	
523 526
    /// \brief Constructor
524 527
    ///
525 528
    /// Construct a directed graph reader, which reads from the given
526 529
    /// file.
527 530
    DigraphReader(Digraph& digraph, const char* fn)
528 531
      : _is(new std::ifstream(fn)), local_is(true),
529 532
        _filename(fn), _digraph(digraph),
530 533
        _use_nodes(false), _use_arcs(false),
531 534
        _skip_nodes(false), _skip_arcs(false) {
532
      if (!(*_is)) throw IoError("Cannot open file", fn);
535
      if (!(*_is)) {
536
        delete _is;
537
        throw IoError("Cannot open file", fn);
538
      }
533 539
    }
534 540

	
535 541
    /// \brief Destructor
536 542
    ~DigraphReader() {
537 543
      for (typename NodeMaps::iterator it = _node_maps.begin();
538 544
           it != _node_maps.end(); ++it) {
539 545
        delete it->second;
540 546
      }
541 547

	
542 548
      for (typename ArcMaps::iterator it = _arc_maps.begin();
543 549
           it != _arc_maps.end(); ++it) {
544 550
        delete it->second;
... ...
@@ -1299,37 +1305,43 @@
1299 1305
        _use_nodes(false), _use_edges(false),
1300 1306
        _skip_nodes(false), _skip_edges(false) {}
1301 1307

	
1302 1308
    /// \brief Constructor
1303 1309
    ///
1304 1310
    /// Construct an undirected graph reader, which reads from the given
1305 1311
    /// file.
1306 1312
    GraphReader(Graph& graph, const std::string& fn)
1307 1313
      : _is(new std::ifstream(fn.c_str())), local_is(true),
1308 1314
        _filename(fn), _graph(graph),
1309 1315
        _use_nodes(false), _use_edges(false),
1310 1316
        _skip_nodes(false), _skip_edges(false) {
1311
      if (!(*_is)) throw IoError("Cannot open file", fn);
1317
      if (!(*_is)) {
1318
        delete _is;
1319
        throw IoError("Cannot open file", fn);
1320
      }
1312 1321
    }
1313 1322

	
1314 1323
    /// \brief Constructor
1315 1324
    ///
1316 1325
    /// Construct an undirected graph reader, which reads from the given
1317 1326
    /// file.
1318 1327
    GraphReader(Graph& graph, const char* fn)
1319 1328
      : _is(new std::ifstream(fn)), local_is(true),
1320 1329
        _filename(fn), _graph(graph),
1321 1330
        _use_nodes(false), _use_edges(false),
1322 1331
        _skip_nodes(false), _skip_edges(false) {
1323
      if (!(*_is)) throw IoError("Cannot open file", fn);
1332
      if (!(*_is)) {
1333
        delete _is;
1334
        throw IoError("Cannot open file", fn);
1335
      }
1324 1336
    }
1325 1337

	
1326 1338
    /// \brief Destructor
1327 1339
    ~GraphReader() {
1328 1340
      for (typename NodeMaps::iterator it = _node_maps.begin();
1329 1341
           it != _node_maps.end(); ++it) {
1330 1342
        delete it->second;
1331 1343
      }
1332 1344

	
1333 1345
      for (typename EdgeMaps::iterator it = _edge_maps.begin();
1334 1346
           it != _edge_maps.end(); ++it) {
1335 1347
        delete it->second;
... ...
@@ -2085,34 +2097,40 @@
2085 2097
    ///
2086 2098
    /// Construct a section reader, which reads from the given input
2087 2099
    /// stream.
2088 2100
    SectionReader(std::istream& is)
2089 2101
      : _is(&is), local_is(false) {}
2090 2102

	
2091 2103
    /// \brief Constructor
2092 2104
    ///
2093 2105
    /// Construct a section reader, which reads from the given file.
2094 2106
    SectionReader(const std::string& fn)
2095 2107
      : _is(new std::ifstream(fn.c_str())), local_is(true),
2096 2108
        _filename(fn) {
2097
      if (!(*_is)) throw IoError("Cannot open file", fn);
2109
      if (!(*_is)) {
2110
        delete _is;
2111
        throw IoError("Cannot open file", fn);
2112
      }
2098 2113
    }
2099 2114

	
2100 2115
    /// \brief Constructor
2101 2116
    ///
2102 2117
    /// Construct a section reader, which reads from the given file.
2103 2118
    SectionReader(const char* fn)
2104 2119
      : _is(new std::ifstream(fn)), local_is(true),
2105 2120
        _filename(fn) {
2106
      if (!(*_is)) throw IoError("Cannot open file", fn);
2121
      if (!(*_is)) {
2122
        delete _is;
2123
        throw IoError("Cannot open file", fn);
2124
      }
2107 2125
    }
2108 2126

	
2109 2127
    /// \brief Destructor
2110 2128
    ~SectionReader() {
2111 2129
      for (Sections::iterator it = _sections.begin();
2112 2130
           it != _sections.end(); ++it) {
2113 2131
        delete it->second;
2114 2132
      }
2115 2133

	
2116 2134
      if (local_is) {
2117 2135
        delete _is;
2118 2136
      }
... ...
@@ -2377,34 +2395,40 @@
2377 2395
    ///
2378 2396
    /// Construct an \e LGF contents reader, which reads from the given
2379 2397
    /// input stream.
2380 2398
    LgfContents(std::istream& is)
2381 2399
      : _is(&is), local_is(false) {}
2382 2400

	
2383 2401
    /// \brief Constructor
2384 2402
    ///
2385 2403
    /// Construct an \e LGF contents reader, which reads from the given
2386 2404
    /// file.
2387 2405
    LgfContents(const std::string& fn)
2388 2406
      : _is(new std::ifstream(fn.c_str())), local_is(true) {
2389
      if (!(*_is)) throw IoError("Cannot open file", fn);
2407
      if (!(*_is)) {
2408
        delete _is;
2409
        throw IoError("Cannot open file", fn);
2410
      }
2390 2411
    }
2391 2412

	
2392 2413
    /// \brief Constructor
2393 2414
    ///
2394 2415
    /// Construct an \e LGF contents reader, which reads from the given
2395 2416
    /// file.
2396 2417
    LgfContents(const char* fn)
2397 2418
      : _is(new std::ifstream(fn)), local_is(true) {
2398
      if (!(*_is)) throw IoError("Cannot open file", fn);
2419
      if (!(*_is)) {
2420
        delete _is;
2421
        throw IoError("Cannot open file", fn);
2422
      }
2399 2423
    }
2400 2424

	
2401 2425
    /// \brief Destructor
2402 2426
    ~LgfContents() {
2403 2427
      if (local_is) delete _is;
2404 2428
    }
2405 2429

	
2406 2430
  private:
2407 2431

	
2408 2432
    LgfContents(const LgfContents&);
2409 2433
    LgfContents& operator=(const LgfContents&);
2410 2434

	
Ignore white space 6 line context
... ...
@@ -454,35 +454,41 @@
454 454
    /// output stream.
455 455
    DigraphWriter(const Digraph& digraph, std::ostream& os = std::cout)
456 456
      : _os(&os), local_os(false), _digraph(digraph),
457 457
        _skip_nodes(false), _skip_arcs(false) {}
458 458

	
459 459
    /// \brief Constructor
460 460
    ///
461 461
    /// Construct a directed graph writer, which writes to the given
462 462
    /// output file.
463 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) {
466
      if (!(*_os)) throw IoError("Cannot write file", fn);
466
      if (!(*_os)) {
467
        delete _os;
468
        throw IoError("Cannot write file", fn);
469
      }
467 470
    }
468 471

	
469 472
    /// \brief Constructor
470 473
    ///
471 474
    /// Construct a directed graph writer, which writes to the given
472 475
    /// output file.
473 476
    DigraphWriter(const Digraph& digraph, const char* fn)
474 477
      : _os(new std::ofstream(fn)), local_os(true), _digraph(digraph),
475 478
        _skip_nodes(false), _skip_arcs(false) {
476
      if (!(*_os)) throw IoError("Cannot write file", fn);
479
      if (!(*_os)) {
480
        delete _os;
481
        throw IoError("Cannot write file", fn);
482
      }
477 483
    }
478 484

	
479 485
    /// \brief Destructor
480 486
    ~DigraphWriter() {
481 487
      for (typename NodeMaps::iterator it = _node_maps.begin();
482 488
           it != _node_maps.end(); ++it) {
483 489
        delete it->second;
484 490
      }
485 491

	
486 492
      for (typename ArcMaps::iterator it = _arc_maps.begin();
487 493
           it != _arc_maps.end(); ++it) {
488 494
        delete it->second;
... ...
@@ -1015,35 +1021,41 @@
1015 1021
    /// output stream.
1016 1022
    GraphWriter(const Graph& graph, std::ostream& os = std::cout)
1017 1023
      : _os(&os), local_os(false), _graph(graph),
1018 1024
        _skip_nodes(false), _skip_edges(false) {}
1019 1025

	
1020 1026
    /// \brief Constructor
1021 1027
    ///
1022 1028
    /// Construct a directed graph writer, which writes to the given
1023 1029
    /// output file.
1024 1030
    GraphWriter(const Graph& graph, const std::string& fn)
1025 1031
      : _os(new std::ofstream(fn.c_str())), local_os(true), _graph(graph),
1026 1032
        _skip_nodes(false), _skip_edges(false) {
1027
      if (!(*_os)) throw IoError("Cannot write file", fn);
1033
      if (!(*_os)) {
1034
        delete _os;
1035
        throw IoError("Cannot write file", fn);
1036
      }
1028 1037
    }
1029 1038

	
1030 1039
    /// \brief Constructor
1031 1040
    ///
1032 1041
    /// Construct a directed graph writer, which writes to the given
1033 1042
    /// output file.
1034 1043
    GraphWriter(const Graph& graph, const char* fn)
1035 1044
      : _os(new std::ofstream(fn)), local_os(true), _graph(graph),
1036 1045
        _skip_nodes(false), _skip_edges(false) {
1037
      if (!(*_os)) throw IoError("Cannot write file", fn);
1046
      if (!(*_os)) {
1047
        delete _os;
1048
        throw IoError("Cannot write file", fn);
1049
      }
1038 1050
    }
1039 1051

	
1040 1052
    /// \brief Destructor
1041 1053
    ~GraphWriter() {
1042 1054
      for (typename NodeMaps::iterator it = _node_maps.begin();
1043 1055
           it != _node_maps.end(); ++it) {
1044 1056
        delete it->second;
1045 1057
      }
1046 1058

	
1047 1059
      for (typename EdgeMaps::iterator it = _edge_maps.begin();
1048 1060
           it != _edge_maps.end(); ++it) {
1049 1061
        delete it->second;
... ...
@@ -1578,33 +1590,39 @@
1578 1590
    /// \brief Constructor
1579 1591
    ///
1580 1592
    /// Construct a section writer, which writes to the given output
1581 1593
    /// stream.
1582 1594
    SectionWriter(std::ostream& os)
1583 1595
      : _os(&os), local_os(false) {}
1584 1596

	
1585 1597
    /// \brief Constructor
1586 1598
    ///
1587 1599
    /// Construct a section writer, which writes into the given file.
1588 1600
    SectionWriter(const std::string& fn)
1589 1601
      : _os(new std::ofstream(fn.c_str())), local_os(true) {
1590
      if (!(*_os)) throw IoError("Cannot write file", fn);
1602
      if (!(*_os)) {
1603
        delete _os;
1604
        throw IoError("Cannot write file", fn);
1605
      }
1591 1606
    }
1592 1607

	
1593 1608
    /// \brief Constructor
1594 1609
    ///
1595 1610
    /// Construct a section writer, which writes into the given file.
1596 1611
    SectionWriter(const char* fn)
1597 1612
      : _os(new std::ofstream(fn)), local_os(true) {
1598
      if (!(*_os)) throw IoError("Cannot write file", fn);
1613
      if (!(*_os)) {
1614
        delete _os;
1615
        throw IoError("Cannot write file", fn);
1616
      }
1599 1617
    }
1600 1618

	
1601 1619
    /// \brief Destructor
1602 1620
    ~SectionWriter() {
1603 1621
      for (Sections::iterator it = _sections.begin();
1604 1622
           it != _sections.end(); ++it) {
1605 1623
        delete it->second;
1606 1624
      }
1607 1625

	
1608 1626
      if (local_os) {
1609 1627
        delete _os;
1610 1628
      }
0 comments (0 inline)