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 PROPERTYLIST_H_HEADER_INCLUDED_C1C77D8D
00019 #define PROPERTYLIST_H_HEADER_INCLUDED_C1C77D8D
00020
00021 #include "mitkCommon.h"
00022 #include "mitkBaseProperty.h"
00023 #include "mitkGenericProperty.h"
00024 #include "mitkUIDGenerator.h"
00025
00026 #include <itkObjectFactory.h>
00027
00028 #include <string>
00029 #include <map>
00030
00031 namespace mitk {
00032
00033 class XMLWriter;
00034
00065 class MITK_CORE_EXPORT PropertyList : public itk::Object
00066 {
00067
00068 public:
00069
00070 mitkClassMacro(PropertyList, itk::Object);
00071
00075 itkNewMacro(Self);
00076
00085 typedef std::map< std::string,std::pair<BaseProperty::Pointer,bool> > PropertyMap;
00086 typedef std::pair< std::string,std::pair<BaseProperty::Pointer,bool> > PropertyMapElementType;
00087
00091 mitk::BaseProperty* GetProperty(const std::string& propertyKey) const;
00092
00101 void SetProperty(const std::string& propertyKey, BaseProperty* property);
00102
00111 void ReplaceProperty(const std::string& propertyKey, BaseProperty* property);
00112
00116 void ConcatenatePropertyList(PropertyList *pList, bool replace = false);
00117
00118
00119
00120
00121
00122 template <typename T>
00123 bool GetPropertyValue(const char* propertyKey, T & value) const
00124 {
00125 GenericProperty<T>* gp= dynamic_cast<GenericProperty<T>*>(GetProperty(propertyKey));
00126 if ( gp != NULL )
00127 {
00128 value = gp->GetValue();
00129 return true;
00130 }
00131 return false;
00132 }
00133
00137 bool GetBoolProperty(const char* propertyKey, bool& boolValue) const;
00138
00142 void SetBoolProperty( const char* propertyKey, bool boolValue);
00143
00147 bool GetIntProperty(const char* propertyKey, int &intValue) const;
00148
00152 void SetIntProperty(const char* propertyKey, int intValue);
00153
00157 bool GetFloatProperty(const char* propertyKey, float &floatValue) const;
00158
00162 void SetFloatProperty( const char* propertyKey, float floatValue);
00163
00167 bool GetStringProperty(const char* propertyKey, std::string& stringValue) const;
00168
00172 void SetStringProperty( const char* propertyKey, const char* stringValue);
00173
00178 virtual unsigned long GetMTime() const;
00179
00183 bool DeleteProperty(const std::string& propertyKey);
00184
00185 const PropertyMap* GetMap() const { return &m_Properties; }
00186
00187 bool IsEmpty() const { return m_Properties.empty(); }
00188
00189 virtual Pointer Clone();
00190
00191 virtual void Clear();
00192
00193 virtual bool IsEnabled(const std::string& propertyKey);
00194 virtual void SetEnabled(const std::string& propertyKey,bool enabled);
00195
00196
00197 protected:
00198
00199 PropertyList();
00200
00201
00202 virtual ~PropertyList();
00203
00207 PropertyMap m_Properties;
00208
00209 };
00210
00211 }
00212
00213 #endif
00214
00215