22 mitk::EnumerationProperty::IdMapForClassNameContainerType mitk::EnumerationProperty::s_IdMapForClassName;
23 mitk::EnumerationProperty::StringMapForClassNameContainerType mitk::EnumerationProperty::s_StringMapForClassName;
31 :
BaseProperty(other), m_CurrentValue(other.m_CurrentValue)
37 if ((!IsValidEnumerationValue(name)) && (!IsValidEnumerationValue(
id)))
39 GetEnumIds().insert(std::make_pair(
id, name));
40 GetEnumStrings().insert(std::make_pair(name,
id));
51 if (IsValidEnumerationValue(name))
53 m_CurrentValue = GetEnumId(name);
65 if (IsValidEnumerationValue(
id))
79 return m_CurrentValue;
84 return GetEnumString(m_CurrentValue);
90 GetEnumStrings().clear();
96 return GetEnumIds().size();
101 return GetEnumIds().begin();
106 return GetEnumIds().end();
111 if (IsValidEnumerationValue(
id))
113 return GetEnumIds().find(
id)->second;
117 return "invalid enum id or enums empty";
123 if (IsValidEnumerationValue(name))
125 return GetEnumStrings().find(name)->second;
135 const Self &other =
static_cast<const Self &
>(property);
136 return this->Size() == other.Size() && this->GetValueAsId() == other.GetValueAsId() &&
137 std::equal(this->Begin(), this->End(), other.Begin());
142 const Self &other =
static_cast<const Self &
>(property);
143 this->GetEnumIds() = other.GetEnumIds();
144 this->GetEnumStrings() = other.GetEnumStrings();
145 this->m_CurrentValue = other.m_CurrentValue;
146 this->Size() == other.Size() && this->GetValueAsId() == other.GetValueAsId() &&
147 std::equal(this->Begin(), this->End(), other.Begin());
153 return (GetEnumIds().find(val) != GetEnumIds().end());
158 return (GetEnumStrings().find(val) != GetEnumStrings().end());
163 std::string className = this->GetNameOfClass();
164 return s_IdMapForClassName[className];
169 std::string className = this->GetNameOfClass();
170 return s_IdMapForClassName[className];
175 std::string className = this->GetNameOfClass();
176 return s_StringMapForClassName[className];
181 std::string className = this->GetNameOfClass();
182 return s_StringMapForClassName[className];
188 result->UnRegister();
virtual bool SetValue(const std::string &name)
virtual std::string GetValueAsString() const override
virtual bool IsEqual(const BaseProperty &property) const override
itk::SmartPointer< Self > Pointer
virtual bool Assign(const BaseProperty &property) override
virtual bool IsValidEnumerationValue(const IdType &val) const
itk::LightObject::Pointer InternalClone() const override
virtual bool AddEnum(const std::string &name, const IdType &id)
const EnumStringsContainerType & GetEnumStrings() const
Abstract base class for properties.
EnumIdsContainerType::const_iterator EnumConstIterator
std::map< IdType, std::string > EnumIdsContainerType
virtual EnumConstIterator End() const
virtual EnumIdsContainerType::size_type Size() const
virtual IdType GetEnumId(const std::string &name) const
const EnumIdsContainerType & GetEnumIds() const
virtual EnumConstIterator Begin() const
virtual std::string GetEnumString(const IdType &id) const
std::map< std::string, IdType > EnumStringsContainerType
virtual IdType GetValueAsId() const