lemon/lemon_writer.h
changeset 2279 2c3fee01d3ed
parent 2207 75a29ac69c19
child 2282 9d7b12f83daa
equal deleted inserted replaced
16:790edf5eec84 17:642f4685c8b4
    38 #include <lemon/bits/utility.h>
    38 #include <lemon/bits/utility.h>
    39 #include <lemon/maps.h>
    39 #include <lemon/maps.h>
    40 #include <lemon/dim2.h>
    40 #include <lemon/dim2.h>
    41 
    41 
    42 #include <lemon/concept_check.h>
    42 #include <lemon/concept_check.h>
    43 #include <lemon/concept/maps.h>
    43 #include <lemon/concepts/maps.h>
    44 
    44 
    45 
    45 
    46 namespace lemon {
    46 namespace lemon {
    47 
    47 
    48   namespace _writer_bits {
    48   namespace _writer_bits {
   481     ///
   481     ///
   482     /// Add a new node map writer command for the writer.
   482     /// Add a new node map writer command for the writer.
   483     template <typename Writer, typename Map>
   483     template <typename Writer, typename Map>
   484     NodeSetWriter& writeNodeMap(std::string name, const Map& map, 
   484     NodeSetWriter& writeNodeMap(std::string name, const Map& map, 
   485 			    const Writer& writer = Writer()) {
   485 			    const Writer& writer = Writer()) {
   486       checkConcept<concept::ReadMap<Node, typename Map::Value>, Map>();
   486       checkConcept<concepts::ReadMap<Node, typename Map::Value>, Map>();
   487       checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
   487       checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
   488       writers.push_back(
   488       writers.push_back(
   489 	make_pair(name, new _writer_bits::
   489 	make_pair(name, new _writer_bits::
   490 		  MapWriter<Node, Map, Writer>(map, writer)));
   490 		  MapWriter<Node, Map, Writer>(map, writer)));
   491       return *this;
   491       return *this;
   670     ///
   670     ///
   671     /// Add a new edge map writer command for the writer.
   671     /// Add a new edge map writer command for the writer.
   672     template <typename Writer, typename Map>
   672     template <typename Writer, typename Map>
   673     EdgeSetWriter& writeEdgeMap(std::string name, const Map& map, 
   673     EdgeSetWriter& writeEdgeMap(std::string name, const Map& map, 
   674 			    const Writer& writer = Writer()) {
   674 			    const Writer& writer = Writer()) {
   675       checkConcept<concept::ReadMap<Edge, typename Map::Value>, Map>();
   675       checkConcept<concepts::ReadMap<Edge, typename Map::Value>, Map>();
   676       checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
   676       checkConcept<_writer_bits::ItemWriter<typename Map::Value>, Writer>();
   677       writers.push_back(
   677       writers.push_back(
   678 	make_pair(name, new _writer_bits::
   678 	make_pair(name, new _writer_bits::
   679 		  MapWriter<Edge, Map, Writer>(map, writer)));
   679 		  MapWriter<Edge, Map, Writer>(map, writer)));
   680       return *this;
   680       return *this;
   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<concept::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)));
   886       return *this;
   886       return *this;
   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<concept::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       writeUEdge("+" + name, 
   907 		     _writer_bits::forwardComposeMap(graph, map), writer);
   907 		     _writer_bits::forwardComposeMap(graph, map), writer);
   908       writeUEdge("-" + name, 
   908       writeUEdge("-" + name, 
   909 		     _writer_bits::backwardComposeMap(graph, map), writer);
   909 		     _writer_bits::backwardComposeMap(graph, map), writer);