void QuantityManager::read(const std::string & data) {
	std::stringstream strm(data);
	std::string line;
	while (getline(strm,line)) {
		IBK::trim(line);
		if (line.empty() || line[0] == '#') continue;
		Quantity qd;
		try {
			qd.read(line);
		}
		catch (IBK::Exception & ex) {
			throw IBK::Exception(ex, IBK::FormatString("Cannot read quantity definition from line '%1'.")
				.arg(line), "[QuantityManager::read]");
		}
		// check if we already have such a quantity
		int idx = index(qd);
		if (idx != -1) {
			// replace quantity
			IBK::IBK_Message(IBK::FormatString("Replacing quantity '%1::%2' with new definition.\n")
							 .arg(Quantity::type2string(qd.m_type))
							 .arg(qd.m_name), IBK::MSG_PROGRESS, "QuantityManager::read" ,1);
			m_quantities[idx] = qd;
		}
		else {
			// add quantity to list
			m_quantities.push_back(qd);
			// add new reference to global index map
			m_globalIndexMap[ std::make_pair(qd.m_type, qd.m_name)]= m_quantities.size()-1;
		}
	}
}