21 PropertyMap::const_iterator it;
25 return it->second.GetPointer();
32 std::vector<std::string> propertyKeys;
34 if (contextName.empty() || includeDefaultContext)
37 propertyKeys.push_back(property.first);
45 return std::vector<std::string>();
50 PropertyMap::const_iterator it;
66 if (propertyKey.empty())
84 if (it->second->operator==(*property))
90 if (it->second->AssignProperty(*property))
97 MITK_ERROR <<
"In " __FILE__
", l." << __LINE__ <<
": Trying to set existing property " << it->first
98 <<
" of type " << it->second->GetNameOfClass() <<
" to a property with different type " 99 <<
property->GetNameOfClass() <<
"." 100 <<
" Use ReplaceProperty() instead." << std::endl;
106 m_Properties.insert(PropertyMap::value_type(propertyKey, property));
120 it->second =
nullptr;
125 m_Properties.insert(PropertyMap::value_type(propertyKey, property));
136 it->second =
nullptr;
150 m_Properties.insert(std::make_pair(i->first, i->second->Clone()));
166 if (it->second.IsNull())
168 itkWarningMacro(<<
"Property '" << it->first <<
"' contains nothing (nullptr).");
171 if (Superclass::GetMTime() < it->second->GetMTime())
178 return Superclass::GetMTime();
187 it->second =
nullptr;
200 it->second =
nullptr;
206 itk::LightObject::Pointer mitk::PropertyList::InternalClone()
const 208 itk::LightObject::Pointer result(
new Self(*
this));
209 result->UnRegister();
219 for (
auto iter = propertyMap->cbegin();
220 iter != propertyMap->cend();
223 const std::string key = iter->first;
bool GetFloatProperty(const char *propertyKey, float &floatValue) const
Convenience method to access the value of a FloatProperty.
void SetBoolProperty(const char *propertyKey, bool boolValue)
Convenience method to set the value of a BoolProperty.
virtual const char * GetValue() const
unsigned long GetMTime() const override
Get the timestamp of the last change of the map or the last change of one of the properties store in ...
bool GetIntProperty(const char *propertyKey, int &intValue) const
Convenience method to access the value of an IntProperty.
void SetDoubleProperty(const char *propertyKey, double doubleValue)
Convenience method to set the value of a DoubleProperty.
void ConcatenatePropertyList(PropertyList *pList, bool replace=false)
Set a property object in the list/map by reference.
Key-value list holding instances of BaseProperty.
std::vector< std::string > GetPropertyKeys(const std::string &contextName="", bool includeDefaultContext=false) const override
Query keys of existing properties.
std::vector< std::string > GetPropertyContextNames() const override
Query names of existing contexts.
bool DeleteProperty(const std::string &propertyKey)
Remove a property from the list/map.
virtual T GetValue() const
BaseProperty::ConstPointer GetConstProperty(const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) const override
Get property by its key.
Abstract base class for properties.
std::map< std::string, BaseProperty::Pointer > PropertyMap
void SetProperty(const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
Add new or change existent property.
void ReplaceProperty(const std::string &propertyKey, BaseProperty *property)
Set a property object in the list/map by reference.
bool GetStringProperty(const char *propertyKey, std::string &stringValue) const
Convenience method to access the value of a StringProperty.
PropertyMap m_Properties
Map of properties.
bool Get(const char *propertyKey, bool &boolValue) const
ShortCut for the above method.
static const char * replace[]
This is a dictionary to replace long names of classes, modules, etc. to shorter versions in the conso...
void Set(const char *propertyKey, bool boolValue)
ShortCut for the above method.
mitk::BaseProperty * GetProperty(const std::string &propertyKey) const
Get a property by its name.
BaseProperty * GetNonConstProperty(const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) override
Get property by its key.
void SetStringProperty(const char *propertyKey, const char *stringValue)
Convenience method to set the value of a StringProperty.
void SetIntProperty(const char *propertyKey, int intValue)
Convenience method to set the value of an IntProperty.
void SetFloatProperty(const char *propertyKey, float floatValue)
Convenience method to set the value of a FloatProperty.
void RemoveProperty(const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
Removes a property. If the property does not exist, nothing will be done.
bool GetBoolProperty(const char *propertyKey, bool &boolValue) const
Convenience method to access the value of a BoolProperty.
bool GetDoubleProperty(const char *propertyKey, double &doubleValue) const
Convenience method to access the value of a DoubleProperty.
const PropertyMap * GetMap() const