Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _MITK_ENUMERATION_PROPERTY__H_
00019 #define _MITK_ENUMERATION_PROPERTY__H_
00020
00021 #include "mitkBaseProperty.h"
00022 #include <map>
00023 #include <string>
00024
00025 namespace mitk
00026 {
00027
00049 class MITK_CORE_EXPORT EnumerationProperty : public BaseProperty
00050 {
00051 public:
00052
00053 mitkClassMacro( EnumerationProperty, BaseProperty );
00054
00055 itkNewMacro(EnumerationProperty);
00056
00060 typedef unsigned int IdType;
00061
00066 typedef std::map<IdType, std::string> EnumIdsContainerType;
00067
00072 typedef std::map<std::string, IdType> EnumStringsContainerType;
00073
00077 typedef EnumIdsContainerType::const_iterator EnumConstIterator;
00078
00079
00090 virtual bool AddEnum( const std::string& name, const IdType& id );
00091
00098 virtual bool SetValue( const std::string& name );
00099
00106 virtual bool SetValue( const IdType& id );
00107
00112 virtual IdType GetValueAsId() const;
00113
00118 virtual std::string GetValueAsString() const;
00119
00123 virtual void Clear();
00124
00131 virtual EnumIdsContainerType::size_type Size() const;
00132
00138 virtual EnumConstIterator Begin() const;
00139
00145 virtual EnumConstIterator End() const;
00146
00153 virtual std::string GetEnumString( const IdType& id ) const;
00154
00161 virtual IdType GetEnumId( const std::string& name ) const;
00162
00169 virtual bool IsValidEnumerationValue( const IdType& val ) const;
00170
00177 virtual bool IsValidEnumerationValue( const std::string& val ) const;
00178
00179 virtual bool operator==( const BaseProperty& property ) const;
00180
00181 const EnumIdsContainerType& GetEnumIds() const;
00182 const EnumStringsContainerType& GetEnumStrings() const;
00183
00184 EnumIdsContainerType& GetEnumIds();
00185 EnumStringsContainerType& GetEnumStrings();
00186
00187 protected:
00188
00192 EnumerationProperty();
00193
00194 private:
00195
00196 IdType m_CurrentValue;
00197
00198 EnumIdsContainerType m_EnumIds;
00199
00200 EnumStringsContainerType m_EnumStrings;
00201
00202 typedef std::map<std::string, EnumIdsContainerType> IdMapForClassNameContainerType;
00203 typedef std::map<std::string, EnumStringsContainerType> StringMapForClassNameContainerType;
00204
00205 static IdMapForClassNameContainerType s_IdMapForClassName;
00206 static StringMapForClassNameContainerType s_StringMapForClassName;
00207
00208 };
00209
00210
00211 }
00212
00213 #endif
00214
00215