diff -r 6d94de269ab1 -r 8c14aa8f27a2 lemon/graph_writer.h --- a/lemon/graph_writer.h Wed Jun 29 19:44:30 2005 +0000 +++ b/lemon/graph_writer.h Thu Jun 30 16:13:30 2005 +0000 @@ -33,9 +33,12 @@ /// \brief The graph writer class. /// - /// The \c GraphWriter class provides the graph output. To write a graph - /// you should first give writing commands for the writer. You can declare - /// write command as \c NodeMap or \c EdgeMap writing and labeled Node and + /// The \c GraphWriter class provides the graph output. + /// Before you read this documentation it might be useful to read the general + /// description of \ref graph-io-page "Graph Input-Output". + /// To write a graph + /// you should first give writing commands to the writer. You can declare + /// write commands as \c NodeMap or \c EdgeMap writing and labeled Node and /// Edge writing. /// /// \code @@ -46,7 +49,7 @@ /// command in the \c GraphWriter. You should give as parameter /// the name of the map and the map object. The NodeMap writing /// command with name "id" should write a unique map because it - /// is regarded as ID map. + /// is regarded as ID map (such a map is essential if the graph has edges). /// /// \code /// IdMap nodeIdMap; @@ -69,8 +72,8 @@ /// \endcode /// /// With \c writeNode() and \c writeEdge() functions you can - /// point out Nodes and Edges in the graph. By example, you can - /// write out the source and target of the graph. + /// point out Nodes and Edges in the graph. For example, you can + /// write out the source and target of a maximum flow instance. /// /// \code /// writer.writeNode("source", sourceNode); @@ -80,7 +83,7 @@ /// \endcode /// /// After you give all write commands you must call the \c run() member - /// function, which execute all the writer commands. + /// function, which executes all the writing commands. /// /// \code /// writer.run(); @@ -105,7 +108,7 @@ /// \brief Construct a new GraphWriter. /// - /// Construct a new GraphWriter. It writes the given graph + /// This function constructs a new GraphWriter to write the given graph /// to the given stream. GraphWriter(std::ostream& _os, const Graph& _graph) : writer(new LemonWriter(_os)), own_writer(true), @@ -117,7 +120,7 @@ /// \brief Construct a new GraphWriter. /// - /// Construct a new GraphWriter. It writes into the given graph + /// This function constructs a new GraphWriter to write the given graph /// to the given file. GraphWriter(const std::string& _filename, const Graph& _graph) : writer(new LemonWriter(_filename)), own_writer(true), @@ -129,8 +132,8 @@ /// \brief Construct a new GraphWriter. /// - /// Construct a new GraphWriter. It writes into the given graph - /// to given LemonReader. + /// This function constructs a new GraphWriter to write the given graph + /// to the given LemonReader. GraphWriter(LemonWriter& _writer, const Graph& _graph) : writer(_writer), own_writer(false), nodeset_writer(*writer, _graph, std::string()), @@ -141,24 +144,24 @@ /// \brief Destruct the graph writer. /// - /// Destruct the graph writer. + /// This function destructs the graph writer. ~GraphWriter() { if (own_writer) delete writer; } - /// \brief Add a new node map writer command for the writer. + /// \brief Issue a new node map writing command for the writer. /// - /// Add a new node map writer command for the writer. + /// This function issues a new node map writing command to the writer. template GraphWriter& writeNodeMap(std::string name, const Map& map) { nodeset_writer.writeNodeMap(name, map); return *this; } - /// \brief Add a new node map writer command for the writer. + /// \brief Issue a new node map writing command for the writer. /// - /// Add a new node map writer command for the writer. + /// This function issues a new node map writing command to the writer. template GraphWriter& writeNodeMap(std::string name, const Map& map, const Writer& writer = Writer()) { @@ -167,9 +170,9 @@ } - /// \brief Add a new edge map writer command for the writer. + /// \brief Issue a new edge map writing command for the writer. /// - /// Add a new edge map writer command for the writer. + /// This function issues a new edge map writing command to the writer. template GraphWriter& writeEdgeMap(std::string name, const Map& map) { edgeset_writer.writeEdgeMap(name, map); @@ -177,9 +180,9 @@ } - /// \brief Add a new edge map writer command for the writer. + /// \brief Issue a new edge map writing command for the writer. /// - /// Add a new edge map writer command for the writer. + /// This function issues a new edge map writing command to the writer. template GraphWriter& writeEdgeMap(std::string name, const Map& map, const Writer& writer = Writer()) { @@ -187,33 +190,37 @@ return *this; } - /// \brief Add a new labeled node writer for the writer. + /// \brief Issue a new labeled node writing command to the writer. /// - /// Add a new labeled node writer for the writer. + /// This function issues a new labeled node writing command + /// to the writer. GraphWriter& writeNode(std::string name, const Node& node) { node_writer.writeNode(name, node); return *this; } - /// \brief Add a new labeled edge writer for the writer. + /// \brief Issue a new labeled edge writing command to the writer. /// - /// Add a new labeled edge writer for the writer. + /// This function issues a new labeled edge writing command + /// to the writer. GraphWriter& writeEdge(std::string name, const Edge& edge) { edge_writer.writeEdge(name, edge); } - /// \brief Add a new attribute writer command. + /// \brief Issue a new attribute writing command. /// - /// Add a new attribute writer command. + /// This function issues a new attribute writing command + /// to the writer. template GraphWriter& writeAttribute(std::string name, const Value& value) { attribute_writer.writeAttribute(name, value); return *this; } - /// \brief Add a new attribute writer command. + /// \brief Issue a new attribute writing command. /// - /// Add a new attribute writer command. + /// This function issues a new attribute writing command + /// to the writer. template GraphWriter& writeAttribute(std::string name, const Value& value, const Writer& writer) { @@ -223,7 +230,7 @@ /// \brief Conversion operator to LemonWriter. /// - /// Conversion operator to LemonWriter. It make possible + /// Conversion operator to LemonWriter. It makes possible /// to access the encapsulated \e LemonWriter, this way /// you can attach to this writer new instances of /// \e LemonWriter::SectionWriter. @@ -231,9 +238,9 @@ return *writer; } - /// \brief Executes the writer commands. + /// \brief Executes the writing commands. /// - /// Executes the writer commands. + /// Executes the writing commands. void run() { writer->run(); } @@ -241,7 +248,7 @@ /// \brief Write the id of the given node. /// /// It writes the id of the given node. If there was written an "id" - /// named node map then it will write the map value belongs to the node. + /// named node map then it will write the map value belonging to the node. void writeId(std::ostream& os, const Node& item) const { nodeset_writer.writeId(os, item); } @@ -249,7 +256,7 @@ /// \brief Write the id of the given edge. /// /// It writes the id of the given edge. If there was written an "id" - /// named edge map then it will write the map value belongs to the edge. + /// named edge map then it will write the map value belonging to the edge. void writeId(std::ostream& os, const Edge& item) const { edgeset_writer.writeId(os, item); } @@ -373,7 +380,7 @@ /// \brief The undirected graph writer class. /// /// The \c UndirGraphWriter class provides the undir graph output. To write - /// a graph you should first give writing commands for the writer. You can + /// a graph you should first give writing commands to the writer. You can /// declare write command as \c NodeMap, \c EdgeMap or \c UndirEdgeMap /// writing and labeled Node, Edge or UndirEdge writing. /// @@ -416,7 +423,7 @@ /// /// /// With \c writeNode() and \c writeUndirEdge() functions you can - /// point out nodes and undirected edges in the graph. By example, you can + /// designate nodes and undirected edges in the graph. For example, you can /// write out the source and target of the graph. /// /// \code @@ -427,7 +434,7 @@ /// \endcode /// /// After you give all write commands you must call the \c run() member - /// function, which execute all the writer commands. + /// function, which executes all the writing commands. /// /// \code /// writer.run(); @@ -465,7 +472,7 @@ /// \brief Construct a new UndirGraphWriter. /// - /// Construct a new UndirGraphWriter. It writes into the given graph + /// Construct a new UndirGraphWriter. It writes the given graph /// to the given file. UndirGraphWriter(const std::string& _filename, const Graph& _graph) : writer(new LemonWriter(_filename)), own_writer(true), @@ -477,7 +484,7 @@ /// \brief Construct a new UndirGraphWriter. /// - /// Construct a new UndirGraphWriter. It writes into the given graph + /// Construct a new UndirGraphWriter. It writes the given graph /// to given LemonReader. UndirGraphWriter(LemonWriter& _writer, const Graph& _graph) : writer(_writer), own_writer(false), @@ -495,18 +502,18 @@ delete writer; } - /// \brief Add a new node map writer command for the writer. + /// \brief Issue a new node map writing command to the writer. /// - /// Add a new node map writer command for the writer. + /// This function issues a new node map writing command to the writer. template UndirGraphWriter& writeNodeMap(std::string name, const Map& map) { nodeset_writer.writeNodeMap(name, map); return *this; } - /// \brief Add a new node map writer command for the writer. + /// \brief Issue a new node map writing command to the writer. /// - /// Add a new node map writer command for the writer. + /// This function issues a new node map writing command to the writer. template UndirGraphWriter& writeNodeMap(std::string name, const Map& map, const Writer& writer = Writer()) { @@ -514,18 +521,18 @@ return *this; } - /// \brief Add a new edge map writer command for the writer. + /// \brief Issue a new edge map writing command to the writer. /// - /// Add a new edge map writer command for the writer. + /// This function issues a new edge map writing command to the writer. template UndirGraphWriter& writeEdgeMap(std::string name, const Map& map) { undir_edgeset_writer.writeEdgeMap(name, map); return *this; } - /// \brief Add a new edge map writer command for the writer. + /// \brief Issue a new edge map writing command to the writer. /// - /// Add a new edge map writer command for the writer. + /// This function issues a new edge map writing command to the writer. template UndirGraphWriter& writeEdgeMap(std::string name, const Map& map, const Writer& writer = Writer()) { @@ -533,18 +540,20 @@ return *this; } - /// \brief Add a new undirected edge map writer command for the writer. + /// \brief Issue a new undirected edge map writing command to the writer. /// - /// Add a new undirected edge map writer command for the writer. + /// This function issues a new undirected edge map writing + /// command to the writer. template UndirGraphWriter& writeUndirEdgeMap(std::string name, const Map& map) { undir_edgeset_writer.writeUndirEdgeMap(name, map); return *this; } - /// \brief Add a new undirected edge map writer command for the writer. + /// \brief Issue a new undirected edge map writing command to the writer. /// - /// Add a new edge undirected map writer command for the writer. + /// This function issues a new undirected edge map writing + /// command to the writer. template UndirGraphWriter& writeUndirEdgeMap(std::string name, const Map& map, const Writer& writer = Writer()) { @@ -552,40 +561,46 @@ return *this; } - /// \brief Add a new labeled node writer for the writer. + /// \brief Issue a new labeled node writer to the writer. /// - /// Add a new labeled node writer for the writer. + /// This function issues a new labeled node writing + /// command to the writer. UndirGraphWriter& writeNode(std::string name, const Node& node) { node_writer.writeNode(name, node); return *this; } - /// \brief Add a new labeled edge writer for the writer. + /// \brief Issue a new labeled edge writer to the writer. /// - /// Add a new labeled edge writer for the writer. + /// This function issues a new labeled edge writing + /// command to the writer. UndirGraphWriter& writeEdge(std::string name, const Edge& edge) { undir_edge_writer.writeEdge(name, edge); } - /// \brief Add a new labeled undirected edge writer for the writer. + /// \brief Issue a new labeled undirected edge writing command to + /// the writer. /// - /// Add a new labeled undirected edge writer for the writer. + /// Issue a new labeled undirected edge writing command to + /// the writer. UndirGraphWriter& writeUndirEdge(std::string name, const UndirEdge& edge) { undir_edge_writer.writeUndirEdge(name, edge); } - /// \brief Add a new attribute writer command. + /// \brief Issue a new attribute writing command. /// - /// Add a new attribute writer command. + /// This function issues a new attribute writing + /// command to the writer. template UndirGraphWriter& writeAttribute(std::string name, const Value& value) { attribute_writer.writeAttribute(name, value); return *this; } - /// \brief Add a new attribute writer command. + /// \brief Issue a new attribute writing command. /// - /// Add a new attribute writer command. + /// This function issues a new attribute writing + /// command to the writer. template UndirGraphWriter& writeAttribute(std::string name, const Value& value, const Writer& writer) { @@ -595,7 +610,7 @@ /// \brief Conversion operator to LemonWriter. /// - /// Conversion operator to LemonWriter. It make possible + /// Conversion operator to LemonWriter. It makes possible /// to access the encapsulated \e LemonWriter, this way /// you can attach to this writer new instances of /// \e LemonWriter::SectionWriter. @@ -603,9 +618,9 @@ return *writer; } - /// \brief Executes the writer commands. + /// \brief Executes the writing commands. /// - /// Executes the writer commands. + /// Executes the writing commands. void run() { writer->run(); } @@ -613,7 +628,7 @@ /// \brief Write the id of the given node. /// /// It writes the id of the given node. If there was written an "id" - /// named node map then it will write the map value belongs to the node. + /// named node map then it will write the map value belonging to the node. void writeId(std::ostream& os, const Node& item) const { nodeset_writer.writeId(os, item); } @@ -621,7 +636,7 @@ /// \brief Write the id of the given edge. /// /// It writes the id of the given edge. If there was written an "id" - /// named edge map then it will write the map value belongs to the edge. + /// named edge map then it will write the map value belonging to the edge. void writeId(std::ostream& os, const Edge& item) const { undir_edgeset_writer.writeId(os, item); } @@ -629,7 +644,7 @@ /// \brief Write the id of the given undirected edge. /// /// It writes the id of the given undirected edge. If there was written - /// an "id" named edge map then it will write the map value belongs to + /// an "id" named edge map then it will write the map value belonging to /// the edge. void writeId(std::ostream& os, const UndirEdge& item) const { undir_edgeset_writer.writeId(os, item); @@ -651,9 +666,11 @@ }; - /// \brief Write an undirected graph to the output. + /// \brief Write an undirected multigraph (undirected graph + capacity + /// map on the edges) to the output. /// - /// Write an undirected graph to the output. + /// Write an undirected multigraph (undirected graph + capacity + /// map on the edges) to the output. /// \param os The output stream. /// \param g The graph. /// \param capacity The capacity undirected map.