1.1 --- a/src/lemon/graph_writer.h Wed Apr 27 10:42:58 2005 +0000
1.2 +++ b/src/lemon/graph_writer.h Wed Apr 27 10:44:58 2005 +0000
1.3 @@ -168,41 +168,42 @@
1.4 /// GraphWriter<ListGraph> writer(std::cout, graph);
1.5 /// \endcode
1.6 ///
1.7 - /// The \c addNodeMap() function declares a \c NodeMap writing command in the
1.8 - /// \c GraphWriter. You should give as parameter the name of the map and the
1.9 - /// map object. The NodeMap writing command with name "id" should write a
1.10 - /// unique map because it is regarded as ID map.
1.11 + /// The \c writeNodeMap() function declares a \c NodeMap writing
1.12 + /// command in the \c GraphWriter. You should give as parameter
1.13 + /// the name of the map and the map object. The NodeMap writing
1.14 + /// command with name "id" should write a unique map because it
1.15 + /// is regarded as ID map.
1.16 ///
1.17 /// \code
1.18 /// IdMap<ListGraph, Node> nodeIdMap;
1.19 - /// writer.addNodeMap("id", nodeIdMap);
1.20 + /// writer.writeNodeMap("id", nodeIdMap);
1.21 ///
1.22 - /// writer.addNodeMap("x-coord", xCoordMap);
1.23 - /// writer.addNodeMap("y-coord", yCoordMap);
1.24 - /// writer.addNodeMap("color", colorMap);
1.25 + /// writer.writeNodeMap("x-coord", xCoordMap);
1.26 + /// writer.writeNodeMap("y-coord", yCoordMap);
1.27 + /// writer.writeNodeMap("color", colorMap);
1.28 /// \endcode
1.29 ///
1.30 - /// With the \c addEdgeMap() member function you can give an edge map
1.31 + /// With the \c writeEdgeMap() member function you can give an edge map
1.32 /// writing command similar to the NodeMaps.
1.33 ///
1.34 /// \code
1.35 /// DescriptorMap<ListGraph, Edge, ListGraph::EdgeMap<int> >
1.36 /// edgeDescMap(graph);
1.37 - /// writer.addEdgeMap("descriptor", edgeDescMap);
1.38 + /// writer.writeEdgeMap("descriptor", edgeDescMap);
1.39 ///
1.40 - /// writer.addEdgeMap("weight", weightMap);
1.41 - /// writer.addEdgeMap("label", labelMap);
1.42 + /// writer.writeEdgeMap("weight", weightMap);
1.43 + /// writer.writeEdgeMap("label", labelMap);
1.44 /// \endcode
1.45 ///
1.46 - /// With \c addNode() and \c addEdge() functions you can point out Nodes and
1.47 - /// Edges in the graph. By example, you can write out the source and target
1.48 - /// of the graph.
1.49 + /// With \c writeNode() and \c writeEdge() functions you can
1.50 + /// point out Nodes and Edges in the graph. By example, you can
1.51 + /// write out the source and target of the graph.
1.52 ///
1.53 /// \code
1.54 - /// writer.addNode("source", sourceNode);
1.55 - /// writer.addNode("target", targetNode);
1.56 + /// writer.writeNode("source", sourceNode);
1.57 + /// writer.writeNode("target", targetNode);
1.58 ///
1.59 - /// writer.addEdge("observed", edge);
1.60 + /// writer.writeEdge("observed", edge);
1.61 /// \endcode
1.62 ///
1.63 /// After you give all write commands you must call the \c run() member
1.64 @@ -216,7 +217,7 @@
1.65 /// \see QuotedStringWriter
1.66 /// \see IdMap
1.67 /// \see DescriptorMap
1.68 - /// \see \ref GraphReader
1.69 + /// \see \ref GraphWriter
1.70 /// \see \ref graph-io-page
1.71 /// \author Balazs Dezso
1.72 template <typename _Graph, typename _WriterTraits = DefaultWriterTraits>
1.73 @@ -262,8 +263,8 @@
1.74 ///
1.75 /// Add a new node map writer command for the writer.
1.76 template <typename Map>
1.77 - GraphWriter& addNodeMap(std::string name, const Map& map) {
1.78 - return addNodeMap<typename WriterTraits::template Writer<
1.79 + GraphWriter& writeNodeMap(std::string name, const Map& map) {
1.80 + return writeNodeMap<typename WriterTraits::template Writer<
1.81 typename Map::Value>, Map>(name, map);
1.82 }
1.83
1.84 @@ -271,7 +272,7 @@
1.85 ///
1.86 /// Add a new node map writer command for the writer.
1.87 template <typename Writer, typename Map>
1.88 - GraphWriter& addNodeMap(std::string name, const Map& map,
1.89 + GraphWriter& writeNodeMap(std::string name, const Map& map,
1.90 const Writer& writer = Writer()) {
1.91 node_map_writers.push_back(
1.92 make_pair(name, new MapWriter<Node, Map, Writer>(map, writer)));
1.93 @@ -284,8 +285,8 @@
1.94 ///
1.95 /// Add a new edge map writer command for the writer.
1.96 template <typename Map>
1.97 - GraphWriter& addEdgeMap(std::string name, const Map& map) {
1.98 - return addEdgeMap<typename WriterTraits::template Writer<
1.99 + GraphWriter& writeEdgeMap(std::string name, const Map& map) {
1.100 + return writeEdgeMap<typename WriterTraits::template Writer<
1.101 typename Map::Value>, Map>(name, map);
1.102 }
1.103
1.104 @@ -294,7 +295,7 @@
1.105 ///
1.106 /// Add a new edge map writer command for the writer.
1.107 template <typename Writer, typename Map>
1.108 - GraphWriter& addEdgeMap(std::string name,
1.109 + GraphWriter& writeEdgeMap(std::string name,
1.110 const Map& map, const Writer& writer = Writer()) {
1.111 edge_map_writers.push_back(make_pair(name,
1.112 new MapWriter<Edge, Map, Writer>(map, writer)));
1.113 @@ -304,7 +305,7 @@
1.114 /// \brief Add a new labeled node writer for the writer.
1.115 ///
1.116 /// Add a new labeled node writer for the writer.
1.117 - GraphWriter& addNode(std::string name, const Node& node) {
1.118 + GraphWriter& writeNode(std::string name, const Node& node) {
1.119 node_writers.push_back(make_pair(name, node));
1.120 return *this;
1.121 }
1.122 @@ -312,7 +313,7 @@
1.123 /// \brief Add a new labeled edge writer for the writer.
1.124 ///
1.125 /// Add a new labeled edge writer for the writer.
1.126 - GraphWriter& addEdge(std::string name, const Edge& edge) {
1.127 + GraphWriter& writeEdge(std::string name, const Edge& edge) {
1.128 edge_writers.push_back(make_pair(name, edge));
1.129 return *this;
1.130 }
1.131 @@ -467,16 +468,16 @@
1.132 void writeGraph(std::ostream& os, const Graph &g,
1.133 const CapacityMap& capacity, const typename Graph::Node &s,
1.134 const typename Graph::Node &t, const CostMap& cost) {
1.135 - GraphWriter<Graph> reader(os, g);
1.136 + GraphWriter<Graph> writer(os, g);
1.137 IdMap<Graph, typename Graph::Node> nodeIdMap(g);
1.138 - reader.addNodeMap("id", nodeIdMap);
1.139 + writer.writeNodeMap("id", nodeIdMap);
1.140 IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
1.141 - reader.addEdgeMap("id", edgeIdMap);
1.142 - reader.addEdgeMap("capacity", capacity);
1.143 - reader.addEdgeMap("cost", cost);
1.144 - reader.addNode("source", s);
1.145 - reader.addNode("target", t);
1.146 - reader.run();
1.147 + writer.writeEdgeMap("id", edgeIdMap);
1.148 + writer.writeEdgeMap("capacity", capacity);
1.149 + writer.writeEdgeMap("cost", cost);
1.150 + writer.writeNode("source", s);
1.151 + writer.writeNode("target", t);
1.152 + writer.run();
1.153 }
1.154
1.155 /// \brief Write a graph to the output.
1.156 @@ -491,15 +492,15 @@
1.157 void writeGraph(std::ostream& os, const Graph &g,
1.158 const CapacityMap& capacity, const typename Graph::Node &s,
1.159 const typename Graph::Node &t) {
1.160 - GraphWriter<Graph> reader(os, g);
1.161 + GraphWriter<Graph> writer(os, g);
1.162 IdMap<Graph, typename Graph::Node> nodeIdMap(g);
1.163 - reader.addNodeMap("id", nodeIdMap);
1.164 + writer.writeNodeMap("id", nodeIdMap);
1.165 IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
1.166 - reader.addEdgeMap("id", edgeIdMap);
1.167 - reader.addEdgeMap("capacity", capacity);
1.168 - reader.addNode("source", s);
1.169 - reader.addNode("target", t);
1.170 - reader.run();
1.171 + writer.writeEdgeMap("id", edgeIdMap);
1.172 + writer.writeEdgeMap("capacity", capacity);
1.173 + writer.writeNode("source", s);
1.174 + writer.writeNode("target", t);
1.175 + writer.run();
1.176 }
1.177
1.178 /// \brief Write a graph to the output.
1.179 @@ -512,14 +513,14 @@
1.180 template<typename Graph, typename CapacityMap>
1.181 void writeGraph(std::ostream& os, const Graph &g,
1.182 const CapacityMap& capacity, const typename Graph::Node &s) {
1.183 - GraphWriter<Graph> reader(os, g);
1.184 + GraphWriter<Graph> writer(os, g);
1.185 IdMap<Graph, typename Graph::Node> nodeIdMap(g);
1.186 - reader.addNodeMap("id", nodeIdMap);
1.187 + writer.writeNodeMap("id", nodeIdMap);
1.188 IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
1.189 - reader.addEdgeMap("id", edgeIdMap);
1.190 - reader.addEdgeMap("capacity", capacity);
1.191 - reader.addNode("source", s);
1.192 - reader.run();
1.193 + writer.writeEdgeMap("id", edgeIdMap);
1.194 + writer.writeEdgeMap("capacity", capacity);
1.195 + writer.writeNode("source", s);
1.196 + writer.run();
1.197 }
1.198
1.199 /// \brief Write a graph to the output.
1.200 @@ -531,13 +532,13 @@
1.201 template<typename Graph, typename CapacityMap>
1.202 void writeGraph(std::ostream& os, const Graph &g,
1.203 const CapacityMap& capacity) {
1.204 - GraphWriter<Graph> reader(os, g);
1.205 + GraphWriter<Graph> writer(os, g);
1.206 IdMap<Graph, typename Graph::Node> nodeIdMap(g);
1.207 - reader.addNodeMap("id", nodeIdMap);
1.208 + writer.writeNodeMap("id", nodeIdMap);
1.209 IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
1.210 - reader.addEdgeMap("id", edgeIdMap);
1.211 - reader.addEdgeMap("capacity", capacity);
1.212 - reader.run();
1.213 + writer.writeEdgeMap("id", edgeIdMap);
1.214 + writer.writeEdgeMap("capacity", capacity);
1.215 + writer.run();
1.216 }
1.217
1.218 /// \brief Write a graph to the output.
1.219 @@ -547,12 +548,12 @@
1.220 /// \param g The graph.
1.221 template<typename Graph>
1.222 void writeGraph(std::ostream& os, const Graph &g) {
1.223 - GraphWriter<Graph> reader(os, g);
1.224 + GraphWriter<Graph> writer(os, g);
1.225 IdMap<Graph, typename Graph::Node> nodeIdMap(g);
1.226 - reader.addNodeMap("id", nodeIdMap);
1.227 + writer.writeNodeMap("id", nodeIdMap);
1.228 IdMap<Graph, typename Graph::Edge> edgeIdMap(g);
1.229 - reader.addEdgeMap("id", edgeIdMap);
1.230 - reader.run();
1.231 + writer.writeEdgeMap("id", edgeIdMap);
1.232 + writer.run();
1.233 }
1.234
1.235 /// @}