| 16 | #include <mitkModelFitException.h> |
| 17 | |
| 18 | void mitk::modelFit::StaticParameterMap::Add(const std::string& name, const ValueType& newList) |
| 19 | { |
| 20 | MapType::const_iterator mapIter = m_map.find(name); |
| 21 | |
| 22 | // Only add if the name doesn't exist yet |
| 23 | if (mapIter == m_map.end()) |
| 24 | { |
| 25 | // If the new list contains more than one values, make sure it contains the same number of |
| 26 | // values as other lists that contain more than one value |
| 27 | if (newList.size() > 1) |
| 28 | { |
| 29 | if (m_numValues > 1 && newList.size() != m_numValues) |
| 30 | { |
| 31 | mitkThrowException(ModelFitException) << "Unable to add variable '" << name |
| 32 | << "' to StaticParameterMap: It contains " |
| 33 | << newList.size() << "values (should be " |
| 34 | << m_numValues; |
| 35 | } |
| 36 | else if (m_numValues == 1) |
| 37 | { |
| 38 | m_numValues = newList.size(); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | m_map.insert(StaticParameterType(name, newList)); |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | const mitk::modelFit::StaticParameterMap::ValueType& |
| 47 | mitk::modelFit::StaticParameterMap::Get(const std::string& name) const |