lemon/lemon_writer.h
changeset 2294 abf880d78522
parent 2260 4274224f8a7d
child 2386 81b47fc5c444
equal deleted inserted replaced
17:642f4685c8b4 18:44a8d3238562
   875     /// \brief Add a new undirected map writer command for the writer.
   875     /// \brief Add a new undirected map writer command for the writer.
   876     ///
   876     ///
   877     /// Add a new undirected map writer command for the writer.
   877     /// Add a new undirected map writer command for the writer.
   878     template <typename Writer, typename Map>
   878     template <typename Writer, typename Map>
   879     UEdgeSetWriter& writeUEdgeMap(std::string name, const Map& map, 
   879     UEdgeSetWriter& writeUEdgeMap(std::string name, const Map& map, 
   880 					  const Writer& writer = Writer()) {
   880                                   const Writer& writer = Writer()) {
   881       checkConcept<concepts::ReadMap<UEdge, typename Map::Value>, Map>();
   881       checkConcept<concepts::ReadMap<UEdge, typename Map::Value>, Map>();
   882       checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
   882       checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
   883       writers.push_back(
   883       writers.push_back(
   884 	make_pair(name, new _writer_bits::
   884 	make_pair(name, new _writer_bits::
   885 		  MapWriter<UEdge, Map, Writer>(map, writer)));
   885 		  MapWriter<UEdge, Map, Writer>(map, writer)));
   898     /// \brief Add a new directed map writer command for the writer.
   898     /// \brief Add a new directed map writer command for the writer.
   899     ///
   899     ///
   900     /// Add a new directed map writer command for the writer.
   900     /// Add a new directed map writer command for the writer.
   901     template <typename Writer, typename Map>
   901     template <typename Writer, typename Map>
   902     UEdgeSetWriter& writeEdgeMap(std::string name, const Map& map, 
   902     UEdgeSetWriter& writeEdgeMap(std::string name, const Map& map, 
   903 				     const Writer& writer = Writer()) {
   903                                  const Writer& writer = Writer()) {
   904       checkConcept<concepts::ReadMap<Edge, typename Map::Value>, Map>();
   904       checkConcept<concepts::ReadMap<Edge, typename Map::Value>, Map>();
   905       checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
   905       checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
   906       writeUEdge("+" + name, 
   906       writeUEdgeMap("+" + name, 
   907 		     _writer_bits::forwardComposeMap(graph, map), writer);
   907                     _writer_bits::forwardComposeMap(graph, map), writer);
   908       writeUEdge("-" + name, 
   908       writeUEdgeMap("-" + name, 
   909 		     _writer_bits::backwardComposeMap(graph, map), writer);
   909                     _writer_bits::backwardComposeMap(graph, map), writer);
   910       return *this;
   910       return *this;
   911     }
   911     }
   912 
   912 
   913   protected:
   913   protected:
   914 
   914 
   953       }
   953       }
   954       for (int i = 0; i < (int)writers.size(); ++i) {
   954       for (int i = 0; i < (int)writers.size(); ++i) {
   955 	os << writers[i].first << '\t';
   955 	os << writers[i].first << '\t';
   956       }
   956       }
   957       os << std::endl;
   957       os << std::endl;
   958       for (typename std::vector<Edge>::iterator it = items.begin();
   958       for (typename std::vector<UEdge>::iterator it = items.begin();
   959            it != items.end(); ++it) {
   959            it != items.end(); ++it) {
   960 	nodeLabelWriter->write(os, graph.source(*it));
   960 	nodeLabelWriter->write(os, graph.source(*it));
   961 	os << '\t';
   961 	os << '\t';
   962 	nodeLabelWriter->write(os, graph.target(*it));
   962 	nodeLabelWriter->write(os, graph.target(*it));
   963 	os << '\t';
   963 	os << '\t';