equal
deleted
inserted
replaced
893 it->second->touch(); |
893 it->second->touch(); |
894 index.push_back(it->second); |
894 index.push_back(it->second); |
895 } else { |
895 } else { |
896 index.push_back(&skipper); |
896 index.push_back(&skipper); |
897 } |
897 } |
898 if (id == "label" || (id =="id" && inverter.get() == 0)) { |
898 if (id == "label") { |
899 inverter.reset(index.back()->getInverter()); |
899 inverter.reset(index.back()->getInverter()); |
900 index.back() = inverter.get(); |
900 index.back() = inverter.get(); |
901 } |
901 } |
902 } |
902 } |
903 for (typename MapReaders::iterator it = readers.begin(); |
903 for (typename MapReaders::iterator it = readers.begin(); |
918 } |
918 } |
919 |
919 |
920 virtual void missing() { |
920 virtual void missing() { |
921 if (readers.empty()) return; |
921 if (readers.empty()) return; |
922 ErrorMessage msg; |
922 ErrorMessage msg; |
923 msg << "NodeSet section not found in file: " << name; |
923 msg << "NodeSet section not found in file: @nodeset " << name; |
924 throw IOParameterError(msg.message()); |
924 throw IOParameterError(msg.message()); |
925 } |
925 } |
926 |
926 |
927 public: |
927 public: |
928 |
928 |
1126 index.push_back(it->second); |
1126 index.push_back(it->second); |
1127 it->second->touch(); |
1127 it->second->touch(); |
1128 } else { |
1128 } else { |
1129 index.push_back(&skipper); |
1129 index.push_back(&skipper); |
1130 } |
1130 } |
1131 if (id == "label" || (id =="id" && inverter.get() == 0)) { |
1131 if (id == "label") { |
1132 inverter.reset(index.back()->getInverter()); |
1132 inverter.reset(index.back()->getInverter()); |
1133 index.back() = inverter.get(); |
1133 index.back() = inverter.get(); |
1134 } |
1134 } |
1135 } |
1135 } |
1136 for (typename MapReaders::iterator it = readers.begin(); |
1136 for (typename MapReaders::iterator it = readers.begin(); |
1153 } |
1153 } |
1154 |
1154 |
1155 virtual void missing() { |
1155 virtual void missing() { |
1156 if (readers.empty()) return; |
1156 if (readers.empty()) return; |
1157 ErrorMessage msg; |
1157 ErrorMessage msg; |
1158 msg << "EdgeSet section not found in file: " << name; |
1158 msg << "EdgeSet section not found in file: @edgeset " << name; |
1159 throw IOParameterError(msg.message()); |
1159 throw IOParameterError(msg.message()); |
1160 } |
1160 } |
1161 |
1161 |
1162 public: |
1162 public: |
1163 |
1163 |
1177 edge = inverter->read(is); |
1177 edge = inverter->read(is); |
1178 } |
1178 } |
1179 |
1179 |
1180 private: |
1180 private: |
1181 |
1181 |
1182 typedef std::map<std::string, _reader_bits::MapReaderBase<Edge>*> MapReaders; |
1182 typedef std::map<std::string, _reader_bits::MapReaderBase<Edge>*> |
|
1183 MapReaders; |
|
1184 |
1183 MapReaders readers; |
1185 MapReaders readers; |
1184 |
1186 |
1185 Graph& graph; |
1187 Graph& graph; |
1186 std::string name; |
1188 std::string name; |
1187 _reader_bits::SkipReader<Edge, DefaultSkipper> skipper; |
1189 _reader_bits::SkipReader<Edge, DefaultSkipper> skipper; |
1211 /// as id map. This map should contain only unique values and when the |
1213 /// as id map. This map should contain only unique values and when the |
1212 /// \c readLabel() member will read a value from the given stream it will |
1214 /// \c readLabel() member will read a value from the given stream it will |
1213 /// give back that uicted edge which is mapped to this value. |
1215 /// give back that uicted edge which is mapped to this value. |
1214 /// |
1216 /// |
1215 /// The undirected edgeset reader needs a node id reader to identify which |
1217 /// The undirected edgeset reader needs a node id reader to identify which |
1216 /// nodes have to be connected. If a NodeSetReader reads an "label" named map, |
1218 /// nodes have to be connected. If a NodeSetReader reads an "label" named |
1217 /// it will be able to resolve the nodes by ids. |
1219 /// map, it will be able to resolve the nodes by ids. |
1218 /// |
1220 /// |
1219 /// \relates LemonReader |
1221 /// \relates LemonReader |
1220 template <typename _Graph, typename _Traits = DefaultReaderTraits> |
1222 template <typename _Graph, typename _Traits = DefaultReaderTraits> |
1221 class UEdgeSetReader : public LemonReader::SectionReader { |
1223 class UEdgeSetReader : public LemonReader::SectionReader { |
1222 typedef LemonReader::SectionReader Parent; |
1224 typedef LemonReader::SectionReader Parent; |
1429 index.push_back(it->second); |
1431 index.push_back(it->second); |
1430 it->second->touch(); |
1432 it->second->touch(); |
1431 } else { |
1433 } else { |
1432 index.push_back(&skipper); |
1434 index.push_back(&skipper); |
1433 } |
1435 } |
1434 if (id == "label" || (id =="id" && inverter.get() == 0)) { |
1436 if (id == "label") { |
1435 inverter.reset(index.back()->getInverter()); |
1437 inverter.reset(index.back()->getInverter()); |
1436 index.back() = inverter.get(); |
1438 index.back() = inverter.get(); |
1437 } |
1439 } |
1438 } |
1440 } |
1439 for (typename MapReaders::iterator it = readers.begin(); |
1441 for (typename MapReaders::iterator it = readers.begin(); |
1456 } |
1458 } |
1457 |
1459 |
1458 virtual void missing() { |
1460 virtual void missing() { |
1459 if (readers.empty()) return; |
1461 if (readers.empty()) return; |
1460 ErrorMessage msg; |
1462 ErrorMessage msg; |
1461 msg << "UEdgeSet section not found in file: " << name; |
1463 msg << "UEdgeSet section not found in file: @uedgeset " << name; |
1462 throw IOParameterError(msg.message()); |
1464 throw IOParameterError(msg.message()); |
1463 } |
1465 } |
1464 |
1466 |
1465 public: |
1467 public: |
1466 |
1468 |
1613 } |
1615 } |
1614 |
1616 |
1615 virtual void missing() { |
1617 virtual void missing() { |
1616 if (readers.empty()) return; |
1618 if (readers.empty()) return; |
1617 ErrorMessage msg; |
1619 ErrorMessage msg; |
1618 msg << "Nodes section not found in file: " << name; |
1620 msg << "Nodes section not found in file: @nodes " << name; |
1619 throw IOParameterError(msg.message()); |
1621 throw IOParameterError(msg.message()); |
1620 } |
1622 } |
1621 |
1623 |
1622 private: |
1624 private: |
1623 |
1625 |
1726 } |
1728 } |
1727 |
1729 |
1728 virtual void missing() { |
1730 virtual void missing() { |
1729 if (readers.empty()) return; |
1731 if (readers.empty()) return; |
1730 ErrorMessage msg; |
1732 ErrorMessage msg; |
1731 msg << "Edges section not found in file: " << name; |
1733 msg << "Edges section not found in file: @edges " << name; |
1732 throw IOParameterError(msg.message()); |
1734 throw IOParameterError(msg.message()); |
1733 } |
1735 } |
1734 |
1736 |
1735 private: |
1737 private: |
1736 |
1738 |
1878 } |
1880 } |
1879 |
1881 |
1880 virtual void missing() { |
1882 virtual void missing() { |
1881 if (edgeReaders.empty() && uEdgeReaders.empty()) return; |
1883 if (edgeReaders.empty() && uEdgeReaders.empty()) return; |
1882 ErrorMessage msg; |
1884 ErrorMessage msg; |
1883 msg << "UEdges section not found in file: " << name; |
1885 msg << "UEdges section not found in file: @uedges " << name; |
1884 throw IOParameterError(msg.message()); |
1886 throw IOParameterError(msg.message()); |
1885 } |
1887 } |
1886 |
1888 |
1887 private: |
1889 private: |
1888 |
1890 |
2005 } |
2007 } |
2006 |
2008 |
2007 virtual void missing() { |
2009 virtual void missing() { |
2008 if (readers.empty()) return; |
2010 if (readers.empty()) return; |
2009 ErrorMessage msg; |
2011 ErrorMessage msg; |
2010 msg << "Attribute section not found in file: " << name; |
2012 msg << "Attribute section not found in file: @attributes " << name; |
2011 throw IOParameterError(msg.message()); |
2013 throw IOParameterError(msg.message()); |
2012 } |
2014 } |
2013 |
2015 |
2014 private: |
2016 private: |
2015 std::string name; |
2017 std::string name; |