470 |
470 |
471 /// \brief Add a new node map writer command for the writer. |
471 /// \brief Add a new node map writer command for the writer. |
472 /// |
472 /// |
473 /// Add a new node map writer command for the writer. |
473 /// Add a new node map writer command for the writer. |
474 template <typename Map> |
474 template <typename Map> |
475 NodeSetWriter& writeNodeMap(std::string name, const Map& map) { |
475 NodeSetWriter& writeNodeMap(std::string label, const Map& map) { |
476 return writeNodeMap<typename Traits:: |
476 return writeNodeMap<typename Traits:: |
477 template Writer<typename Map::Value>, Map>(name, map); |
477 template Writer<typename Map::Value>, Map>(label, map); |
478 } |
478 } |
479 |
479 |
480 /// \brief Add a new node map writer command for the writer. |
480 /// \brief Add a new node map writer command for the writer. |
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 ItemWriter, typename Map> |
484 NodeSetWriter& writeNodeMap(std::string name, const Map& map, |
484 NodeSetWriter& writeNodeMap(std::string label, const Map& map, |
485 const Writer& writer = Writer()) { |
485 const ItemWriter& iw = ItemWriter()) { |
486 checkConcept<concepts::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>,ItemWriter>(); |
488 writers.push_back( |
488 writers.push_back( |
489 make_pair(name, new _writer_bits:: |
489 make_pair(label, new _writer_bits:: |
490 MapWriter<Node, Map, Writer>(map, writer))); |
490 MapWriter<Node, Map, ItemWriter>(map, iw))); |
491 return *this; |
491 return *this; |
492 } |
492 } |
493 |
493 |
494 protected: |
494 protected: |
495 |
495 |
659 |
659 |
660 /// \brief Add a new edge map writer command for the writer. |
660 /// \brief Add a new edge map writer command for the writer. |
661 /// |
661 /// |
662 /// Add a new edge map writer command for the writer. |
662 /// Add a new edge map writer command for the writer. |
663 template <typename Map> |
663 template <typename Map> |
664 EdgeSetWriter& writeEdgeMap(std::string name, const Map& map) { |
664 EdgeSetWriter& writeEdgeMap(std::string label, const Map& map) { |
665 return writeEdgeMap<typename Traits:: |
665 return writeEdgeMap<typename Traits:: |
666 template Writer<typename Map::Value>, Map>(name, map); |
666 template Writer<typename Map::Value>, Map>(label, map); |
667 } |
667 } |
668 |
668 |
669 /// \brief Add a new edge map writer command for the writer. |
669 /// \brief Add a new edge map writer command for the writer. |
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 ItemWriter, typename Map> |
673 EdgeSetWriter& writeEdgeMap(std::string name, const Map& map, |
673 EdgeSetWriter& writeEdgeMap(std::string label, const Map& map, |
674 const Writer& writer = Writer()) { |
674 const ItemWriter& iw = ItemWriter()) { |
675 checkConcept<concepts::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>, ItemWriter>(); |
677 writers.push_back( |
677 writers.push_back( |
678 make_pair(name, new _writer_bits:: |
678 make_pair(label, new _writer_bits:: |
679 MapWriter<Edge, Map, Writer>(map, writer))); |
679 MapWriter<Edge, Map, ItemWriter>(map, iw))); |
680 return *this; |
680 return *this; |
681 } |
681 } |
682 |
682 |
683 protected: |
683 protected: |
684 |
684 |
865 |
865 |
866 /// \brief Add a new undirected edge map writer command for the writer. |
866 /// \brief Add a new undirected edge map writer command for the writer. |
867 /// |
867 /// |
868 /// Add a new undirected map writer command for the writer. |
868 /// Add a new undirected map writer command for the writer. |
869 template <typename Map> |
869 template <typename Map> |
870 UEdgeSetWriter& writeUEdgeMap(std::string name, const Map& map) { |
870 UEdgeSetWriter& writeUEdgeMap(std::string label, const Map& map) { |
871 return writeUEdgeMap<typename Traits:: |
871 return writeUEdgeMap<typename Traits:: |
872 template Writer<typename Map::Value>, Map>(name, map); |
872 template Writer<typename Map::Value>, Map>(label, map); |
873 } |
873 } |
874 |
874 |
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 ItemWriter, typename Map> |
879 UEdgeSetWriter& writeUEdgeMap(std::string name, const Map& map, |
879 UEdgeSetWriter& writeUEdgeMap(std::string label, const Map& map, |
880 const Writer& writer = Writer()) { |
880 const ItemWriter& iw = ItemWriter()) { |
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>, ItemWriter>(); |
883 writers.push_back( |
883 writers.push_back( |
884 make_pair(name, new _writer_bits:: |
884 make_pair(label, new _writer_bits:: |
885 MapWriter<UEdge, Map, Writer>(map, writer))); |
885 MapWriter<UEdge, Map, ItemWriter>(map, iw))); |
886 return *this; |
886 return *this; |
887 } |
887 } |
888 |
888 |
889 /// \brief Add a new directed edge map writer command for the writer. |
889 /// \brief Add a new directed edge map writer command for the writer. |
890 /// |
890 /// |
891 /// Add a new directed map writer command for the writer. |
891 /// Add a new directed map writer command for the writer. |
892 template <typename Map> |
892 template <typename Map> |
893 UEdgeSetWriter& writeEdgeMap(std::string name, const Map& map) { |
893 UEdgeSetWriter& writeEdgeMap(std::string label, const Map& map) { |
894 return writeEdgeMap<typename Traits:: |
894 return writeEdgeMap<typename Traits:: |
895 template Writer<typename Map::Value>, Map>(name, map); |
895 template Writer<typename Map::Value>, Map>(label, map); |
896 } |
896 } |
897 |
897 |
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 ItemWriter, typename Map> |
902 UEdgeSetWriter& writeEdgeMap(std::string name, const Map& map, |
902 UEdgeSetWriter& writeEdgeMap(std::string label, const Map& map, |
903 const Writer& writer = Writer()) { |
903 const ItemWriter& iw = ItemWriter()) { |
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>, ItemWriter>(); |
906 writeUEdgeMap("+" + name, |
906 writeUEdgeMap("+" + name, |
907 _writer_bits::forwardComposeMap(graph, map), writer); |
907 _writer_bits::forwardComposeMap(graph, map), iw); |
908 writeUEdgeMap("-" + name, |
908 writeUEdgeMap("-" + name, |
909 _writer_bits::backwardComposeMap(graph, map), writer); |
909 _writer_bits::backwardComposeMap(graph, map), iw); |
910 return *this; |
910 return *this; |
911 } |
911 } |
912 |
912 |
913 protected: |
913 protected: |
914 |
914 |
1254 public: |
1254 public: |
1255 |
1255 |
1256 /// \brief Add an edge writer command for the UEdgeWriter. |
1256 /// \brief Add an edge writer command for the UEdgeWriter. |
1257 /// |
1257 /// |
1258 /// Add an edge writer command for the UEdgeWriter. |
1258 /// Add an edge writer command for the UEdgeWriter. |
1259 void writeEdge(const std::string& name, const Edge& item) { |
1259 void writeEdge(std::string label, const Edge& item) { |
1260 edgeWriters.push_back(make_pair(name, &item)); |
1260 edgeWriters.push_back(make_pair(label, &item)); |
1261 } |
1261 } |
1262 |
1262 |
1263 /// \brief Add an undirected edge writer command for the UEdgeWriter. |
1263 /// \brief Add an undirected edge writer command for the UEdgeWriter. |
1264 /// |
1264 /// |
1265 /// Add an undirected edge writer command for the UEdgeWriter. |
1265 /// Add an undirected edge writer command for the UEdgeWriter. |
1266 void writeUEdge(const std::string& name, const UEdge& item) { |
1266 void writeUEdge(std::string label, const UEdge& item) { |
1267 uEdgeWriters.push_back(make_pair(name, &item)); |
1267 uEdgeWriters.push_back(make_pair(label, &item)); |
1268 } |
1268 } |
1269 |
1269 |
1270 protected: |
1270 protected: |
1271 |
1271 |
1272 /// \brief The header of the section. |
1272 /// \brief The header of the section. |
1284 throw DataFormatError("Cannot find undirected edgeset or label map"); |
1284 throw DataFormatError("Cannot find undirected edgeset or label map"); |
1285 } |
1285 } |
1286 if (!uEdgeLabelWriter->isLabelWriter()) { |
1286 if (!uEdgeLabelWriter->isLabelWriter()) { |
1287 throw DataFormatError("Cannot find undirected edgeset or label map"); |
1287 throw DataFormatError("Cannot find undirected edgeset or label map"); |
1288 } |
1288 } |
1289 for (int i = 0; i < (int)uEdgeWriters.size(); ++i) { |
1289 for (int i = 0; i < int(uEdgeWriters.size()); ++i) { |
1290 os << uEdgeWriters[i].first << ' '; |
1290 os << uEdgeWriters[i].first << ' '; |
1291 uEdgeLabelWriter->write(os, *(uEdgeWriters[i].second)); |
1291 uEdgeLabelWriter->write(os, *(uEdgeWriters[i].second)); |
1292 os << std::endl; |
1292 os << std::endl; |
1293 } |
1293 } |
1294 for (int i = 0; i < (int)edgeWriters.size(); ++i) { |
1294 for (int i = 0; i < int(edgeWriters.size()); ++i) { |
1295 os << edgeWriters[i].first << ' '; |
1295 os << edgeWriters[i].first << ' '; |
1296 edgeLabelWriter->write(os, *(edgeWriters[i].second)); |
1296 edgeLabelWriter->write(os, *(edgeWriters[i].second)); |
1297 os << std::endl; |
1297 os << std::endl; |
1298 } |
1298 } |
1299 } |
1299 } |
1361 public: |
1361 public: |
1362 /// \brief Add an attribute writer command for the writer. |
1362 /// \brief Add an attribute writer command for the writer. |
1363 /// |
1363 /// |
1364 /// Add an attribute writer command for the writer. |
1364 /// Add an attribute writer command for the writer. |
1365 template <typename Value> |
1365 template <typename Value> |
1366 AttributeWriter& writeAttribute(const std::string& name, |
1366 AttributeWriter& writeAttribute(std::string label, |
1367 const Value& value) { |
1367 const Value& value) { |
1368 return |
1368 return |
1369 writeAttribute<typename Traits::template Writer<Value> >(name, value); |
1369 writeAttribute<typename Traits::template Writer<Value> >(name, value); |
1370 } |
1370 } |
1371 |
1371 |
1372 /// \brief Add an attribute writer command for the writer. |
1372 /// \brief Add an attribute writer command for the writer. |
1373 /// |
1373 /// |
1374 /// Add an attribute writer command for the writer. |
1374 /// Add an attribute writer command for the writer. |
1375 template <typename Writer, typename Value> |
1375 template <typename ItemWriter, typename Value> |
1376 AttributeWriter& writeAttribute(const std::string& name, |
1376 AttributeWriter& writeAttribute(std::string label, const Value& value, |
1377 const Value& value, |
1377 const ItemWriter& iw = ItemWriter()) { |
1378 const Writer& writer = Writer()) { |
1378 checkConcept<_writer_bits::ItemWriter<Value>, ItemWriter>(); |
1379 checkConcept<_writer_bits::ItemWriter<Value>, Writer>(); |
1379 writers.push_back(make_pair(label, new _writer_bits:: |
1380 writers.push_back(make_pair(name, new _writer_bits:: |
1380 ValueWriter<Value, ItemWriter>(value, iw))); |
1381 ValueWriter<Value, Writer>(value, writer))); |
|
1382 return *this; |
1381 return *this; |
1383 } |
1382 } |
1384 |
1383 |
1385 protected: |
1384 protected: |
1386 |
1385 |