Changeset 290:f6899946c1ac in lemon-1.2 for lemon/lgf_writer.h
- Timestamp:
- 09/30/08 20:53:18 (16 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/lgf_writer.h
r248 r290 56 56 template <typename T> 57 57 bool operator<(const T&, const T&) { 58 throw DataFormatError("Label map is not comparable");58 throw FormatError("Label map is not comparable"); 59 59 } 60 60 … … 204 204 _map.find(str); 205 205 if (it == _map.end()) { 206 throw DataFormatError("Item not found");206 throw FormatError("Item not found"); 207 207 } 208 208 return it->second; … … 224 224 ::const_iterator it = _map.find(val); 225 225 if (it == _map.end()) { 226 throw DataFormatError("Item not found");226 throw FormatError("Item not found"); 227 227 } 228 228 return (_graph.direction(val) ? '+' : '-') + it->second; … … 463 463 DigraphWriter(const std::string& fn, const Digraph& digraph) 464 464 : _os(new std::ofstream(fn.c_str())), local_os(true), _digraph(digraph), 465 _skip_nodes(false), _skip_arcs(false) {} 465 _skip_nodes(false), _skip_arcs(false) { 466 if (!(*_os)) throw IoError(fn, "Cannot write file"); 467 } 466 468 467 469 /// \brief Constructor … … 471 473 DigraphWriter(const char* fn, const Digraph& digraph) 472 474 : _os(new std::ofstream(fn)), local_os(true), _digraph(digraph), 473 _skip_nodes(false), _skip_arcs(false) {} 475 _skip_nodes(false), _skip_arcs(false) { 476 if (!(*_os)) throw IoError(fn, "Cannot write file"); 477 } 474 478 475 479 /// \brief Destructor … … 1019 1023 GraphWriter(const std::string& fn, const Graph& graph) 1020 1024 : _os(new std::ofstream(fn.c_str())), local_os(true), _graph(graph), 1021 _skip_nodes(false), _skip_edges(false) {} 1025 _skip_nodes(false), _skip_edges(false) { 1026 if (!(*_os)) throw IoError(fn, "Cannot write file"); 1027 } 1022 1028 1023 1029 /// \brief Constructor … … 1027 1033 GraphWriter(const char* fn, const Graph& graph) 1028 1034 : _os(new std::ofstream(fn)), local_os(true), _graph(graph), 1029 _skip_nodes(false), _skip_edges(false) {} 1035 _skip_nodes(false), _skip_edges(false) { 1036 if (!(*_os)) throw IoError(fn, "Cannot write file"); 1037 } 1030 1038 1031 1039 /// \brief Destructor … … 1577 1585 /// Construct a section writer, which writes into the given file. 1578 1586 SectionWriter(const std::string& fn) 1579 : _os(new std::ofstream(fn.c_str())), local_os(true) {} 1587 : _os(new std::ofstream(fn.c_str())), local_os(true) { 1588 if (!(*_os)) throw IoError(fn, "Cannot write file"); 1589 } 1580 1590 1581 1591 /// \brief Constructor … … 1583 1593 /// Construct a section writer, which writes into the given file. 1584 1594 SectionWriter(const char* fn) 1585 : _os(new std::ofstream(fn)), local_os(true) {} 1595 : _os(new std::ofstream(fn)), local_os(true) { 1596 if (!(*_os)) throw IoError(fn, "Cannot write file"); 1597 } 1586 1598 1587 1599 /// \brief Destructor
Note: See TracChangeset
for help on using the changeset viewer.