MCPcopy Create free account
hub / github.com/MITK/MITK / Add

Method Add

Modules/ModelFit/src/Common/mitkModelFitStaticParameterMap.cpp:18–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16#include <mitkModelFitException.h>
17
18void 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
46const mitk::modelFit::StaticParameterMap::ValueType&
47mitk::modelFit::StaticParameterMap::Get(const std::string& name) const

Calls 3

findMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45