13 #ifndef mitkGenericProperty_h
14 #define mitkGenericProperty_h
58 itkSetMacro(Value, T);
62 itkGetConstMacro(Value, T);
73 std::stringstream myStr;
106 using BaseProperty::operator=;
122 return (this->m_Value ==
static_cast<const Self &
>(other).m_Value);
127 this->m_Value =
static_cast<const Self &
>(other).m_Value;
143 #define mitkDeclareGenericProperty(PropertyName, Type, Export) \
145 class Export PropertyName : public GenericProperty<Type> \
149 mitkClassMacro(PropertyName, GenericProperty<Type>); \
150 itkFactorylessNewMacro(Self); \
151 itkCloneMacro(Self); \
152 mitkNewMacro1Param(PropertyName, Type); \
154 bool ToJSON(nlohmann::json& j) const override; \
155 bool FromJSON(const nlohmann::json& j) override; \
157 using BaseProperty::operator=; \
161 PropertyName(const PropertyName &); \
162 PropertyName(Type x); \
164 mitkCloneMacro(Self); \
167 #define mitkDefineGenericProperty(PropertyName, Type, DefaultValue) \
168 mitk::PropertyName::PropertyName() : Superclass(DefaultValue) {} \
169 mitk::PropertyName::PropertyName(const PropertyName &other) : GenericProperty<Type>(other) {} \
170 mitk::PropertyName::PropertyName(Type x) : Superclass(x) {} \
171 bool mitk::PropertyName::ToJSON(nlohmann::json& j) const \
173 j = this->GetValue(); \
177 bool mitk::PropertyName::FromJSON(const nlohmann::json& j) \
179 this->SetValue(j.get<Type>()); \
Abstract base class for properties.
Template class for generating properties for simple value types (int, float, bool,...
T ValueType
The type of the value stored by this property.
mitkClassMacro(GenericProperty, BaseProperty)
bool ToJSON(nlohmann::json &) const override
Serialize property value to JSON.
bool FromJSON(const nlohmann::json &) override
Deserialize property value from JSON.
std::string GetValueAsString() const override
Return the property value as a string.
GenericProperty(const GenericProperty &other)
mitkNewMacro1Param(GenericProperty< T >, T)
Convenience header that includes all MITK numeric types.
Find image slices visible on a given plane.