lemon/lgf_writer.h
changeset 292 e7af73f1805e
parent 290 f6899946c1ac
child 294 cbe3ec2d59d2
equal deleted inserted replaced
19:04acbdd7c66b 20:4b8799a330c9
   461     /// Construct a directed graph writer, which writes to the given
   461     /// Construct a directed graph writer, which writes to the given
   462     /// output file.
   462     /// output file.
   463     DigraphWriter(const std::string& fn, const Digraph& digraph)
   463     DigraphWriter(const std::string& fn, const Digraph& digraph)
   464       : _os(new std::ofstream(fn.c_str())), local_os(true), _digraph(digraph),
   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");
   466       if (!(*_os)) throw IoError("Cannot write file", fn);
   467     }
   467     }
   468 
   468 
   469     /// \brief Constructor
   469     /// \brief Constructor
   470     ///
   470     ///
   471     /// Construct a directed graph writer, which writes to the given
   471     /// Construct a directed graph writer, which writes to the given
   472     /// output file.
   472     /// output file.
   473     DigraphWriter(const char* fn, const Digraph& digraph)
   473     DigraphWriter(const char* fn, const Digraph& digraph)
   474       : _os(new std::ofstream(fn)), local_os(true), _digraph(digraph),
   474       : _os(new std::ofstream(fn)), local_os(true), _digraph(digraph),
   475         _skip_nodes(false), _skip_arcs(false) {
   475         _skip_nodes(false), _skip_arcs(false) {
   476       if (!(*_os)) throw IoError(fn, "Cannot write file");
   476       if (!(*_os)) throw IoError("Cannot write file", fn);
   477     }
   477     }
   478 
   478 
   479     /// \brief Destructor
   479     /// \brief Destructor
   480     ~DigraphWriter() {
   480     ~DigraphWriter() {
   481       for (typename NodeMaps::iterator it = _node_maps.begin();
   481       for (typename NodeMaps::iterator it = _node_maps.begin();
  1021     /// Construct a directed graph writer, which writes to the given
  1021     /// Construct a directed graph writer, which writes to the given
  1022     /// output file.
  1022     /// output file.
  1023     GraphWriter(const std::string& fn, const Graph& graph)
  1023     GraphWriter(const std::string& fn, const Graph& graph)
  1024       : _os(new std::ofstream(fn.c_str())), local_os(true), _graph(graph),
  1024       : _os(new std::ofstream(fn.c_str())), local_os(true), _graph(graph),
  1025         _skip_nodes(false), _skip_edges(false) {
  1025         _skip_nodes(false), _skip_edges(false) {
  1026       if (!(*_os)) throw IoError(fn, "Cannot write file");
  1026       if (!(*_os)) throw IoError("Cannot write file", fn);
  1027     }
  1027     }
  1028 
  1028 
  1029     /// \brief Constructor
  1029     /// \brief Constructor
  1030     ///
  1030     ///
  1031     /// Construct a directed graph writer, which writes to the given
  1031     /// Construct a directed graph writer, which writes to the given
  1032     /// output file.
  1032     /// output file.
  1033     GraphWriter(const char* fn, const Graph& graph)
  1033     GraphWriter(const char* fn, const Graph& graph)
  1034       : _os(new std::ofstream(fn)), local_os(true), _graph(graph),
  1034       : _os(new std::ofstream(fn)), local_os(true), _graph(graph),
  1035         _skip_nodes(false), _skip_edges(false) {
  1035         _skip_nodes(false), _skip_edges(false) {
  1036       if (!(*_os)) throw IoError(fn, "Cannot write file");
  1036       if (!(*_os)) throw IoError("Cannot write file", fn);
  1037     }
  1037     }
  1038 
  1038 
  1039     /// \brief Destructor
  1039     /// \brief Destructor
  1040     ~GraphWriter() {
  1040     ~GraphWriter() {
  1041       for (typename NodeMaps::iterator it = _node_maps.begin();
  1041       for (typename NodeMaps::iterator it = _node_maps.begin();
  1583     /// \brief Constructor
  1583     /// \brief Constructor
  1584     ///
  1584     ///
  1585     /// Construct a section writer, which writes into the given file.
  1585     /// Construct a section writer, which writes into the given file.
  1586     SectionWriter(const std::string& fn)
  1586     SectionWriter(const std::string& fn)
  1587       : _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");
  1588       if (!(*_os)) throw IoError("Cannot write file", fn);
  1589     }
  1589     }
  1590 
  1590 
  1591     /// \brief Constructor
  1591     /// \brief Constructor
  1592     ///
  1592     ///
  1593     /// Construct a section writer, which writes into the given file.
  1593     /// Construct a section writer, which writes into the given file.
  1594     SectionWriter(const char* fn)
  1594     SectionWriter(const char* fn)
  1595       : _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");
  1596       if (!(*_os)) throw IoError("Cannot write file", fn);
  1597     }
  1597     }
  1598 
  1598 
  1599     /// \brief Destructor
  1599     /// \brief Destructor
  1600     ~SectionWriter() {
  1600     ~SectionWriter() {
  1601       for (Sections::iterator it = _sections.begin();
  1601       for (Sections::iterator it = _sections.begin();