COIN-OR::LEMON - Graph Library

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/lgf_writer.h

    r293 r294  
    5656    template <typename T>
    5757    bool operator<(const T&, const T&) {
    58       throw DataFormatError("Label map is not comparable");
     58      throw FormatError("Label map is not comparable");
    5959    }
    6060
     
    204204          _map.find(str);
    205205        if (it == _map.end()) {
    206           throw DataFormatError("Item not found");
     206          throw FormatError("Item not found");
    207207        }
    208208        return it->second;
     
    224224          ::const_iterator it = _map.find(val);
    225225        if (it == _map.end()) {
    226           throw DataFormatError("Item not found");
     226          throw FormatError("Item not found");
    227227        }
    228228        return (_graph.direction(val) ? '+' : '-') + it->second;
     
    463463    DigraphWriter(const Digraph& digraph, const std::string& fn)
    464464      : _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("Cannot write file", fn);
     467    }
    466468
    467469    /// \brief Constructor
     
    471473    DigraphWriter(const Digraph& digraph, const char* fn)
    472474      : _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("Cannot write file", fn);
     477    }
    474478
    475479    /// \brief Destructor
     
    10201024    GraphWriter(const Graph& graph, const std::string& fn)
    10211025      : _os(new std::ofstream(fn.c_str())), local_os(true), _graph(graph),
    1022         _skip_nodes(false), _skip_edges(false) {}
     1026        _skip_nodes(false), _skip_edges(false) {
     1027      if (!(*_os)) throw IoError("Cannot write file", fn);
     1028    }
    10231029
    10241030    /// \brief Constructor
     
    10281034    GraphWriter(const Graph& graph, const char* fn)
    10291035      : _os(new std::ofstream(fn)), local_os(true), _graph(graph),
    1030         _skip_nodes(false), _skip_edges(false) {}
     1036        _skip_nodes(false), _skip_edges(false) {
     1037      if (!(*_os)) throw IoError("Cannot write file", fn);
     1038    }
    10311039
    10321040    /// \brief Destructor
     
    15791587    /// Construct a section writer, which writes into the given file.
    15801588    SectionWriter(const std::string& fn)
    1581       : _os(new std::ofstream(fn.c_str())), local_os(true) {}
     1589      : _os(new std::ofstream(fn.c_str())), local_os(true) {
     1590      if (!(*_os)) throw IoError("Cannot write file", fn);
     1591    }
    15821592
    15831593    /// \brief Constructor
     
    15851595    /// Construct a section writer, which writes into the given file.
    15861596    SectionWriter(const char* fn)
    1587       : _os(new std::ofstream(fn)), local_os(true) {}
     1597      : _os(new std::ofstream(fn)), local_os(true) {
     1598      if (!(*_os)) throw IoError("Cannot write file", fn);
     1599    }
    15881600
    15891601    /// \brief Destructor
Note: See TracChangeset for help on using the changeset viewer.