1949 public: |
1949 public: |
1950 /// \brief Add an attribute reader command for the reader. |
1950 /// \brief Add an attribute reader command for the reader. |
1951 /// |
1951 /// |
1952 /// Add an attribute reader command for the reader. |
1952 /// Add an attribute reader command for the reader. |
1953 template <typename Value> |
1953 template <typename Value> |
1954 AttributeReader& readAttribute(const std::string& id, Value& value) { |
1954 AttributeReader& readAttribute(const std::string& label, Value& value) { |
1955 return readAttribute<typename Traits::template Reader<Value> > |
1955 return readAttribute<typename Traits::template Reader<Value> > |
1956 (id, value); |
1956 (label, value); |
1957 } |
1957 } |
1958 |
1958 |
1959 /// \brief Add an attribute reader command for the reader. |
1959 /// \brief Add an attribute reader command for the reader. |
1960 /// |
1960 /// |
1961 /// Add an attribute reader command for the reader. |
1961 /// Add an attribute reader command for the reader. |
1962 template <typename ItemReader, typename Value> |
1962 template <typename ItemReader, typename Value> |
1963 AttributeReader& readAttribute(std::string label, Value& value, |
1963 AttributeReader& readAttribute(const std::string& label, Value& value, |
1964 const ItemReader& ir = ItemReader()) { |
1964 const ItemReader& ir = ItemReader()) { |
1965 checkConcept<_reader_bits::ItemReader<Value>, ItemReader>(); |
1965 checkConcept<_reader_bits::ItemReader<Value>, ItemReader>(); |
1966 if (readers.find(label) != readers.end()) { |
1966 if (readers.find(label) != readers.end()) { |
1967 ErrorMessage msg; |
1967 ErrorMessage msg; |
1968 msg << "Multiple read rule for attribute: " << label; |
1968 msg << "Multiple read rule for attribute: " << label; |
2010 msg << "Attribute not found in file: " << it->first; |
2010 msg << "Attribute not found in file: " << it->first; |
2011 throw IoParameterError(msg.message()); |
2011 throw IoParameterError(msg.message()); |
2012 } |
2012 } |
2013 } |
2013 } |
2014 } |
2014 } |
2015 |
2015 |
2016 virtual void missing() { |
2016 virtual void missing() { |
2017 if (readers.empty()) return; |
2017 if (readers.empty()) return; |
2018 ErrorMessage msg; |
2018 ErrorMessage msg; |
2019 msg << "Attribute section not found in file: @attributes " << name; |
2019 msg << "Attribute section not found in file: @attributes " << name; |
2020 throw IoParameterError(msg.message()); |
2020 throw IoParameterError(msg.message()); |